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.
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
Grab a key from app.buildonto.dev/read/keys. Free tier: 1,000 requests / month.
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.
{
"$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:
"command": ["cmd", "/c", "npx", "-y", "@ontosdk/mcp@latest"]Save the config and restart opencode (Ctrl+C the TUI, then re-launch). MCP servers are loaded once at startup.
Config file paths
| Scope | Path |
|---|---|
| Project (recommended) | <repo root>/opencode.jsonc or opencode.json |
| Global · macOS / Linux | ~/.config/opencode/opencode.json |
| Global · Windows | %APPDATA%\opencode\opencode.json |
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.