MCP client - Anomaly - verified
How to add an MCP server to opencode
Where to add MCP servers in opencode: mcp.servers in opencode.json(c) or .opencode/opencode.json(c) in the project, or ~/.config/opencode/opencode.json(c) globally; or opencode mcp add. Its docs list support for stdio and Streamable HTTP. They do not state SSE. It handles OAuth sign-in for remote servers.
opencode homepage - OpenCode in our tools directory - Compare all MCP clients
- Kind
- Coding agent
- stdio
- Yes
- Streamable HTTP
- Yes
- SSE
- Not stated
Add a server
- Where the config lives
- mcp.servers in opencode.json(c) or .opencode/opencode.json(c) in the project, or ~/.config/opencode/opencode.json(c) globally; or
opencode mcp add
The example from the opencode docs, copied verbatim. Swap in your server's name, command or URL.
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"servers": {
"my-server": {
"type": "local",
"command": ["npx", "-y", "example-mcp-server"],
},
},
},
}Source: opencode.ai/v2/docs/mcp-servers
Which server?
Pick a server from the verified directory of official MCP servers. Each one lists its transport, auth and the setup snippets its vendor publishes, so you can match it to what opencode supports.
MCP support
What the opencode docs say it supports. Not stated means the docs do not say either way.
| Feature | Value | Source |
|---|---|---|
| ToolsCalls the functions a server exposes. | Yes | opencode.ai/v2/docs/mcp-servers |
| ResourcesReads data and files a server exposes as resources. | Yes | opencode.ai/v2/docs/mcp-servers |
| PromptsOffers a server's prompt templates to the user. | Yes | opencode.ai/v2/docs/mcp-servers |
| SamplingLets a server ask the client's model for a completion. | Not stated | Docs do not say |
| RootsTells a server which directories it may work in. | Not stated | Docs do not say |
| ElicitationLets a server ask the user for input mid-task. | Yes | opencode.ai/v2/docs/mcp-servers |
| DiscoveryPicks up tools, prompts or resources a server adds or removes while connected. | Not stated | Docs do not say |
| InstructionsUses the instructions a server sends when it connects. | Yes | opencode.ai/v2/docs/mcp-servers |
| stdioStarts a local server as a subprocess. | Yes | opencode.ai/v2/docs/mcp-servers |
| Streamable HTTPConnects to a remote server over the current HTTP transport. | Yes | opencode.ai/v2/docs/mcp-servers |
| SSEConnects over the older HTTP+SSE transport. | Not stated | Docs do not say |
| OAuthSigns in to remote servers with OAuth. | Yes | opencode.ai/v2/docs/mcp-servers |
Worth knowing
OpenCode v2 places servers under mcp.servers and uses the legacy initialize handshake by default, with an opt-in protocol setting for the 2026-07-28 MCP revision.
Other coding agents
FAQ
Where is the opencode MCP config?
mcp.servers in opencode.json(c) or .opencode/opencode.json(c) in the project, or ~/.config/opencode/opencode.json(c) globally; or opencode mcp add. The example on this page is copied from https://opencode.ai/v2/docs/mcp-servers
Does opencode support remote MCP servers over Streamable HTTP?
Yes, per https://opencode.ai/v2/docs/mcp-servers. Its docs list support for stdio and Streamable HTTP. They do not state SSE.
Does opencode support OAuth for MCP servers?
Yes. It handles OAuth sign-in for remote servers. Source: https://opencode.ai/v2/docs/mcp-servers
Which MCP features does opencode support?
Its docs list Tools, Resources, Prompts, Elicitation and Instructions. They do not state Sampling, Roots and Discovery.
Sources
Last verified from the pages below.
- OpenCode v2 docs: MCP servers - opencode.ai
- OpenCode v2 docs: Config - opencode.ai
- OpenCode docs (v1): MCP servers - opencode.ai
Newsletter
New MCP servers, the week they ship
One email per week. New official MCP servers, the coding tools that support them and how developers wire them up.