Add a local MCP server

mcp & integrations

// what it does

Under the mcp key, a "local" server is one opencode launches as a subprocess: give it a command array and an optional environment map, and set enabled:true. It starts with opencode and its tools become available to the agent. Add it to opencode.json (global or project), or manage servers with opencode mcp.

// shell

$ ~/.config/opencode/opencode.json
$ { "mcp": { "my-server": { "type": "local", "command": ["npx", "-y", "my-mcp-server"], "enabled": true } } }
$ opencode mcp list

// gotcha

command is an array, not a string — ["npx", "-y", "pkg"], not "npx -y pkg". A slow server can hit the default 5000ms tool-fetch timeout; raise timeout if its tools never appear.

// resources