opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(mcp): add MCP server to expose custom tools via stdio

Open lperkov opened this issue 2 weeks ago • 0 comments

Add ability to run OpenCode as an MCP server, allowing external MCP clients to access custom tools defined in .opencode/tool/ and plugins.

Features:

  • opencode mcp serve command to start stdio MCP server
  • opencode mcp serve --list for dry-run tool listing
  • Config-driven: mcpServer.enabled and mcpServer.tools for filtering
  • Wildcard patterns for allowlist/blocklist tool filtering
  • Only custom tools exposed (built-ins excluded for security)

Config example:

{
  "mcpServer": {
    "enabled": true,
    "tools": { "*": false, "my-tool": true }
  }
}

Relates to: #3306 #1507 #296

lperkov avatar Dec 30 '25 16:12 lperkov