Skip to main content
Glama

Muse MCP

Stdio MCP server that lets any MCP client spawn and drive Muse Code agents on this machine. The server speaks MSP (Muse Session Protocol): newline-delimited JSON-RPC 2.0 to a long-lived muse serve host. Sessions outlive turns. Approvals and user-input prompts arrive as server requests while a turn is live, and the client answers them through tools.

Muse Code stays the billing client. This server never reads, stores, prints, or forwards Muse OAuth tokens, API keys, or ~/.config/muse/auth.json.

Default approval mode is yolo

Spawned sessions default to approval_mode = "yolo". On the wire that is permission profile :unrestricted and approvalMode: allowAll. Tool calls are not held for a person. The shipped ~/.muse-mcp/config.toml has an empty auto_approve list, so nothing is auto-approved by policy unless you add a rule. The sandbox stays on: yolo does not pass --disable-sandbox.

This is the standing posture for agents on your own machine. It is the wrong default for a shared or untrusted workspace. Pass approval_mode: "on-request" (:ask-me) or "judge" (:auto-review) on muse_spawn, or set approval_mode in the config file, when you want a gate.

Related MCP server: cursor-agent-bridge

Why TypeScript

Phase 0 matched the installed CLI (Muse Code 1.4.14) to @muse-code/sdk@1.4.14 on schema fingerprint sha256:c94c3d1f2f51e6424074b9ec43eac3eedcf532d3dcd77351ec1383a87d3049c6. The SDK is the official MSP client, has no runtime dependencies, and already implements framing, initialize, session folds, and the approval handshake. Node on this machine is v24, which runs the sources with --experimental-strip-types, so the server is TypeScript with no compile step. MuseClient is not the seam: session/start.worktree is experimental and only the raw Connection can send it.

Run

Requires Node 20+ and muse on PATH (override with MUSE_MCP_BIN).

npm install
./bin/muse-mcp

The process speaks MCP on stdin/stdout and opens no port. State lives in ~/.muse-mcp/ (MUSE_MCP_HOME):

File

Role

config.toml

Written on first start if missing.

state.json

Sessions this server started. After a restart, idle and running rows load as orphaned and resume on next use.

audit.log

Append-only JSONL of requests, decisions, answers, expiries, refusals, and session-message calls. Message bodies are not written.

One muse serve host is kept per workspace + contributor mode + preset + trust. A crashed host restarts on the next call. Its sessions are marked orphaned and resumed with session/resume when the protocol allows. sessionInUse is returned to the caller and not retried: this server does not attach to a session an interactive TUI already owns, and it only drives sessions it started.

Tools

Tool

What it does

muse_spawn

Start a session and optionally its first turn. Returns {session_id, turn_id, status} immediately unless wait is true.

muse_turn

Follow-up turn on a session this server started.

muse_steer

Mid-turn input. Requires the running turn id. Idle sessions error and send no frame.

muse_pending

Pending approvals and questions: request id, session, kind, payload, age.

muse_answer

Answer a pending question (request_id, answer).

muse_decide

approve or deny a pending approval. Deny can include reason.

muse_status

One session or all: state, turn, model, workspace, token usage, latest todo list, latest context usage, pending counts.

muse_models

List the host model catalog. Optional workspace or session_id.

muse_skills

List a session's user-invocable skills: the slash-command catalog.

muse_mcp_servers

List the MCP servers a session can see.

muse_plugins

List a session's installed plugins.

muse_hooks

List a session's installed hooks.

muse_result

Latest completed turn, final answer text, and a short in-memory event tail.

muse_cancel

Cancel the current turn.

muse_close

End a session.

muse_message

List or send muse session-message to a session this server did not start.

muse_raw

Send any MSP method with raw params. Credential methods are refused before a frame is written.

muse_answer and muse_decide take an optional actor of user or orchestrator (default orchestrator). Policy decisions are logged as policy. Unanswered approvals expire to deny and unanswered questions are cancelled after pending_timeout_sec (default 1800). If the MCP client advertises elicitation, pending items are also offered that way. The tools still work when it does not.

