Skip to main content
Glama

Claude Desktop → OpenCode CLI Development Bridge MCP

A local Model Context Protocol (MCP) server that connects Claude Desktop (Planner / Architect) to OpenCode CLI (Coding Engineer / Executor) via standard input/output (stdio) transport.

1. Architecture

                    USER
                      │
                 CLAUDE DESKTOP
                 PLANNER/ARCHITECT
                      │
                dynamic prompt
                      │
                 MCP SERVER
                    BRIDGE
                      │
           ┌──────────┴──────────┐
           ▼                     ▼
      IDE Launcher          OPENCODE CLI
   (VS Code / Antigravity)  CODING ENGINEER
                                 │
           ┌─────────────────────┼─────────────────────┐
           ▼                     ▼                     ▼
        Files                 Terminal               Tests
           │                     │                     │
           └─────────────────────┼─────────────────────┘
                                 │
                            LOCAL PROJECT
                                 │
                           REAL EXECUTION
                                 │
                       PASS / PARTIAL / FAIL
                                 │
                              MCP SERVER
                                 │
                            CLAUDE DESKTOP
                                 │
                       next engineering instruction

Key Principles

  • Claude Desktop is the Planner/Architect: Requirements analysis, architectural design, task decomposition, and reviewing execution feedback.

  • OpenCode CLI is the Coding Engineer: Inspects the workspace, writes/edits code, executes commands, builds projects, runs automated tests, and fixes implementation errors.

  • MCP Server is the Bridge: Handles environment verification, opens workspaces in VS Code or Antigravity IDE when requested, launches OpenCode CLI process as a local subprocess, parses output/session events, and returns execution feedback.


Related MCP server: opencode-executor-mcp

2. Requirements

  • Operating System: Windows 10/11, macOS, or Linux

  • Python: Version 3.10 or higher

  • OpenCode CLI: Installed globally (npm install -g opencode-ai or similar)

  • Target IDE (Optional): VS Code (code) or Antigravity IDE (antigravity-ide)


3. Installation

Step 1: Navigate to Project Directory

cd "d:\AI tools\MCP's\Claude-Opencode"

Step 2: Create & Activate Virtual Environment

python -m venv .venv
.\.venv\Scripts\Activate.ps1

Step 3: Install Package

pip install -r requirements.txt
pip install -e .

4. Claude Desktop Configuration

Locate your Claude Desktop configuration file:

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Add the opencode server configuration:

{
  "mcpServers": {
    "opencode": {
      "command": "d:\\AI tools\\MCP's\\Claude-Opencode\\.venv\\Scripts\\python.exe",
      "args": [
        "-m",
        "antigravity_mcp.server"
      ],
      "env": {
        "PYTHONPATH": "src",
        "DEFAULT_IDE": "cli_direct",
        "OPENCODE_PATH": "C:\\Users\\LENOVO\\AppData\\Roaming\\npm\\opencode.cmd",
        "VSCODE_PATH": "C:\\Users\\LENOVO\\AppData\\Local\\Programs\\Microsoft VS Code\\bin\\code.cmd",
        "ANTIGRAVITY_PATH": "D:\\AI tools\\Antigravity\\Antigravity IDE\\bin\\antigravity-ide.cmd"
      }
    }
  }
}

Path Overrides

If Claude Desktop does not inherit your full environment PATH, configure explicit executable paths:

  • OPENCODE_PATH: Path to opencode / opencode.cmd / opencode.exe

  • VSCODE_PATH: Path to code.cmd / code.exe

  • ANTIGRAVITY_PATH: Path to antigravity-ide.cmd

  • DEFAULT_IDE: Preferred execution environment (cli_direct, vs_code, antigravity)


5. Primary MCP Tools

Tool Name

Parameters

Description

delegate_to_opencode

prompt: string, workspace_path: string, ide?: string

Primary Engineering Tool. Forwards dynamic engineering instructions to OpenCode CLI in target workspace. Returns structured execution status (STATUS: PASS / PARTIAL / FAIL), file diffs, exit codes, and output.

continue_opencode

interaction_id: string, prompt: string, workspace_path: string, ide?: string

Continue an active OpenCode session using real OpenCode session ID (interaction_id).

open_workspace_in_ide

workspace_path: string, ide?: string

Open workspace directory in VS Code or Antigravity IDE.

get_opencode_status

None

Check OpenCode CLI installation, version, and IDE environment status.

Backward compatibility aliases (delegate_to_antigravity, ask_antigravity, continue_antigravity, open_antigravity_workspace) are also provided and route directly to OpenCode CLI.


6. Testing

To run the complete test suite:

