OpenCode

Provides an MCP interface to run OpenCode CLI commands, manage sessions, and discover models for async, streaming coding tasks.
  • python

2

GitHub Stars

python

Language

3 months ago

First Indexed

3 weeks ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "nosolosoft-opencode-mcp": {
      "command": "python",
      "args": [
        "-m",
        "src.services.fast_mcp.opencode_server"
      ],
      "env": {
        "OPENCODE_COMMAND": "opencode",
        "OPENCODE_MAX_TIMEOUT": "600",
        "OPENCODE_DEFAULT_AGENT": "build",
        "OPENCODE_DEFAULT_MODEL": "anthropic/claude-echo-2-20240515",
        "OPENCODE_DEFAULT_TIMEOUT": "300",
        "OPENCODE_SERVER_LOG_LEVEL": "INFO"
      }
    }
  }
}

You can run and manage OpenCode-driven coding tasks through a dedicated MCP server that exposes a simple, programmable interface. This server lets you execute OpenCode commands, manage coding sessions, discover available models, and handle long-running tasks asynchronously, all from your MCP client.

How to use

You integrate the OpenCode MCP Server with your MCP client to perform coding tasks, manage sessions, and query models. Use the provided tools to run OpenCode commands, start or continue sessions, and list available models. The server communicates through a local or remote MCP channel as configured, so you can orchestrate complex workflows from your editor, terminal, or automation scripts.

How to install

Prerequisites you need before installing are Python 3.10 or newer and a properly configured OpenCode CLI. Ensure your MCP client is ready to connect via the stdio interface described below.

Install the server dependencies from your project environment.

Configure the MCP client to connect to the OpenCode MCP Server using the stdio command shown in the example.

pip install -r requirements.txt
{
  "mcpServers": {
    "opencode": {
      "command": "python",
      "args": ["-m", "src.services.fast_mcp.opencode_server"]
    }
  }
}

Additional sections

Environment variables are available to customize how the server runs. You can set these in your shell environment before starting the server. The following variables are commonly used by the client and server integration:

  • OPENCODE_COMMAND: Path to the OpenCode CLI (default: opencode)
  • OPENCODE_DEFAULT_MODEL: Default model to use when none is specified
  • OPENCODE_DEFAULT_AGENT: Default agent to use when none is specified
  • OPENCODE_DEFAULT_TIMEOUT: Default timeout in seconds (default: 300)
  • OPENCODE_MAX_TIMEOUT: Maximum timeout in seconds (default: 600)
  • OPENCODE_SERVER_LOG_LEVEL: Logging level (default: INFO)

Available tools

execute_opencode_command

Execute any OpenCode CLI command with full flexibility, returning the streamed or final result.

opencode_run

Run OpenCode with a simple prompt message to generate code or perform tasks.

opencode_continue_session

Continue an existing OpenCode session using the given session ID and optional follow-up message.

opencode_list_models

List available models from all configured providers, with optional provider filtering.

opencode_export_session

Export session data as JSON for later sharing or re-use.

opencode_get_status

Check the availability and status of the OpenCode CLI integration.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational