Skip to main content
Glama

opencode-cli-mcp

šŸ“– Installation Guide - quick start, manual setup, and troubleshooting šŸ“– Onboarding - 5-minute first-run guide šŸ“– Full reference - tools, endpoints, env vars, architecture

MCP server wrapping opencode CLI's HTTP API (opencode serve) into 22 FastMCP tools (7 primary portmanteaus + 15 legacy aliases). Also includes a FastAPI REST bridge (unified with the MCP endpoint on one port), a Vite/React fleet-standard dashboard, and OpenCode custom tools that extend opencode itself.

Pattern: Plan with Claude, implement with opencode. Claude (expensive, high-judgment) orchestrates and supervises; opencode handles implementation grunt work on cheaper models (DeepSeek V4 Flash/Pro).

🧠 Eternal Session Memory — opencode stores every session since install in one searchable SQLite database. Ask it "what were we discussing last December about X?" — no other agentic IDE can do that. opencode-cli-mcp makes that memory searchable, exportable, editable, and backed up.

What can you do?

Capability

How

Wayback session find

opencode_depot(action="search", query="...") — full-text (FTS5) across every session transcript and title, ever. "What were we working on in December?"

Semantic recall (RAG)

opencode_depot(action="rag", query="...") — embeddings-based similarity over indexed transcripts; find it when you don't remember the words. rag_index builds the index, rag_status shows state

Read the past

opencode_sessions(action="messages"|"diff"|"export", session_id=...) — full transcript, file changes, or a clean markdown/html document

Edit the past

rename / archive / unarchive / delete sessions (live API or offline depot)

Never lose it

opencode_backups(action="create"|"restore", ...) — db + config snapshots, rotation, disk guard, autobackup every 24h

Run agents

opencode_runs(action="start"|"status"|"list"|"cancel", ...) — launch, supervise, review

Manage opencode

opencode_system(...) — status, providers, project, MCP pulse, config drift

Desktop sidebar

sidebar/opencode-sidebar.ahk (AHK v2 companion, outside the .mcpb) — docked session list, palette jump, right-click rename/archive/delete, hover previews. See docs/SIDEBAR.md

Related MCP server: mcp-gw

Install

Download: opencode-cli-mcp-0.2.11-setup.exe - installs the desktop app and its embedded backend in one step (Windows, current user, no admin).

The installer is unsigned, so SmartScreen will warn. Click More info → Run anyway.

All releases, older versions, and the .mcpb bundle: Releases.

You want

Use

Desktop app + backend

opencode-cli-mcp-0.2.11-setup.exe above

MCP server inside Claude Desktop only

opencode-cli-mcp-0.2.11.mcpb from Releases

Manual setup, prerequisites, troubleshooting

INSTALL.md

Development setup and build recipes

docs/DEVELOPMENT.md

Every path needs the opencode CLI installed (npm i -g opencode-ai).

MCP Tools

Primary surface - seven portmanteaus (operation discriminator):

Tool

Purpose

opencode_runs(action=...)

start / status / list / cancel agent runs

opencode_sessions(action=...)

list / get / messages / send / diff / grep / export / rename / delete sessions (live opencode serve API - the opencode UI picks the changes up immediately)

opencode_depot(action=...)

eternal memory - list/archive/unarchive/rename/delete/search/stats over the opencode SQLite DB. Full-text search across EVERY session since install, works offline (no opencode serve needed).

opencode_backups(action=...)

protect the memory - db + config snapshots (consistent online backup API), rotation, disk-space guard, guarded restore (refuses while serve runs unless force=True)

opencode_system(action=...)

status / providers / project / launch_ui / mcp_pulse / config_drift

opencode_mcpb_install(...)

install .mcpb bundles into opencode config

opencode_shutdown(confirm=...)

graceful self-termination

15 legacy atomic tools remain mounted as aliases through 0.2.x (opencode_run_agent, opencode_get_run_status, opencode_list_runs, opencode_cancel_run, opencode_list_sessions, opencode_get_session, opencode_send_message, opencode_get_messages, opencode_session_diff, opencode_server_status, opencode_list_providers, opencode_get_project, opencode_get_config, opencode_get_health, opencode_launch_ui, plus opencode_session_grep / opencode_export_session / opencode_config_drift / opencode_mcp_pulse).

Prefab in-chat cards: show_runs_app, show_sessions_app, show_status_app.

Eternal Session Memory

opencode records every conversation and agent run since install into one searchable SQLite database (~/.local/share/opencode/opencode.db). No other agentic IDE has this — you cannot ask Claude or Cursor "what were we discussing last December about santiclaus-mcp?", but you can ask opencode:

opencode_depot(action="search", query="santiclaus")          # wayback find - full-text across ALL transcripts
opencode_depot(action="rag", query="santiclaus")             # semantic recall - embeddings over indexed transcripts
opencode_depot(action="rag_index")                           # build the RAG index (once)
opencode_sessions(action="get", session_id="ses_...")        # metadata
opencode_sessions(action="messages", session_id="ses_...")   # the transcript
opencode_sessions(action="export", session_id="ses_...")     # markdown/html document
opencode_backups(action="create", kind="all")                # protect it (autobackup 24h)

Full walkthrough: docs/ETERNAL_MEMORY.md (also on the webapp Help page and History page).

Key Workflows

See Usage Guide for full details.

Basic: Launch -> Poll -> Review

opencode_run_agent(prompt="refactor main.py", wait=false)
    -> { job_id: "abc" }
opencode_get_run_status("abc")     -> poll until completed
opencode_session_diff("session-xyz") -> review changes

Multi-Agent Sweep

Launch N agents across N repos in parallel, poll all, review diffs. Designed for fleet-wide operations.

Interactive Supervision

Start an agent, read its messages mid-task, send corrections, review final diff.

OpenCode Custom Tools