$env:PYTHONPATH="src"; .venv\Scripts\python.exe -m pytest

To run with live OpenCode CLI LLM execution smoke tests:

$env:PYTHONPATH="src"; $env:RUN_REAL_OPENCODE_SMOKE="1"; .venv\Scripts\python.exe -m pytest

Claude-Opencode-mcp

Available Tools

15 tools
ask_antigravityD

Alias for delegate_to_opencode.

Inputs: prompt (required). Returns: result

continue_antigravityD

Alias for continue_opencode.

Inputs: prompt (required), interaction_id (required), workspace_path. Returns: result

continue_opencodeA

Continue an active OpenCode engineering session while preserving session context.

Use this tool to send follow-up instructions, fix build/test failures, or proceed to the next engineering task in the development loop.

Args: interaction_id: The OpenCode session ID of the previous interaction session to continue. prompt: Dynamic follow-up instruction generated by Claude Desktop. workspace_path: Local workspace directory path. ide: Optional IDE environment preference ('vs_code', 'antigravity', or 'cli_direct').

Inputs: prompt (required), interaction_id (required), workspace_path (required), ide. Returns: result

delegate_to_antigravityC

Alias for delegate_to_opencode.

Inputs: prompt (required), workspace_path. Returns: result

delegate_to_opencodeA

Delegate a real-time software engineering instruction to OpenCode CLI.

Claude Desktop acts as the Planner and Architect. OpenCode CLI acts as the Coding Engineer. The dynamic prompt is forwarded unchanged to OpenCode executing in the target workspace.

Args: prompt: Dynamic, real-time natural language engineering instruction generated by Claude. workspace_path: Absolute or relative local workspace directory path. ide: Optional IDE environment preference ('vs_code', 'antigravity', or 'cli_direct').

Inputs: prompt (required), workspace_path (required), ide. Returns: result

diagnose_antigravity_workspaceC

Run project diagnostics in local workspace.

Inputs: path (required). Returns: result

fix_antigravity_workspaceC

Apply targeted file write within workspace boundary.

Inputs: content (required), relative_path (required), workspace_path (required). Returns: result

get_antigravity_statusB

Alias for get_opencode_status.

Inputs: no named parameters. Returns: result

get_antigravity_workspaceB

Query currently active workspaces in local IDE.

Inputs: no named parameters. Returns: result

get_opencode_statusA

Check OpenCode CLI executable availability, version, and IDE readiness.

Inputs: no named parameters. Returns: result

inspect_antigravity_workspaceC

Inspect local workspace directory structure and manifest files.

Inputs: path (required). Returns: result

launch_antigravity_workspaceC

Launch application in workspace using detected launcher.

Inputs: path (required). Returns: result

open_antigravity_workspaceC

Alias for open_workspace_in_ide with Antigravity IDE.

Inputs: path (required). Returns: result

open_workspace_in_ideB

Open an existing workspace directory in VS Code or Antigravity IDE.

Args: workspace_path: Directory path of the workspace to open. ide: Target IDE ('vs_code' or 'antigravity'). Defaults to configured default IDE.

Inputs: workspace_path (required), ide. Returns: result

read_antigravity_workspace_fileC

Safely read content of a workspace file.

Inputs: relative_path (required), workspace_path (required), max_lines. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    C2.4/5.0

    Scored across 15 tools

    Disambiguation1/5

    Several tools are explicit aliases for the same operation, such as delegate_to_opencode/delegate_to_antigravity/ask_antigravity, get_opencode_status/get_antigravity_status, continue_opencode/continue_antigravity, and open_workspace_in_ide/open_antigravity_workspace. This creates serious ambiguity because an agent can select multiple different tool names to perform the same action, and the remaining antigravity workspace tools also have overlapping file/diagnostic boundaries.

    Naming Consistency2/5

    There is no consistent naming pattern across the set: some tools use verb_to_target like delegate_to_opencode, others are target-prefixed like get_antigravity_status, and others are generic like open_workspace_in_ide. Aliases also have divergent names such as ask_antigravity, making the convention even less predictable.

    Tool Count3/5

    15 tools is on the higher side for a single integration server, and the presence of at least five aliases makes the count feel padded rather than purposeful. However, once aliases are removed, the remaining unique session and workspace operations are roughly reasonable for the stated scope.

    Completeness4/5

    The core workflow of delegating to OpenCode, continuing sessions, checking status, opening workspaces, inspecting files, and running diagnostics is well covered. Minor gaps such as no session listing or cancellation can be worked around using returned interaction IDs and workspace queries.

    Related MCP Connectors

    Related MCP Servers