mcode-mcp
Delegate coding tasks to your locally installed MiniMax Code CLI (mcode) and manage the sessions it creates.
Run a task —
mcodestarts a new session (blocks until it settles, returns only the final result + stats, prefixed[session: <id>]). Takesprompt(required) plus optionalcwd,model,permission,mode,transport,thinking_effort,timeout_ms.Resume a session —
mcode_replysends a follow-up turn to a finished, cancelled, or timed-out session (survives server restarts).Control a running turn —
mcode_sendaborts or steers an in-flight ACP run (follow_upis rejected; acp transport only).Discover sessions —
mcode_running(turns executing now) andmcode_sessions(all sessions started via this server, newest first).Pick a model —
mcode_modelslists what the installation reports (optionalsearchfilter); starts no task.Inspect a conversation —
mcode_historyreads the native transcript read-only (no prompting, no lock) withlimit,max_chars,include_tools, and acursorfor paging.Caution —
mcode/mcode_reply/mcode_sendare marked destructive and non-idempotent; with the defaultpermission: full, mcode edits files and runs shell commands as your user insidecwdwithout asking.Gap vs README — the README also advertises
mcode_context,mcode_profiles, and per-profile tool sets (e.g.mcode_work), none of which appear in this schema.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcode-mcp refactor the auth module in /repo to use async/await"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcode-mcp
MCP server that delegates coding tasks to your locally installed
MiniMax Code CLI (mcode,
npm package @minimax-ai/code).
It wraps the real mcode binary instead of bundling its own copy of the agent,
so every call inherits your MiniMax login, models and ~/.minimax config.
This is not the MiniMax M3 API provider in Pi, and not mmx-cli.
Sibling of pi-cli-mcp, qwen-cli-mcp, kimi-cli-mcp and grok-code-mcp — same architecture, same principles, MiniMax Code behind the wheel. Design: SPEC.md. Behaviour: CHANGELOG.md.
Verified against MiniMax Code 0.5.9.
Install
npx -y mcode-mcp # no install
npm install -g mcode-mcp # or globalRequires Node ≥ 22 and MiniMax Code installed with its own installer.
The installer keeps MiniMax Code in ~/.minimax-code (or $MCODE_INSTALL_DIR)
and exposes a launcher, <prefix>/bin/mcode, that follows the current release
and pins a Node matching MiniMax Code's native SQLite ABI. The adapter finds and
spawns that launcher by itself; there is nothing to configure.
Resolution order: MCODE_MCP_BIN → <prefix>/bin/mcode → mcode on PATH.
Set MCODE_MCP_BIN only to use a different mcode. Never point it into
<prefix>/releases/<version>/…: that path changes on every self-update.
Claude Code
claude mcp add-json mcode -s user '{
"type": "stdio",
"command": "npx",
"args": ["-y", "mcode-mcp"],
"timeout": 3600000
}'Any other MCP client
{
"mcpServers": {
"mcode": { "command": "npx", "args": ["-y", "mcode-mcp"] }
}
}Keep the server name short (mcode): it becomes part of the tool names your
model sees.
Related MCP server: Claude Code Bridge
Tools
Tool | Purpose |
| Start a session. Returns |
| The same tools, pinned to a named account. One set per profile, so several accounts are live at once. |
| Continue a finished or interrupted session — including one killed by a timeout. |
| List the models this installation can actually run, from the session catalog. |
| Read a session's context window, budget and per-component breakdown. |
| Deliver into a turn executing right now ( |
| List turns executing right now that |
| List known sessions started through this server, newest first. |
| Read-only native transcript ( |
| List the auth profiles on this machine and which one is the default. |
mcode
Argument | Notes |
| Required. Must be self-contained — mcode cannot see your conversation. |
| Absolute path; defaults to this server's cwd. Passed as |
|
|
|
|
| ACP-only session mode: |
| ACP-only |
| Context window in tokens (M3 / M3.1 advertise |
|
|
| Wall clock for this run. Off unless you set it. Print also forwards |
Profiles
The account is the tool's name, not an argument. There is no profile
parameter. For a profile called work you get mcode_work, mcode_work_reply,
mcode_work_models, mcode_work_context and mcode_work_history; the untargeted
mcode and friends stay on whatever the launch parameter selected.
mcode_work({ prompt: "…" }) // this task runs on the `work` account
mcode_personal({ prompt: "…" }) // and this one on `personal`, at the same timeThat is what lets several accounts be live in one agent at once: they are separate tools, so a model chooses the account by choosing what to call, and the choice survives being retried, forwarded, or read back out of a transcript. An argument cannot do that — one tool is one account per call, and every call site has to carry the choice.
You will not see any of it unless a profile is in play. The per-profile tools
and mcode_profiles appear only when the server has been pointed at a profile
(MCODE_MCP_PROFILE / MINIMAX_PROFILE) or one exists on disk. On a machine with
neither — which includes everyone on a MiniMax Code that has never heard of a
profile — the tool list and every argument schema are exactly what they were in
0.2.0, so there is nothing new to be puzzled by. Signing a profile in makes the
tools appear without restarting the server.
Asking for an account that does not exist is an unknown tool, not a run: a name only resolves to a real profile, so there is no path from a typo to a directory.
A profile is a separate MiniMax account with its own data directory —
~/.minimax for the default one, ~/.minimax-<name> for a named one — holding
its own credentials, sessions and settings. It is mcode's own feature; this
server passes it through with the same --profile <name> flag and resolves its
own paths with the same arithmetic, so a run and the transcript read back
afterwards can never disagree about which account they belong to.
mcode_profiles() // what exists, what is signed in, and the tools that reach each
mcode_work({ prompt: "…" }) // a task on the `work` accountNames must be 1–64 letters, numbers, dots, underscores or hyphens, starting and
ending with a letter or number — a name becomes a directory segment under your
home, so ../../etc is refused rather than sanitised.
A profile only gets tools if its tool names are usable: they must be unique and
made of letters, numbers, _ and - (so no dots, and a name short enough for 64
characters). A profile called reply would collide with mcode_reply, and work_reply
next to work would both claim mcode_work_reply; such a profile gets no tools
rather than a tool that could run on the wrong account. It is still listed by
mcode_profiles and can still be the server's default.
A profile argument is refused (when a profile is in play) rather than ignored:
the account is the tool you called, and a caller that still passes the old argument
would otherwise be billed to the default account without a word.
The default account has a tool when the server default is elsewhere. With
MCODE_MCP_PROFILE=work, plain mcode runs on work, so the implicit account is
reached as mcode_default, mcode_default_reply, and so on.
The server's default is MCODE_MCP_PROFILE, falling back to mcode's own
MINIMAX_PROFILE if that is set and ours is not. A malformed value makes the
server refuse to start instead of quietly falling back to the default account —
running every task on the wrong account is worse than not running. The chosen
profile is pinned into the environment of every mcode this server spawns, so an
inherited MINIMAX_PROFILE can never send a run to an account other than the one
this server reads from.
Two things to know before using one:
A profile must have credentials first. Signing in is interactive and has no headless equivalent, so do it in a terminal with
mcode login --profile <name>(or give it a Token Plan key withmcode provider set-minimax-key --profile <name>). Until thenmcode_profilesreportssigned outornot created, and a run against it cannot authenticate.MINIMAX_DATA_DIR/MAVIS_DATA_DIRoutranks the profile, exactly as it does in mcode: with either set, every profile resolves to that one directory and they stop being separate accounts.mcode_profilessays so when it detects this.MCODE_MCP_MINIMAX_CONFIGis likewise a single path with no profile indirection, and combining it with a named profile is refused: the run would read the profile's ownconfig.yaml, so the edit would succeed and the context window would not move.
An answer from a non-default profile carries [profile: <name>] in its prefix.
A session keeps the profile it started under, and it cannot be changed by a
reply — a session id only names a conversation inside one account, so
mcode_reply refuses a different profile rather than asking another account to
load an id it never issued. mcode_history and mcode_context may read a session
from another account, since those are reads; mcode_history reports the profile
it read, and a cursor issued for one profile is refused in another, because a byte
offset means nothing across accounts. Note that a context_window edit is a real
write to that profile's config.yaml.
A profile name that has no directory is refused before anything starts, rather than letting mcode create an empty account for it.
context_window
mcode exposes no flag and no ACP config option for the context window: the only
way to reach it is the minimaxModelContextLimits entry in your own
~/.minimax/config.yaml.
It works on print and is refused on acp. On print this server writes a
private copy of the config and passes --config, and the window verifiably
takes effect. On acp it does not: MiniMax Code builds a session selection from
the advertised model value, and that selection carries a provider, model and
variant but no context limit, so the turn falls back to the window in your
config however this server writes that file. Measured on 0.5.8 — asking for
512000 with an explicit model, the session still reported 1,000,000. Since
mcode acp has no --config, and the config path cannot be redirected without
also moving the data directory, there is no way to make it work on that
transport. Asking for it there is an error that says so, and nothing is written.
Set MCODE_MCP_ALLOW_ACP_CONTEXT_WINDOW=1 to edit the shared entry anyway: the
server holds it for the whole run under a cross-process lock — which is judged
stale by whether its owner process is alive, never by age — and rolls it back
compare-and-swap, so a change by the TUI or by you wins, another instance's start
will not disturb a run in flight, and a crash is repaired on the next start.
Until minimax-code#384
lands it will have no effect.
mcode silently ignores a window the model does not advertise, so confirm the
result with mcode_context. Only processes this call starts are affected, and a
session that already exists keeps the window it was created with.
Not supported (honest error, not a fake flag): follow_up on mcode_send,
effort, allowed_tools, system_prompt_append, permission=ask.
mcode({
prompt: "Read and execute the prompt: /abs/path/prompt.md",
cwd: "/abs/path/to/repo",
model: "minimax/MiniMax-M3.1-Flash-Preview"
})
// later:
mcode_reply({
session: "<id from the prefix>",
prompt: "Now check the error paths of those call sites."
})Default permission is
full. Delegation is only useful when the delegate can act. Headlesssmartcan stop withINTERACTION_NOT_AVAILABLEif Runtime asks a question. ACPsession/cancelis how a running turn is aborted; there is no documented mid-turn follow-up queue, somcode_sendfollow_uperrors instead of pretending to queue.
What comes back
Only mcode's final result plus aggregate stats — never the transcript, thinking, tool arguments or raw stdout.
A timed-out or cancelled run still returns [session: <id>] and
[session-key: mcode:<id>] when mcode named the session. Resume it with
mcode_reply; do not treat the deadline as a lost session.
mcode_history
Read-only snapshot of the native transcript. Does not prompt mcode.
mcode_history({ session: "<id from the prefix>" })Source: <dataDir>/v2/sessions/YYYY/MM/DD/<time>-session_<base64(id)>/messages.jsonl, where
<dataDir> is MINIMAX_DATA_DIR, then MAVIS_DATA_DIR, then ~/.minimax[-<profile>]
for the session's own profile. The page reports the profile it read.
Items are user / assistant / tool / gap. Thinking and image binaries are
omitted. Pass cursor from the previous page to continue; include_tools: false
hides tool calls/results but still advances the cursor.
Source
git clone https://github.com/minmax/mcode-mcp.git
cd mcode-mcp
npm ci
npm testReleasing
Releases are published by the Publish npm package workflow when a v* tag is
pushed. It authenticates through npm trusted publishing (GitHub OIDC), so there
is no NPM_TOKEN secret. The tag must equal v<version> from package.json.
npm version patch # bumps package.json and creates the vX.Y.Z tag
git push --follow-tagsAvailable Tools
7 toolsmcodeADestructive
Start a NEW task in the local MiniMax Code agent (mcode) — a separate CLI coding agent with its own file/shell tools and its own context window. Blocks until mcode settles, then returns only its final result plus stats, prefixed [session: ] and [session-key: mcode:]; continue that session later with mcode_reply.
Caution: with permission 'full' (the server default) mcode edits files and runs shell commands as your user inside cwd without asking.
Inputs: prompt (required), cwd, mode, model, +4 more.
mcode_historyARead-onlyIdempotent
Read a bounded snapshot of a MiniMax Code session's visible conversation from the native messages.jsonl under ~/.minimax/v2/sessions. Does not send anything into the run, does not take the session lock, and does not wait for mcode to finish. Returns JSON: session, state (active if this process is running it, otherwise unknown), items (user / assistant / tool / gap), an opaque cursor to resume even at the current EOF, has_more, truncated_tail. Thinking and image binaries are omitted. Caps: limit (default 50, max 200), max_chars per item (default 4000, max 16000), and 100000 chars on the whole JSON page.
Inputs: session (required), limit, cursor, max_chars, +1 more.
mcode_modelsARead-onlyIdempotent
List what this MiniMax Code installation reports via mcode provider list --json. Use it to pick a model value for mcode / mcode_reply. Starts no task. Official OAuth providers may list zero models even when a default model is configured.
Inputs: search.
mcode_replyADestructive
Send a new turn to an existing mcode session that is not executing right now — including one that timed out or was cancelled: the session survives in MiniMax Code's own store, so resume it here instead of restarting with mcode. Survives restarts of this server. For a turn still running under 'acp', use mcode_send instead.
Inputs: prompt (required), session (required), cwd, mode, +5 more.
mcode_runningARead-onlyIdempotent
List mcode turns executing at this moment — the ones mcode_send can reach — with session id, working directory, elapsed time, and messages already sent in. Only acp-transport runs appear. For past sessions use mcode_sessions.
Inputs: no named parameters.
mcode_sendADestructive
Deliver a message into an mcode turn that is executing right now. Works only on runs started with transport 'acp' — a session that already finished takes mcode_reply, not mcode_send. follow_up is unsupported: MiniMax Code ACP does not document a mid-turn queue. steer cancels the current turn and submits the message as a new prompt. mcode_running lists reachable sessions.
Inputs: session (required), command, message.
mcode_sessionsARead-onlyIdempotent
List all mcode sessions started through this server, newest first — running or finished, including runs that timed out. Each row gives the session id, when it last ran, cwd, remembered transport, and model. Use it to recover an id for mcode_reply. For turns still executing (mcode_send targets), use mcode_running.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 7 tools
Each tool targets a distinct action—start, reply, send, list running, list all, list models, read history—and the descriptions explicitly cross-reference each other to clarify boundaries. However, mcode_reply vs mcode_send and mcode_running vs mcode_sessions still require careful reading to distinguish.
All tools share the mcode_ prefix, but the suffixes are inconsistent: verbs (reply, send), gerunds (running), and nouns (models, sessions, history), plus the bare mcode for the primary action. There is no uniform verb_noun pattern.
Seven tools cover the full lifecycle of interacting with a local coding agent without redundancy. The count feels well-scoped for the stated purpose.
The toolset covers starting, resuming, interrupting, listing, and inspecting mcode sessions, including model discovery. A few optional operations like an explicit stop/terminate endpoint are absent, but core workflows are complete.
Maintenance
Related MCP Connectors
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Use your Mac, Windows or Linux computer from ChatGPT, Claude or Codex: files, commands, documents.
Work on your own computers from Claude or ChatGPT: run commands, edit and search files.
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables Codex to delegate coding tasks to an OpenCode CLI locally, returning structured results such as exit codes, session summaries, tool calls, and git diffs.2MIT
- AlicenseNot gradedqualityBmaintenanceLets Codex delegate coding and repository work to an installed Claude Code CLI with permission-aware inspect/write access, model and effort selection, resumable and cloud-attached sessions, and durable synchronous or asynchronous jobs.MIT
- AlicenseAqualityCmaintenanceDelegates coding tasks to the locally installed Kimi Code CLI, reusing its auth, models, and configuration while adding tools for sessions, replies, model discovery, live turn steering, and history access.731 npmMIT
- AlicenseAqualityCmaintenanceEnables MCP-compatible coding agents to execute the local Codex CLI as a coding agent, including code reviews, session resume/fork, and CLI diagnostics.911 npmMIT