OpenCode
An MCP server that enables discovery and interaction with multiple OpenCode instances across different machines using SSH reverse tunnels. It provides tools for listing instances, managing chat sessions, and sending messages to remote coding environm
What is OpenCode?
OpenCode is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to mcp server that enables discovery and interaction with multiple opencode instances across different machines using ssh reverse tunnels. it provides tools for listing instances, managing chat sessions,...
An MCP server that enables discovery and interaction with multiple OpenCode instances across different machines using SSH reverse tunnels. It provides tools for listing instances, managing chat sessions, and sending messages to remote coding environm
This server falls under the Coding Agents category on MCPgee, the world's largest MCP server directory with 33,000+ servers.
Features
- An MCP server that enables discovery and interaction with mu
Use Cases
Maintainer
Works with
Installation
Manual Installation
npx opencodeConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
How to Set Up and Use OpenCode
The opencode-mcp server lets a single AI agent discover and communicate with multiple OpenCode instances running across different machines, using SSH reverse tunnels as a relay. It exposes three MCP tools — list instances, send a message to a session, and read recent messages — enabling multi-machine AI coding workflows where one orchestrator agent can delegate tasks to remote OpenCode processes. It is particularly useful for distributed development setups, CI machines, or cloud VMs where you want centralized AI control over several concurrent coding environments.
Prerequisites
- Node.js and npm installed on the machine running the MCP server
- OpenCode installed on each remote machine you want to control
- SSH access (and optionally gcloud CLI) for the relay tunnel if using remote instances
- An MCP client such as Claude Desktop or Claude Code
- The `opencode-connected` helper script placed in your PATH
Clone and build the repository
Clone the opencode-mcp repository and compile the TypeScript source.
git clone https://github.com/klutometis/opencode-mcp.git && cd opencode-mcp && npm install && npm run buildInstall the opencode-connected helper script
Symlink the helper script into a directory on your PATH so each OpenCode instance can register itself with the relay.
ln -s ~/path/to/opencode-mcp/scripts/opencode-connected ~/bin/opencode-connectedStart an OpenCode instance and register it
On each machine where OpenCode is running, call opencode-connected to register the instance with the local relay directory. Set INSTANCE_NAME to give it a memorable label.
INSTANCE_NAME=my-laptop opencode-connectedConfigure a remote relay with SSH (optional)
For instances on remote machines, set RELAY_SSH_CMD to the SSH command that reaches your relay host. The script will tunnel the registration through SSH.
export RELAY_SSH_CMD="gcloud compute ssh mcp-gateway --zone=us-central1-a --project=my-project --"
INSTANCE_NAME=cloud-vm opencode-connectedConfigure your MCP client to start the opencode-mcp server
Add the opencode-mcp server to your MCP client so it can use the instances, send, and read tools.
{
"mcpServers": {
"opencode": {
"command": "node",
"args": ["/path/to/opencode-mcp/dist/index.js"],
"env": {
"RELAY_REGISTRY_DIR": "/tmp/opencode-relay"
}
}
}
}OpenCode Examples
Client configuration (stdio transport)
Configure Claude Desktop to launch the opencode-mcp server and connect to the local relay registry.
{
"mcpServers": {
"opencode": {
"command": "node",
"args": ["/path/to/opencode-mcp/dist/index.js"],
"env": {
"RELAY_REGISTRY_DIR": "/tmp/opencode-relay",
"DISCOVERY_INTERVAL_MS": "30000"
}
}
}
}Prompts to try
Use these prompts with an AI assistant connected to the opencode-mcp server to orchestrate remote coding sessions.
- "List all available OpenCode instances and their current status."
- "Send a message to the 'cloud-vm' instance: refactor the authentication module to use JWT."
- "Read the last 20 messages from the 'my-laptop' OpenCode session."
- "Check which instances are currently idle and delegate the test-writing task to one of them."
- "Abort the current task running on the 'cloud-vm' instance."Troubleshooting OpenCode
The instances tool returns an empty list
Make sure opencode-connected has been run on each machine with a unique INSTANCE_NAME. Check that RELAY_REGISTRY_DIR points to the same directory used by opencode-connected (default: /tmp/opencode-relay). Registrations expire, so re-run opencode-connected if needed.
send tool times out when messaging a remote instance
SEND_TIMEOUT_MS defaults to 300000ms (5 minutes). For long-running tasks this may still time out — increase it via the environment variable. Also verify the SSH relay tunnel is active and the remote instance is reachable.
opencode-connected exits immediately without registering
Check that RELAY_SSH_CMD (if set) is a valid SSH command that you can run manually. For local-only mode, leave RELAY_SSH_CMD unset. Ensure the RELAY_REGISTRY_DIR directory is writable.
Frequently Asked Questions about OpenCode
What is OpenCode?
OpenCode is a Model Context Protocol (MCP) server that mcp server that enables discovery and interaction with multiple opencode instances across different machines using ssh reverse tunnels. it provides tools for listing instances, managing chat sessions, and sending messages to remote coding environm It connects AI assistants to external tools and data sources through a standardized interface.
How do I install OpenCode?
Follow the installation instructions on the OpenCode GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.
Which AI clients work with OpenCode?
OpenCode works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.
Is OpenCode free to use?
Yes, OpenCode is open source and available under the MIT License license. You can use it freely in both personal and commercial projects.
OpenCode Alternatives — Similar Coding Agents Servers
Looking for alternatives to OpenCode? Here are other popular coding agents servers you can use with Claude, Cursor, and VS Code.
Dify
★ 142.2kProduction-ready platform for agentic workflow development.
Ruflo
★ 54.0k🌊 The leading agent orchestration platform for Claude. Deploy intelligent multi-agent swarms, coordinate autonomous workflows, and build conversational AI systems. Features enterprise-grade architecture, self-learning swarm intelligence, RAG integrat
Goose
★ 45.7kan open source, extensible AI agent that goes beyond code suggestions - install, execute, edit, and test with any LLM
Antigravity Awesome Skills
★ 38.3kInstallable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.
AgentScope
★ 25.5kBuild and run agents you can see, understand and trust.
Serena
★ 24.5kA coding agent toolkit that provides IDE-like semantic code retrieval and editing tools, enabling LLMs to efficiently navigate and modify codebases using symbol-level operations instead of basic file reading and string replacements.
Browse More Coding Agents MCP Servers
Explore all coding agents servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.
Set Up OpenCode in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
Ready to use OpenCode?
Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.