Skip to content

Connect OpenCode

Add Spec0

Open or create opencode.json (or opencode.jsonc) in your project and add:

{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"spec0": {
"type": "remote",
"url": "http://127.0.0.1:7474/mcp",
"enabled": true
}
}
}

OpenCode picks up MCP config from opencode.json in your project root, or from a global config at the platform’s standard XDG config location.

Verify the connection

In an OpenCode session, ask the agent:

Call the spec0_whoami tool.

Successful response means OpenCode reached Spec0’s MCP endpoint and the tool catalog is now available to the agent.

If you hit a transport mismatch

OpenCode’s type: "remote" historically targeted SSE-only MCP servers. Spec0 uses Streamable HTTP — the newer transport that’s becoming the standard. If your OpenCode version rejects the connection or only fetches part of the tool list, you have two paths:

  1. Update OpenCode to a version that supports Streamable HTTP under type: "remote". This is the right long-term answer.

  2. Bridge with mcp-remote as a stop-gap. Replace the entry with:

    {
    "mcp": {
    "spec0": {
    "type": "local",
    "command": ["npx", "-y", "mcp-remote", "http://127.0.0.1:7474/mcp", "--transport", "http-only"],
    "timeout": 60000
    }
    }
    }

    This launches a local stdio MCP that translates to/from Streamable HTTP. Works, but adds a process.