Codex MCP Server
Hands coding tasks, code reviews and web searches from an MCP client to the OpenAI Codex CLI
Hands coding tasks from an MCP client to a running OpenCode server and tracks them to completion
By Alaeddine Messadi (individual) TypeScript Local · stdio Developer toolsAI and ML
68 popularity score ★ 161 ↓ 25k/wk
Opens the app, which asks before it adds the server.
claude mcp add opencode -- npx -y opencode-mcp{
"mcpServers": {
"opencode": {
"command": "npx",
"args": [
"-y",
"opencode-mcp"
]
}
}
}{
"mcpServers": {
"opencode": {
"command": "npx",
"args": [
"-y",
"opencode-mcp"
]
}
}
}{
"servers": {
"opencode": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"opencode-mcp"
]
}
}
}[mcp_servers.opencode]
command = "npx"
args = ["-y", "opencode-mcp"]gemini mcp add --scope user opencode npx -- -y opencode-mcpOPENCODE_BASE_URL |
Optional: OpenCode server address, or an OpenChamber proxy's /api path. |
|---|---|
OPENCODE_SERVER_TOKEN secret |
Optional: Bearer token sent instead of basic auth, such as an OpenChamber client token. It is not renewed. |
OPENCODE_OPENCHAMBER_PASSWORD secret |
Optional: OpenChamber UI password, swapped for a client token on first use. |
OPENCODE_OPENCHAMBER_URL |
Optional: OpenChamber origin that serves /auth/session, when it differs from the base URL's origin. |
OPENCODE_OPENCHAMBER_CLIENT_ID |
Optional: Fixed client ID so restarts reuse one OpenChamber device entry. A random one is made per process. |
OPENCODE_AUTO_SERVE |
Optional: Set exactly to true to let it start a local OpenCode server. |
OPENCODE_TOOL_PROFILE |
Optional: full (87 tools) or essential (25 tools). Other values stop startup. |
OPENCODE_TASK_STORE |
Optional: Folder for job records instead of the default state folder. |
| Set together: basic auth | |
OPENCODE_SERVER_USERNAME |
Optional: Username for OpenCode HTTP basic auth. |
OPENCODE_SERVER_PASSWORD secret |
Optional: Password for OpenCode HTTP basic auth, matching the server's. |
| Set together: default model | |
OPENCODE_DEFAULT_PROVIDER |
Optional: Default provider ID for prompts. Ignored unless the model is set too. |
OPENCODE_DEFAULT_MODEL |
Optional: Default model ID for prompts. |
This is a stdio bridge between an MCP client such as Claude Code or Cursor and the HTTP API of OpenCode, the open-source coding agent. It writes no code of its own. Your assistant sends prompts to OpenCode sessions, and OpenCode works on the project with whatever model provider it is set up with.
The core tools cover quick questions with follow-ups, plus background jobs you start now and check on later. Job records sit on disk, so a job survives a timeout or a client restart. Other tools answer OpenCode's questions and permission prompts, review diffs and session history, read project files, edit OpenCode's config and provider keys, and drive the OpenCode terminal UI.
The npm description still counts 70 tools and 5 prompts. The source registers 87 tools in the default `full` profile and 6 prompts, along with 14 resources where npm says 10. `OPENCODE_TOOL_PROFILE=essential` trims the list to 25 delegation and monitoring tools, and any other value stops the server at startup. `opencode_run` watches a task for 600 seconds unless `maxDurationSeconds` asks for more, up to 3600.
Besides HTTP basic auth it can send a bearer token. It can also sign in to a server behind OpenChamber with the UI password and keep the client token it gets back in memory. Job records live in `$XDG_STATE_HOME/opencode-mcp/tasks` (or `~/.local/state/opencode-mcp/tasks` when that is unset) and expire 24 hours after creation. Expiry does not stop the OpenCode session behind them.
| Runtime | Node.js 22+ |
|---|---|
| Runs on | macOS, Windows, Linux |
| OpenCode model provider | Paid planPrompts need at least one provider set up in OpenCode, often a paid API account |
| Also |
|
Install OpenCode 1.x (the docs name 1.18.31 and 1.19.3 as tested) and start its server with `opencode serve --hostname 127.0.0.1 --port 4096`, or start the TUI with `opencode --port 4096`. Setting `OPENCODE_AUTO_SERVE=true` lets it launch a local server itself. For a server behind OpenChamber, point `OPENCODE_BASE_URL` at its `/api` path and use OpenChamber 1.12 to 1.24 for password sign-in.
Auto-start (`OPENCODE_AUTO_SERVE`) works only for loopback HTTP addresses and takes no custom OpenCode flags. `directory` must be an absolute path on the OpenCode server. `opencode_project_init` can only create folders on the machine running the MCP server, not on a remote OpenCode host. Sessions in the same folder are not isolated from each other, so overlapping parallel tasks need separate folders or git worktrees. Completion is found by polling: idle clients are not notified. An observation timeout means the job is still running, not that it failed. The docs point to an open issue (#18) about hangs when a second OpenCode server shares the same storage.
Suits developers who already use OpenCode and want an MCP client to hand it longer coding jobs, perhaps across several projects, and check on them later. Teams that reach OpenCode through OpenChamber or a token-protected endpoint can now connect too. With 87 tools in the default profile it can crowd a client's tool list, so most people will want the `essential` profile. If you do not run OpenCode, a file-system or git server is a simpler fit. It is a community project, not one from the OpenCode team.
30 only read, 29 change things, 1 can delete or overwrite. A ? marks an optional parameter.
opencode_ask changesprompt: stringtitle?: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringsystem?: stringformat?: objectdirectory?: stringopencode_reply changessessionId: stringprompt: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringformat?: objectdirectory?: stringopencode_run changesprompt: stringsessionId?: stringtitle?: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringdirectory?: stringformat?: objectmaxDurationSeconds?: numberopencode_fire changesprompt: stringsessionId?: stringtitle?: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringdirectory?: stringformat?: objectopencode_checksessionId?: stringjobId?: stringmessageId?: stringdetailed?: booleandirectory?: stringopencode_waitsessionId?: stringjobId?: stringmessageId?: stringtimeoutSeconds?: numberpollIntervalMs?: numberdirectory?: stringopencode_job_getjobId: stringopencode_job_cancel changesjobId: stringopencode_job_listlimit?: numberopencode_job_input changesjobId: stringresponses?: arrayopencode_setupdirectory?: stringopencode_contextdirectory?: stringopencode_statusdirectory?: stringopencode_conversationsessionId: stringlimit?: numberdirectory?: stringopencode_sessions_overviewdirectory?: stringopencode_review_changessessionId: stringmessageID?: stringdirectory?: stringopencode_provider_test changesproviderId: stringmodelID?: stringvariant?: stringformat?: objectdirectory?: stringopencode_question_listsessionId?: stringdirectory?: stringopencode_question_reply changesrequestId: stringanswers: arraydirectory?: stringopencode_question_reject changesrequestId: stringdirectory?: stringopencode_permission_listdirectory?: stringopencode_session_permission changesid: stringpermissionID: stringreply: enumdirectory?: stringopencode_session_listdirectory?: stringopencode_session_create changesparentID?: stringtitle?: stringdirectory?: stringopencode_session_abort changesid: stringdirectory?: stringopencode_session_delete deletesid: stringdirectory?: stringopencode_session_diffid: stringmessageID?: stringdirectory?: stringopencode_session_fork changesid: stringmessageID?: stringdirectory?: stringopencode_session_revert changesid: stringmessageID: stringpartID?: stringdirectory?: stringopencode_session_share changesid: stringdirectory?: stringopencode_session_init changesid: stringmessageID: stringproviderID: stringmodelID: stringvariant?: stringdirectory?: stringopencode_session_summarize changesid: stringproviderID: stringmodelID: stringvariant?: stringdirectory?: stringopencode_message_send changessessionId: stringtext: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringnoReply?: booleansystem?: stringformat?: objectdirectory?: stringopencode_message_send_async changessessionId: stringtext: stringproviderID?: stringmodelID?: stringvariant?: stringagent?: stringformat?: objectdirectory?: stringopencode_command_execute changessessionId: stringcommand: stringarguments?: stringagent?: stringproviderID?: stringmodelID?: stringvariant?: stringdirectory?: stringopencode_shell_execute changessessionId: stringcommand: stringagent: stringproviderID?: stringmodelID?: stringdirectory?: stringopencode_file_listpath?: stringdirectory?: stringopencode_file_readpath: stringdirectory?: stringopencode_file_statusdirectory?: stringopencode_find_filequery: stringtype?: enumsearchDirectory?: stringlimit?: numberdirectory?: stringopencode_find_symbolquery: stringdirectory?: stringopencode_find_textpattern: stringdirectory?: stringopencode_config_getdirectory?: stringopencode_config_update changesconfig: objectdirectory?: stringopencode_auth_set changesproviderId: stringtype: stringkey: stringopencode_provider_listdirectory?: stringopencode_provider_modelsproviderId: stringlimit?: numberdirectory?: stringopencode_provider_oauth_authorize changesproviderId: stringmethod?: numberinputs?: objectopencode_tui_submit_prompt changesdirectory?: stringopencode_tui_append_prompt changestext: stringdirectory?: stringopencode_project_init changespath: stringopencode_project_listdirectory?: stringopencode_events_polldurationMs?: numbermaxEvents?: numberdirectory?: stringscope?: enumopencode_healthdirectory?: stringopencode_agent_listdirectory?: stringopencode_instance_dispose changesdirectory?: stringopencode_mcp_add changesname: stringconfig: objectdirectory?: stringopencode_mcp_statusdirectory?: stringopencode_lsp_statusdirectory?: stringopencode_vcs_infodirectory?: stringopencode://project/currentopencode://configopencode://providersopencode://agentsopencode://commandsopencode://healthopencode://vcsopencode://sessionsopencode://mcp-serversopencode://file-statusopencode://projects/{directory}/currentopencode://projects/{directory}/sessionsopencode://projects/{directory}/sessions/{sessionId}opencode://projects/{directory}/sessions/{sessionId}/messagesopencode-code-reviewopencode-debugopencode-project-setupopencode-implementopencode-best-practicesopencode-session-summary