
MCP server for interacting with the opencode cli tool
概览
📚 - Examples, FAQ, Troubleshooting, Best Practices This is a Model Context Protocol (MCP) server that allows AI assistants to interact with the OpenCode CLI. It enables AI assistants to leverage multiple AI models through a unified interface, with features like plan mode for structured thinking and extensive model selection. - Ask questions through multiple AI models via Claude or other MCP clients - Use plan mode for structured analysis and safer operations : Use OpenCode's multi-model capabilities directly in Claude Code with flexible model selection and plan mode features. Before using this tool, ensure you have: 1. (v16.0.0 or higher) 2. installed and configured Type /mcp inside Claude Code to verify the opencode-cli MCP is active. If you already have it configured in Claude Desktop:
README
以下为原文 README 节选,完整内容请查看原文。
OpenCode MCP Tool
📚 Documentation Available in docs/ folder - Examples, FAQ, Troubleshooting, Best Practices
This is a Model Context Protocol (MCP) server that allows AI assistants to interact with the OpenCode CLI. It enables AI assistants to leverage multiple AI models through a unified interface, with features like plan mode for structured thinking and extensive model selection.
- Ask questions through multiple AI models via Claude or other MCP clients
- Use plan mode for structured analysis and safer operations
TLDR:
+ Multiple AI Models via OpenCode
Goal: Use OpenCode’s multi-model capabilities directly in Claude Code with flexible model selection and plan mode features.
Prerequisites
Before using this tool, ensure you have:
- Node.js (v16.0.0 or higher)
- OpenCode CLI installed and configured
One-Line Setup
claude mcp add opencode -- npx -y opencode-mcp-tool -- --model google/gemini-2.5-pro
Verify Installation
Type /mcp inside Claude Code to verify the opencode-cli MCP is active.
Alternative: Import from Claude Desktop
If you already have it configured in Claude Desktop:
- Add to your Claude Desktop config:
"opencode": {
"command": "npx",
"args": ["-y", "opencode-mcp-tool", "--", "--model", "google/gemini-2.5-pro"]
}
- Import to Claude Code:
claude mcp add-from-claude-desktop
Configuration
Register the MCP server with your MCP client. Note: The server requires a primary model to be specified.
For NPX Usage (Recommended)
Add this configuration to your Claude Desktop config file:
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "opencode-mcp-tool", "--", "--model", "google/gemini-2.5-pro", "--fallback-model", "google/gemini-2.5-flash"]
}
}
}
For Global Installation
If you installed globally, use this configuration instead:
{
"mcpServers": {
"opencode": {
"command": "opencode-mcp",
"args": ["--model", "google/gemini-2.5-pro", "--fallback-model", "google/gemini-2.5-flash"]
}
}
}
安装
npx -y opencode-mcp-tool -- --model google/gemini-2.5-pro配置
{
"mcpServers": {
"opencode": {
"command": "npx",
"args": ["-y", "opencode-mcp-tool", "--", "--model", "google/gemini-2.5-pro", "--fallback-model", "google/gemini-2.5-flash"]
}
}
}