MCP in opencode

Add Onto to opencode, the open-source AI coding agent for the terminal. opencode uses a top-level mcp block (not mcpServers) with type: "local" for stdio servers — slightly different from the standard MCP schema.

opencode's schema is different. Top-level key is mcp, each server needs type: "local", command is an array (not a string), and env vars go under environment (not env). Copy carefully.

Install steps

Get an API key

Grab a key from app.buildonto.dev/read/keys. Free tier: 1,000 requests / month.

Open your opencode config

For a single project, create opencode.jsonc (or opencode.json) in the project root. For all projects, edit your global config — paths in the table below.

Add the Onto MCP server
jsonopencode.jsonc
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "onto": {
      "type": "local",
      "command": ["npx", "-y", "@ontosdk/mcp@latest"],
      "enabled": true,
      "environment": {
        "ONTO_API_KEY": "onto_sk_live_your_key_here"
      }
    }
  }
}

On Windows, if opencode can't resolve npx directly, wrap it through cmd:

json
"command": ["cmd", "/c", "npx", "-y", "@ontosdk/mcp@latest"]
Restart opencode

Save the config and restart opencode (Ctrl+C the TUI, then re-launch). MCP servers are loaded once at startup.

Config file paths

ScopePath
Project (recommended)<repo root>/opencode.jsonc or opencode.json
Global · macOS / Linux~/.config/opencode/opencode.json
Global · Windows%APPDATA%\opencode\opencode.json
Project config wins. If a setting appears in both project and global config, the project file takes precedence. Keep API keys out of project files you commit — use the global config or environment.

Verify

After restart, ask the agent what tools it has access to. You should see read_url, score_url, and read_and_score under the onto server.

Try it: "Use Onto to read https://stripe.com/pricing and summarize the tiers."