Overview
MCP (Model Context Protocol) servers add external tools to OpenCode. Configure local command-based servers or remote HTTP servers with optional OAuth authentication.Local MCP Server
Local Server Options
| Option | Type | Required | Description |
|---|---|---|---|
type | "local" | Yes | Server type |
command | string[] | Yes | Command to run |
environment | object | No | Environment variables |
enabled | boolean | No | Enable on startup |
timeout | number | No | Timeout in ms (default: 5000) |
Remote MCP Server
Remote Server Options
| Option | Type | Required | Description |
|---|---|---|---|
type | "remote" | Yes | Server type |
url | string | Yes | Server URL |
headers | object | No | HTTP headers |
oauth | object / false | No | OAuth config or disable |
enabled | boolean | No | Enable on startup |
timeout | number | No | Timeout in ms (default: 5000) |
OAuth Configuration
Per-Agent MCP Tools
Restrict MCP tools to specific agents:researcher agent.
Registry Shorthand
In registry component manifests, remote MCP servers use URL shorthand:{ "type": "remote", "url": "https://...", "enabled": true }.
See Also
- Plugin Development — Build plugins with embedded tools.
- Custom Tools — Custom tool implementations.
- Permissions — Tool access control.