Remote OpenCode MCP Server

Remote OpenCode MCP Server

A Model Context Protocol (MCP) server that enables remote access to OpenCode AI coding agent, allowing MCP-compatible clients to leverage OpenCode's capabilities.

Category
Visit Server

README

Remote OpenCode MCP Server

PyPI version License: MIT

A Model Context Protocol (MCP) server that enables remote access to OpenCode AI coding agent. This allows MCP-compatible clients (Claude Desktop, Cursor, etc.) to leverage OpenCode's capabilities.

Features

  • Remote OpenCode Integration: Connect to OpenCode instances running anywhere
  • MCP Protocol: Full MCP server implementation with SSE transport
  • 4 Core Tools:
    • Create new sessions
    • Send prompts with automatic timeout handling
    • Check session status and history
    • List all sessions
  • Configurable Timeout: Adjustable task timeout via environment variable
  • Authentication Support: Optional password protection

Requirements

  • Python 3.12+
  • OpenCode running in serve mode

OpenCode Serve Mode

This MCP server requires OpenCode to be running in serve mode with API enabled:

opencode --serve

Or with custom port and password:

opencode --serve --port 4096 --password your_password

Make sure OPENCODE_URL and OPENCODE_SERVER_PASSWORD in your .env match the serve command.

Installation

From Source

git clone https://github.com/Dirichelet/remote-opencode-mcp.git
cd remote-opencode-mcp
uv sync

Using uv

uv add remote-opencode-mcp

Configuration

Create a .env file (copy from example.env):

cp example.env .env

Environment Variables

Variable Description Default
OPENCODE_URL OpenCode server URL http://127.0.0.1:4096
OPENCODE_SERVER_PASSWORD Authentication password (none)
MCP_PORT MCP server port 14962
OPENCODE_TASK_TIMEOUT Task wait timeout in seconds (0 for async) 60

Usage

Start the Server

python server.py

Or with uv:

uv run python server.py

Output:

=========================================
šŸš€ OpenCode MCP Server started
šŸŽÆ Target: http://127.0.0.1:4096
ā±ļø Task timeout: 60 seconds
šŸ”— SSE URL:  http://127.0.0.1:14962/sse
=========================================

Available Tools

1. opencode_create_session

Create a new OpenCode session.

Input:

{
  "title": "My Task"  // optional
}

2. opencode_send_prompt

Send a prompt to an existing session and wait for result.

Input:

{
  "session_id": "ses_xxxx",
  "prompt": "Help me write a Python function"
}

3. opencode_check_session

Get session status and full conversation history.

Input:

{
  "session_id": "ses_xxxx"
}

4. opencode_list_sessions

List all sessions.

Input:

{
  "limit": 10  // optional, default 10
}

MCP Client Integration

Claude Desktop

Add to claude_desktop_config.json:

{
  "mcpServers": {
    "opencode": {
      "command": "uv",
      "args": ["--directory", "/path/to/remote-opencode-mcp", "run", "python", "server.py"]
    }
  }
}

Other MCP Clients

Connect to the SSE endpoint:

http://localhost:14962/sse

Workflow Example

User → MCP Client → remote-opencode-mcp → OpenCode Server
                              ↓
                      1. Create session
                      2. Send prompt
                      3. Wait for result
                      4. Return to client

Development

Install Dev Dependencies

uv sync --extra dev

Linting

uv run ruff check .

Type Checking

uv run mypy .

License

MIT License - see LICENSE for details.

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

Related

  • OpenCode - The AI coding agent
  • MCP - Model Context Protocol

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured