opencode-samcp
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
opencode-samcp
Sub-Agent MCP — an MCP server that lets an AI agent (Devin, Codex, Claude Code, Cursor, …) spawn opencode sessions as sub-agents and hand them coding work.
The parent agent calls opencode_run with a prompt and a directory; opencode does the work headlessly (opencode run --format json --auto) and the result comes back as structured data: final message, tool-call summary, errors, token usage and cost. Sessions can be continued, forked, run in parallel in the background, inspected and deleted.
Requirements
Related MCP server: claude-codex-mcp
Install / run
The server is Python; every option below needs uv and opencode on the machine.
Method | Command |
npx (no install) |
|
npm (global) |
|
uvx from PyPI |
|
uvx from GitHub |
|
pip |
|
The npm package is a thin launcher: it bundles the Python server and runs it through uvx.
If uv or opencode is missing, it exits with a clear "not installed on machine" error.
Configure your client
Devin
Settings → MCP Marketplace → Add Your Own (STDIO):
Field | Value |
Command |
|
Args |
|
Devin runs in its own VM, so opencode must be installed and logged in there (add it to the machine setup / snapshot).
Codex (~/.codex/config.toml)
[mcp_servers.opencode]
command = "npx"
args = ["-y", "opencode-samcp"]Claude Code
claude mcp add opencode -- npx -y opencode-samcpGeneric JSON
{ "mcpServers": { "opencode": { "command": "npx", "args": ["-y", "opencode-samcp"] } } }HTTP transport
For clients that only speak remote MCP:
opencode-samcp --transport streamable-http --host 127.0.0.1 --port 8765 # endpoint: /mcp
opencode-samcp --transport sse ... # endpoint: /sseThere is no authentication and the sub-agent can edit files and run commands — keep it on localhost or behind an authenticated tunnel/proxy.
Tools
Tool | Purpose |
| Start a session (or continue |
| Poll/wait on a background job by |
| Compact progress snapshot of a job: elapsed time, what's done, what's doing, what's next, stall flag. |
| List jobs started by this server. |
| Stop a running job (session is kept). |
| List opencode sessions for a project directory. |
| Condensed transcript of a session. |
| Delete a session and its children. |
Parallel work: start several jobs with wait_seconds=0, each in its own git worktree so they don't clash, then poll with opencode_job.
Environment variables
Var | Meaning |
| Path to the opencode binary (default |
| Default |
| Seconds without stream events before a running job is reported as |
Security
auto_approve defaults to true (required for headless runs): the sub-agent can modify files and run shell commands in the given directory. Only expose this server to agents you trust, and point it at disposable checkouts/worktrees where possible.
Notes
Job state is in-memory; it is lost when the server process restarts (opencode sessions themselves persist and can be resumed by
session_id).When more than
OPENCODE_MAX_JOBS(default 200) jobs exist, the oldest finished jobs are evicted from the table — and, if there are not enough finished ones, the oldest running. Evicted jobs keep running; they just can no longer be looked up byjob_id(resume bysession_idinstead).
Publishing (maintainers)
Releases are automated: pushing a vX.Y.Z tag runs .github/workflows/publish.yml, which publishes to PyPI and npm (both via trusted publishing, no tokens). Use the helper so versions and tag never drift apart:
scripts/release.sh 0.0.4It bumps pyproject.toml, package.json and uv.lock, runs the tests, commits, pushes main, then tags and pushes v0.0.4.
Development
uv run --group dev pytestMIT licensed.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
Related MCP Connectors
A paid remote MCP for OpenAI Codex agent coordination MCP, built to return verdicts, receipts, usage
Build Apps and run code in 30 languages — sandboxed, with persistent sessions for agent loops.
Multiplayer for the coding agents your team already uses: shared tasks, decisions, skills and tools.
Hosted coding agent: start, follow up on and stop tasks that can open GitHub pull requests.
Related MCP Servers
- FlicenseNot gradedqualityBmaintenanceEnables programs and AI assistants to orchestrate coding-agent sessions such as OpenCode or Claude Code and obtain structured answers backed by verifiable citations, including support for long-running jobs and follow-up questions.1-
- AlicenseAqualityBmaintenanceLets an MCP client hand coding tasks, second-opinion reviews, and image-asset generation to the official OpenAI CLI agent running locally, returning final messages, session IDs, and saved files. Jobs run sandboxed with prompts over stdin, work asynchronously with polling, and expose a live model catalog without needing an API key.52MIT
- AlicenseAqualityBmaintenanceEnables Claude Code to delegate software-engineering tasks to OpenCode agents running in the same workspace/worktree, with the model and provider chosen per agent. Exposes tools for task delegation, persistent sessions, diffs, and agent listing so an orchestrator can research, edit, review, and test code.7159 npmMIT
- AlicenseNot gradedqualityAmaintenanceConnects MCP clients such as Claude, Cursor, and VS Code to an OpenCode server's headless API, enabling users to ask questions, delegate and run coding tasks, monitor background jobs, answer prompts and permission requests, and review resulting changes across multiple projects. Sessions accept absolute server-side project directories, support both blocking and asynchronous workflows, and expose persisted job records for recovering or cancelling work.22,181 npmMIT