How to add MCP servers to OpenCode (opencode.json)
Configure local and remote MCP servers in OpenCode with the mcp object in opencode.json.
Local server
Add an entry under mcp with type: "local"; the command is an array:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"fetch": {
"type": "local",
"command": ["uvx", "mcp-server-fetch"],
"enabled": true
}
}
}Remote server
{
"mcp": {
"jira": { "type": "remote", "url": "https://jira.example.com/mcp", "enabled": true }
}
}Set enabled to false to switch a server off without removing it.