Skip to content

Opencode MCP

MCP server for OpenCode AI — 70 tools, 10 resources, 5 prompts. Use npx opencode-mcp with Claude Desktop, Claude Code, Cursor, Windsurf, or any MCP client.

Install

$claude mcp add opencode -- npx -y opencode-mcp

Install command taken from the project's README or registry entry. Always review code before running it.

opencode-mcp

Delegate coding work to OpenCode from your MCP client.

opencode-mcp connects Claude, Cursor, VS Code, and other MCP clients to OpenCode's headless API. Ask questions, implement features, monitor background work, respond to questions and permissions, and review changes across projects.

Version 3.0.0 requires Node.js 22 or newer. Upgrading from 2.x? See the migration notes.

Quick Start

Install OpenCode and start its server from your project:

opencode serve --hostname 127.0.0.1 --port 4096

If you use the TUI, start it with opencode --port 4096 and share that server. Set OPENCODE_BASE_URL for another endpoint.

For Claude Code:

claude mcp add opencode -- npx -y opencode-mcp

For clients using an mcpServers configuration:

{
  "mcpServers": {
    "opencode": {
      "command": "npx",
      "args": ["-y", "opencode-mcp"]
    }
  }
}

Restart the client and call opencode_setup. Choose a provider from its configured providers, then use opencode_provider_models to select a model. Set OPENCODE_DEFAULT_PROVIDER and OPENCODE_DEFAULT_MODEL together or pass the selected IDs in each prompt call.

Client-specific configuration includes VS Code, Windsurf, Continue, Zed, and Amazon Q. To test unreleased changes, build from source and configure your client to run node with the absolute path to dist/index.js.

Choose a Workflow

Need Tools
Setup and orientation opencode_setup, opencode_context, opencode_provider_models
Quick question or follow-up opencode_ask, opencode_reply
Start work and wait opencode_run
Work in the background opencode_fire, then opencode_check or opencode_wait
Recover or control a recorded job opencode_job_list, opencode_job_get, opencode_job_cancel
Resolve required input opencode_job_input, permission and question tools
Review the result opencode_review_changes, opencode_conversation
opencode_fire({
  directory: "/absolute/path/to/project",
  prompt: "Add input validation to POST /api/users and run the relevant tests",
  providerID: "<configured-provider>",
  modelID: ""
})
// Save the returned job and session IDs; use them to monitor or resume observation.

Async results distinguish accepted, running, input_required, completed, failed, cancelled, and unknown. An observation timeout returns current progress; it does not mean the task failed or was cancelled. Follow the returned state and IDs instead of assuming an absent busy status means success.

Modern clients can use the MCP Tasks extension for opencode_run. Clients without that extension use ordinary tools, including opencode_fire and opencode_check. Task status is retrieved by polling; this package does not promise to wake an idle assistant with completion notifications.

Tools retain readable text and provide structured results for clients that consume them. Prompt tools accept optional model variants and OpenCode structured-output formats. See the generated tools reference and examples.

Multi-Project Use

Similar plugs

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

Java 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype…

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io