muse_models takes optional workspace and session_id. Listing by workspace starts (or reuses) that workspace's host without creating a session. Passing session_id flags that session's model as active, so a picker can list before it has a session and then resolve the active row once it does. The result carries models (each with id, display_label, is_default, is_active, and the catalog's remaining fields) plus top-level provider_id, profile_id, and source. It is a read-only query: no session record, no audit line.

The catalog tools — muse_skills, muse_mcp_servers, muse_plugins, and muse_hooks — each take a session_id and run one per-session MSP list query (skill/list, mcpServer/list, plugin/list, hook/list). Skill scope follows the session's workspace and plugin state, so a client re-lists on the host's skill/changed and plugin/changed notices. muse_skills rows carry selector (the shortcut token, without the slash), display_name, description, source, plugin_id, argument_hint, and title. muse_mcp_servers wraps an experimental method: its result shape is not in the stable SDK types, so each row normalizes name, status, and transport and carries the host row verbatim under raw. All four are read-only queries: no session record, no audit line.

muse_spawn arguments: workspace (required, absolute, must exist), prompt or prompt_file, parts (ordered text/skill objects; non-empty parts wins over prompt and prompt_file), model, reasoning_effort (none|minimal|low|medium|high|xhigh|max|ultra), preset, worktree (off|create|existing) with worktree_base or worktree_path, approval_mode (yolo|on-request|judge), contributor_mode (default false), wait (default false). There is no output_schema argument. MSP has no field for it. muse_turn takes session_id plus the same prompt/prompt_file/parts choice. A skill part names a muse_skills selector with an optional source (bundled|user|project|plugin) and free-text arguments; the host resolves and expands it, and an unknown selector fails the turn with skillNotFound.

muse_message takes action list or send. send requires target (a session uuid or name) and body (written to the CLI's stdin, max 64 KiB). Optional in_reply_to and display_context (a JSON object). Every call passes --json and returns {action, exit_code, result, stderr}. result is the stdout JSON. A non-zero exit whose stdout is JSON is a normal result, including closed ingress:

{"schema_version":1,"status":"unavailable","error_code":"external_agent_ingress_closed"}

That ingress opens only when the target Muse process was started with MUSE_EXPERIMENTAL_EXTERNAL_AGENT_INGRESS or MUSE_EXPERIMENTAL_LOCAL_SESSION_MESSAGING. Setting either variable on this server, or on the session-message command, does not open a TUI that was started without them. A session this server already drives stays on muse_turn. The audit line records the action, target, reply token, body length, exit code, and error_code. It does not record the body.

Tool arguments win over environment variables, which win over config.toml.

Env

Effect

MUSE_MCP_BIN

Muse binary. Default muse.

MUSE_MCP_HOME

State directory. Default ~/.muse-mcp.

MUSE_MCP_MODEL

Model when a spawn omits model.

MUSE_MCP_REASONING_EFFORT

Effort when a spawn omits reasoning_effort.

MUSE_MCP_APPROVAL_MODE

yolo, on-request, or judge.

MUSE_MCP_PENDING_TIMEOUT_SEC

Pending-request timeout.

auto_approve rules are { match = "<regex>", decision = "approve" }. match is tested against one line of tool name, subject kind, command, host, path, and raw args. A hit approves with the once-only choice and is audit-logged as policy.

Streaming

Rich clients can watch turns live instead of polling muse_result. Streaming is opt-in: a client declares the experimental capability muse.stream in its initialize capabilities. A client that does not declare it receives no stream traffic and its tool results are unchanged.

{ "capabilities": { "experimental": { "muse.stream": {} } } }

The server sends one notification method, notifications/muse/event, with a plain JSON event object as params:

Field

Meaning

type

turn-started, item-started, item-delta, item-completed, turn-completed, usage, pending, catalog-changed, goal-changed, todos, subscription-usage, context-usage, or name-changed.

sessionId

The session the event belongs to. Events cover every session on the connection. Absent on subscription-usage, which is account-scoped.

turnId

Present when the host frame carries one.

viewCursor

The host view cursor, verbatim, on item, usage, and turn-completed events (turn-started carries none). Strictly increasing per session; a jump means a gap.

item

The full item object on item-started and item-completed. Passed through uninterpreted.

itemId, field, delta

On item-delta: the item, the dotted field path ("text" when the host omits it), and the appended text.

terminal, answer

On turn-completed: the turn's terminal word and its final answer text.

droppedDeltas

On turn-completed: delta events whose send failed during that turn. muse_status reports the same count cumulatively as stream_dropped_deltas.

usage, usageKind

On usage: the host's raw token-usage params, plus which frame they came from: tokenUsage (a cumulative snapshot) or changed (a change notice).

requestId, kind, phase

On pending: a hint that an approval or user-input request was requested or settled.

catalog

On catalog-changed: which catalog changed, skill (re-issue muse_skills) or plugin (re-issue muse_plugins, plus muse_hooks and muse_skills).

goal

On goal-changed: the host's goal block verbatim (null clears). Percent and status pass through unnormalized.

items, revision, sourceTool

On todos: the session's full todo list, the snapshot revision (diagnostics only; viewCursor orders), and the tool that produced the snapshot.

usage (on subscription-usage)

The host's subscription usage observation verbatim: tier, the current window's and the weekly block's used percents and reset stamps, as of its observedAtMs. Point-in-time, never live data.

usedTokens, windowTokens, pressure

On context-usage: counted-once context tokens in use, the effective window size (absent when the host's basis has no limit), and the host's pressure level, verbatim.

name, origin, generatedName

On name-changed: the session's new canonical name, how it was set (the host's origin vocabulary, verbatim; absent when the host proves none), and the host-published generated short title when the frame publishes one (absent when unpublished).

Client guidance:

  • Text deltas for one item field are coalesced over 30 ms, so a delta event may carry several host deltas merged. Concatenating a field's delta events in order rebuilds the field, with one exception: if the host surface saturated, the concatenation can fall short. item-completed carries the full item and is authoritative. Reconcile from it.

  • A pending event is a signal to call muse_pending, which stays the source of truth for approval and question payloads. Approvals and questions still arrive through elicitation and the broker exactly as before.

  • A todos event replaces the session's whole todo list; an empty items array is a cleared list, not a no-op. Items carry no stable id and no turn id, so attribute a snapshot to a turn by its arrival order within that turn. muse_status reports the same latest list as todo_list (absent when no todo fact has landed), which makes it the reconciler after a reconnect.

  • A subscription-usage event belongs to the account, not to a session, so it carries no sessionId. Hosts are per workspace posture but the account is one: the server dedupes observations by content (tier, both windows' percents and reset stamps), so the same observation arriving from two hosts reaches the client once. The matching fetch is the host's usage/read, available through muse_raw.

  • muse_status reports the session's latest context usage as context_usage (absent when no context fact has landed), the reconciler for context-usage events after a reconnect. A context-usage event without windowTokens means the host's context basis has no limit; render no percent rather than inventing one.

  • muse_status reports the session's name as name with its name_origin, and the host-published generated short title as generated_name (absent when unpublished), the reconciler for name-changed events after a reconnect. The serve host never allocates a name for MSP-started sessions, so the server mints a canonical name at spawn (brook-io style) and settles it with session/rename. A session spawned with a prompt carries a provisional label derived from that prompt until the settled name lands; its origin reads fallback, and a settled name (origin custom, automatic, or a later host value) replaces it. When the rename fails and no prompt label exists, the name fields stay absent.

  • A client that cannot keep up loses delta events, never the turn. Sends never block the host, failures are counted in droppedDeltas, and the first failure per turn is written to the audit log. The turn-completed event waits, up to 250 ms, for the turn's in-flight delta sends to settle before its count is stamped; sends that outlive the wait, and the count on a turn-completed whose own send fails, still land in the cumulative stream_dropped_deltas in muse_status, which persists across restarts.

Register with Grok Build

User scope writes ~/.grok/config.toml:

grok mcp add muse-mcp -- /path/to/muse-code-mcp/bin/muse-mcp

Generic MCP client

{
  "mcpServers": {
    "muse-mcp": {
      "command": "/path/to/muse-code-mcp/bin/muse-mcp",
      "args": []
    }
  }
}

The server makes no Grok-specific calls. The same command works in Cursor or any other stdio MCP client.

Protocol notes

docs/PROTOCOL.md is the source of truth where it disagrees with any summary. Short version:

  • yolo / on-request / judge are public names. The wire values are :unrestricted+allowAll, :ask-me+onRequest, and :auto-review+onRequest. Both the profile and the approval mode are always sent. Omitting the profile on this machine produced no approval prompts.

  • Approve selects the once-only approved choice (allow_once). Deny selects abort on this host and passes reason when that choice accepts feedback.

  • worktree is the experimental session/start.worktree field. off omits it. On this machine, create and attach against a repository Muse has not marked trusted fail with -32029 workspaceNotTrusted. --trust-workspace loads skills and rules and does not grant that trust. The server returns the host error and does not run git worktree.

  • --preset and --contributor-mode are host process flags, not session fields. Contributor mode is sent as off unless the caller sets it.

  • No MSP equivalent, so these muse exec knobs are not exposed: --output-schema, --max-model-steps, --user-input-auto-resolve.

  • muse session-message list --json exits 1. Stdout is the closed-ingress object above, and stderr is external agent ingress is unavailable. muse_message returns that object as a normal result. Neither experimental ingress variable was live-tested as an opener.

muse_raw refuses methods under account/, mcpServer/oauth, and any method whose name contains login or logout, and writes an audit line with the method name only.

Tests

npm test
npm run typecheck

npm test uses a scripted fake muse serve. It does not launch the real CLI.

Live checks against the installed muse are off unless you opt in. They spend model calls:

MUSE_MCP_LIVE=1 node --experimental-strip-types --test --test-timeout=300000 test/live.test.ts

License

Licensed under the 0BSD license (see LICENSE).

This is an independent project. It is not affiliated with or endorsed by Meta. Muse and Muse Code are trademarks of Meta Platforms, Inc.

Available Tools

17 tools
muse_answerC

Answer a pending user-input request.

Inputs: request_id (required), actor, answer.

muse_cancelC

Cancel the current turn.

Inputs: session_id (required), turn_id.

muse_closeC

End a session this server started.

Inputs: session_id (required).

muse_decideB

Approve or deny a pending approval. Approve selects the once-only choice. Deny sends reason when that choice accepts feedback.

Inputs: decision (required), request_id (required), actor, reason.

muse_hooksB

List the session's installed hooks: key, event, handler kind, and enabled per hook.

Inputs: session_id (required).

muse_mcp_serversB

List the MCP servers the session can see (experimental mcpServer/list): name, status, and transport per server, with the host row verbatim under raw.

Inputs: session_id (required).

muse_messageA

List or send muse session-message traffic to a Muse session this server did not start, such as a TUI. send requires target and body. A closed ingress is a normal result with error_code external_agent_ingress_closed, which happens unless that target process was started with MUSE_EXPERIMENTAL_EXTERNAL_AGENT_INGRESS or MUSE_EXPERIMENTAL_LOCAL_SESSION_MESSAGING. Does not replace muse_turn.

Inputs: action (required), body, target, in_reply_to, +1 more.

muse_modelsA

List the host model catalog. Pass workspace or session_id; session_id flags the session's model active.

Inputs: workspace, session_id.

muse_pendingA

List pending approval and user-input requests across sessions.

Inputs: no named parameters.

muse_pluginsB

List the session's installed plugins: id, version, source, and enabled per plugin.

Inputs: session_id (required).

muse_rawA

Send any MSP method to a session's host and return the raw result. Params are forwarded unchanged. Credential methods (account/*, oauth, login, logout) are refused before anything is sent.

Inputs: method (required), session_id (required), params.

muse_resultC

Latest completed turn output, final answer text, and a compact in-memory event tail.

Inputs: session_id (required).

muse_skillsA

List the session's user-invocable skills, the slash-command catalog: selector, display name, description, source, and argument hint per skill. Refresh on the host's skill/changed notice.

Inputs: session_id (required).

muse_spawnB

Start a Muse session on a workspace and optionally send its first turn. Returns immediately unless wait is true. wait is only for short turns; the MCP client's own timeout still bounds the call. parts sends ordered text/skill parts verbatim; when parts is non-empty, prompt and prompt_file are ignored.

Inputs: workspace (required), wait, model, parts, +9 more.

muse_statusC

Session state, model, workspace, token usage, latest todo list, latest context usage, session name and its origin, the host-published generated short title, and pending counts. Omit session_id for every session.

Inputs: session_id.

muse_steerB

Inject text into the running turn. Fails without sending a frame when the session is idle or the turn id is not the running turn.

Inputs: prompt (required), turn_id (required), session_id (required).

muse_turnB

Send a follow-up turn to a session this server started. parts sends ordered text/skill parts verbatim; when parts is non-empty, prompt and prompt_file are ignored.

Inputs: session_id (required), wait, parts, prompt, +2 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 17 tools

    Disambiguation4/5

    Most tools map cleanly to one action: spawn/turn/steer/cancel/close form a clear session lifecycle, and pending/answer/decide form a clear approvals flow. The only soft edges are spawn vs. turn vs. message (all send content) and status vs. result, but the descriptions explicitly disambiguate these (e.g. 'muse_message ... does not replace muse_turn').

    Naming Consistency4/5

    Every tool carries the same muse_ prefix in snake_case, giving a strong family resemblance. The suffix mixes verbs (spawn, turn, steer, answer, cancel) with nouns for read-only operations (status, result, models, skills, plugins, hooks), but that verb/noun split is a common, readable convention rather than inconsistency.

    Tool Count3/5

    17 tools is at the upper end for what is essentially a session-control server, and five of them (models, skills, mcp_servers, plugins, hooks) are single-purpose listing calls that could plausibly collapse into one catalog call. muse_raw is also a universal escape hatch that makes several of the introspection tools redundant conveniences.

    Completeness4/5

    The surface covers the full session lifecycle (spawn, turn, steer, cancel, close), both kinds of human-in-the-loop interaction (answer, decide), observability (status, result), and environment introspection (models, skills, MCP servers, plugins, hooks), plus a raw escape hatch. The main gap is retrieving full past-turn/transcript history beyond the latest result and an in-memory event tail.

    Maintenance

    ActivityNo data
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables MCP clients to spawn and control Codex CLI and Claude Code sessions on the host machine, with session management and filesystem access.
      4
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables launching and supervising local Codex and Claude Code agent sessions and one-shot tasks, exposing run, list, stop, and output operations over MCP with session-scoped permissions and sandbox controls.
      2
      138 npm
      1
      MIT