Copy .opencode/tools/*.ts into your opencode project to give opencode's LLM direct access to MCP fleet management, session inspection, and system diagnostics. 6 tools covering fleet, sessions, runs, system, providers, and tool discovery. See the OC Tools page in the webapp for full documentation and source.

Documentation

Doc

Description

Onboarding

5-minute first-run guide

Usage Guide

All tools, workflows, async patterns, webapp pages

Integration Guide

MCP client config (Claude Desktop, Cursor, Windsurf)

Advanced Usage

Async patterns, session management, cross-project, custom tools

Improvement Plan

Known issues and roadmap

Changelog

Version history

Stack

  • Backend: Python 3.12+, FastMCP 3.4.4, FastAPI, uvicorn, httpx, pydantic v2, prefab-ui, psutil, SQLite (job store)

  • Frontend: React 18, Vite 5, TypeScript, TailwindCSS 3.4, Zustand, Framer Motion, Lucide, React Router, @tauri-apps/api

  • Native: Tauri 2 (NSIS installer, embedded PyInstaller backend)

  • Quality: ruff, biome, pytest (+coverage), Playwright e2e, pre-commit, just

Ports

Port

Service

10950

Frontend (Vite)

10951

Backend (FastAPI)

4097

opencode serve (dedicated; desktop app owns 4096)

Security

This MCP server runs arbitrary shell commands (opencode run) from LLM prompts. Only install in environments where you trust your MCP client (Claude Desktop, Cursor) and the models it uses.

Fleet

  • Registered in mcp-central-docs: ports 10950/10951

  • fleet-registry.json and glama.json in repo root

  • Webapp dashboard: http://localhost:10950 (run .\start.ps1)

Available Tools

25 tools
opencode_backupsOpenCode BackupsB
Destructive

Backup the opencode database and config with rotation + disk guard; restore when needed.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_backups(action="status") opencode_backups(action="create", kind="all") opencode_backups(action="list", kind="db") opencode_backups(action="restore", name="opencode-db-20260802-120000.sqlite3", confirm=True)

Inputs: action (required), kind, name, force, +1 more. Returns: data, message, success

opencode_cancel_runA
Destructive

Cancel a running or queued agent run.

Return Format

{"success": bool, "message": str, "data": {"job_id": str}}

Examples

opencode_cancel_run(job_id="abc123")

Inputs: job_id (required).

opencode_depotOpenCode Session DepotA
Destructive

Session depot: list, inspect, archive/unarchive, rename, delete, search transcripts, semantic RAG search, code-recall search, or stats.

Reads opencode's SQLite depot directly - works without opencode serve. Archive/unarchive/rename are reversible; delete is permanent (FK cascade). search = exact/full-text wayback find; rag = semantic similarity over indexed transcripts; code = when an agent touched a file (patch paths + edit tool inputs), by path or by content. rag/code need uv sync --extra rag and an index pass (rag_index indexes both).

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_depot(action="list", status="archived", limit=20) opencode_depot(action="unarchive", session_id="sess_01") opencode_depot(action="search", query="power limit") opencode_depot(action="search", query="vienna", project="chitchat", timeframe_days=7) opencode_depot(action="rag", query="what did we decide about the power limit") opencode_depot(action="code", path_filter="auth_utils.py") opencode_depot(action="code", query="extracted the auth module", path_filter="src") opencode_depot(action="rag_index") opencode_depot(action="stats") opencode_depot(action="star", session_id="sess_01") opencode_depot(action="tag_add", session_id="sess_01", tags="neuro, vienna") opencode_depot(action="list", starred=True, sort="starred") opencode_depot(action="export", session_id="sess_01", format="docx") opencode_depot(action="memops", session_id="sess_01", tags="neuro")

Inputs: action (required), tag, sort, tags, +17 more. Returns: data, message, success

opencode_get_configB
Read-onlyIdempotent

Read the full opencode configuration.

Returns model, provider, MCP server settings, and instructions.

Return Format

{"success": bool, "message": str, "data": {"config": dict}}

Examples

opencode_get_config()

Inputs: no named parameters.

opencode_get_healthA
Read-onlyIdempotent

Health check for the opencode server.

Returns basic connectivity status and uptime.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_get_health()

Inputs: no named parameters.

opencode_get_messagesA
Read-onlyIdempotent

Retrieve message history from an opencode session.

Returns the conversation transcript between the user and the agent.

Return Format

{"success": bool, "message": str, "data": {"messages": [{"role": str}]}}

Examples

opencode_get_messages(session_id="sess_01", limit=100)

Inputs: session_id (required), limit.

opencode_get_projectB
Read-onlyIdempotent

Get the current project context from opencode.

Returns the active project path and metadata.

Return Format

{"success": bool, "message": str, "data": {"project": dict}}

Examples

opencode_get_project()

Inputs: no named parameters.

opencode_get_run_statusA
Read-onlyIdempotent

Poll the status of a background agent run.

Returns stdout/stderr accumulated so far, status, and exit code.

Return Format

{"success": bool, "message": str, "data": {"job_id": str, "status": str, "stdout": str, "exit_code": int}}

Examples

opencode_get_run_status(job_id="abc123")

Inputs: job_id (required).

opencode_get_sessionB
Read-onlyIdempotent

Get detailed information about a specific opencode session.

Returns its metadata and state.

Return Format

{"success": bool, "message": str, "data": {"session": dict}}

Examples

opencode_get_session(session_id="sess_01")

Inputs: session_id (required).

opencode_launch_uiA

Launch opencode interactively - TUI, web UI, or background API server.

Use this to open the opencode interface for manual work.

Return Format

{"success": bool, "message": str, "data": {"mode": str, "project": str}}

Examples

opencode_launch_ui(mode="web") opencode_launch_ui(mode="serve")

Inputs: mode, project.

opencode_list_providersA
Read-onlyIdempotent

List configured LLM providers in opencode.

Return Format

{"success": bool, "message": str, "data": {"providers": [{"name": str}]}}

Examples

opencode_list_providers()

Inputs: no named parameters.

opencode_list_runsB
Read-onlyIdempotent

List all recent agent runs with their status and exit codes.

Return Format

{"success": bool, "message": str, "data": {"runs": [{"job_id": str, "status": str, "exit_code": int}]}}

Examples

opencode_list_runs(limit=20)

Inputs: limit.

opencode_list_sessionsB
Read-onlyIdempotent

List all active and recent opencode sessions.

Return Format

{"success": bool, "message": str, "data": {"sessions": [{"id": str}]}}

Examples

opencode_list_sessions()

Inputs: no named parameters.

opencode_mcpb_installA

OPENCODE_MCPB_INSTALL - Install an MCPB bundle into opencode config.

Unpacks the .mcpb (or reads an unpacked directory), extracts the manifest, and merges the server definition into the opencode config file's mcp section.

Return Format

{"success": bool, "server_name": str, "config_path": str, "entry": {...}}

Examples

opencode_mcpb_install(source="./dist/arxiv-mcp-v1.0.0.mcpb") opencode_mcpb_install(source="./dist/arxiv-mcp-v1.0.0.mcpb", name_override="arxiv") opencode_mcpb_install(source="./mcpb/", dry_run=True)

Inputs: source (required), dry_run, name_override. Returns: data, message, success

opencode_run_agentA

Run an opencode agent with a prompt, model, agent, and permission mode.

Launches as background job; returns job_id for polling. Set wait=true to block until done. Unattended runs usually need auto=true - otherwise a permission prompt stalls the run until the timeout.

Return Format

{"success": bool, "message": str, "data": {"job_id": str, "status": str, "options": dict}}

Examples

opencode_run_agent(prompt="Refactor main.py", wait=False) opencode_run_agent(prompt="Summarize README", format="json", wait=True, timeout=120) opencode_run_agent(prompt="Fix tests", model="deepseek/deepseek-flash", agent="build", auto=True) opencode_run_agent(prompt="Continue the migration", session_id="ses_123", fork=True)

Inputs: prompt (required), auto, fork, wait, +10 more.

opencode_runsOpenCode RunsA
Destructive

Manage opencode agent runs: start, poll status, list recent, or cancel.

Return Format

{"success": bool, "message": str, "data": dict} Fire-and-forget starts return a job_id; poll with action="status".

Examples

opencode_runs(action="start", prompt="Refactor main.py", wait=False) opencode_runs(action="start", prompt="Fix tests", model="deepseek/deepseek-flash", agent="build", auto=True) opencode_runs(action="start", prompt="Continue", session_id="ses_123", fork=True) opencode_runs(action="status", job_id="abc123") opencode_runs(action="list", limit=20, offset=0)

Inputs: action (required), auto, fork, wait, +14 more. Returns: data, message, success

opencode_send_messageA

Send a message to an existing opencode session.

Use this to continue a conversation with a running agent.

Return Format

{"success": bool, "message": str, "data": {"result": dict}}

Examples

opencode_send_message(session_id="sess_01", message="continue")

Inputs: message (required), session_id (required).

opencode_server_statusA
Read-onlyIdempotent

Check the status and health of the opencode server.

Returns health info, active session count, and config summary.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_server_status()

Inputs: no named parameters.

opencode_session_diffA
Read-onlyIdempotent

Show files created, modified, and deleted in a session.

Returns a diff summary with file paths and change types.

Return Format

{"success": bool, "message": str, "data": {"diff": dict}}

Examples

opencode_session_diff(session_id="sess_01")

Inputs: session_id (required).

opencode_sessionsOpenCode SessionsA

Inspect and interact with opencode sessions: list, get, transcript, send, diff, grep, export, share, unshare, rename, or delete.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_sessions(action="list", limit=50) opencode_sessions(action="messages", session_id="sess_01", limit=100) opencode_sessions(action="send", session_id="sess_01", message="continue") opencode_sessions(action="share", session_id="sess_01") opencode_sessions(action="unshare", session_id="sess_01") opencode_sessions(action="rename", session_id="sess_01", title="Refactor auth module") opencode_sessions(action="delete", session_id="sess_01", confirm=True)

Inputs: action (required), limit, query, title, +5 more. Returns: data, message, success

opencode_shutdownA
Destructive

Shut down this MCP server process gracefully.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_shutdown(confirm=True, reason="maintenance window") opencode_shutdown(confirm=False)

Inputs: reason, confirm. Returns: data, message, success

opencode_systemOpenCode SystemC

opencode server environment: health/status, providers, project, launch UI, MCP pulse, or config drift.

Return Format

{"success": bool, "message": str, "data": dict}

Examples

opencode_system(action="status") opencode_system(action="providers") opencode_system(action="launch_ui", mode="web")

Inputs: action (required), mode, project. Returns: data, message, success

show_runs_appA

Show recent agent runs as a rich Prefab card.

Lists recent opencode agent runs with status badges. Use the plain opencode_runs(action="list") tool when you need raw data instead.

Return Format

ToolResult with PrefabApp card and plain-text fallback.

Inputs: limit.

show_sessions_appA

Show opencode sessions as a rich Prefab card.

Lists recent opencode sessions. Use opencode_sessions(action="list") for raw data instead.

Return Format

ToolResult with PrefabApp card and plain-text fallback.

Inputs: limit.

show_status_appA

Show opencode server status as a rich Prefab card.

Displays opencode serve reachability, startup probe result, and job counts. Use opencode_system(action="status") for raw data instead.

Return Format

ToolResult with PrefabApp card and plain-text fallback.

Inputs: no named parameters.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.1/5.0

    Scored across 25 tools

    Disambiguation2/5

    Multiple tools appear to do the same thing: opencode_runs, opencode_run_agent, opencode_get_run_status, opencode_list_runs, and opencode_cancel_run overlap heavily with each other and with show_runs_app. Similarly opencode_sessions, opencode_depot, opencode_list_sessions, opencode_get_session, opencode_get_messages, opencode_send_message, and opencode_session_diff all target sessions, while opencode_system, opencode_server_status, opencode_get_health, show_status_app, and opencode_launch_ui overlap on server state/launch. An agent would struggle to pick the right tool without trial and error.

    Naming Consistency3/5

    Most tools use an opencode_ prefix with a verb_noun shape, but the show_*_app tools break the pattern and singular/plural is inconsistent (opencode_run_agent vs opencode_runs, opencode_get_run_status vs opencode_runs status action). The mix of aggregate action-dispatch tools and thin single-purpose wrappers adds further naming drift.

    Tool Count2/5

    25 tools is heavy for this domain, and much of the count comes from redundant legacy wrappers (opencode_list_sessions, opencode_get_session, opencode_get_messages, opencode_send_message, opencode_session_diff) that are already covered by opencode_sessions actions. The redundant Prefab card tools (show_*_app) further inflate the surface without adding capability.

    Completeness4/5

    Coverage of sessions, runs, depot, backups, config, system status, and MCPB install is broad with few obvious lifecycle gaps. The main weakness is that configuration is read-only (opencode_get_config with no set/update) and some operations are duplicated rather than complementary, but core workflows are covered.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Aggregates multiple backend MCP servers into a single unified interface with optional web management UI for tool control and configuration.
      120 npm
      195
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Aggregates multiple MCP servers into a single HTTP endpoint with tool namespacing, dashboard, and REST API for management.
      43 npm
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Connects MCP clients such as Claude, Cursor, and VS Code to OpenCode's headless API so users can delegate coding work — asking questions, implementing features, monitoring background jobs, answering prompts and permission requests, and reviewing changes across multiple projects. Supports synchronous runs, asynchronous jobs with polling and recovery, multi-project directory scoping, and configurable server authentication and tool profiles.
      24,126 npm
      MIT
    • A
      license
      C
      quality
      C
      maintenance
      Enables MCP clients to interact with OpenCode 2.x/3.x servers through direct /api/... HTTP routing and ~85 tools spanning sessions, messages, files, config, providers, projects, input, TUI, and workflows. Runs as a zero-dependency, pure-JavaScript stdio bridge with no SDK or build step.
      85
      MIT