Skip to content

Grok MCP registration is fire-and-forget and user-global: boot race, no project binding, log-only failures #706

Closed

Description

@currentbits

Found in a full provider-feature audit. Grok gets MCP servers via ensureGrokMcpConfig → grok mcp add … --scope user into the user-global ~/.grok/config.toml (electron/memory-sup.js:1078-1156). Three weaknesses vs the claude per-launch --mcp-config and kimi's per-run overlay:

  1. Boot race: registration is an async fire-and-forget batch (memory-sup.js:1063-1067); a grok run started before it completes has no memory/orchestrator/preview tools, with no UI signal.
  2. Log-only failure: any stall/error in grok mcp add (10s per-CLI timeout, :750, :1138-1154) is log-only; every grok run then silently lacks memory tools.
  3. No per-project binding: servers are registered with the plain URL (:1117-1118), no ?project=/?projectId= scoping like kimi got in Isolate Kimi runs: no cross-project threads, memory, or workspaces #671 — project scoping for memory rests entirely on the model following the handshake instruction, so cross-project leakage is possible.

Related: plugin activation execs bare grok from PATH instead of the resolved provider bin, so installs that only work via CODER_GROK_BIN fail plugin activation (electron/skillPluginAdapters.js:307-340).

Activity

  1. added
    bug
    plan:todo
    plan:doing
    and removed
    plan:todo
    on Aug 25, 2026
  2. currentbits commented on Aug 27, 2026

    @currentbits
    OwnerAuthor

    Implemented on coder/fork-grok-mcp-registration-is-fire-and-f-9f06ce.

    Local Solenta grok runs now use a per-thread GROK_HOME overlay (electron/grok.js), same class as Kimi’s KIMI_CODE_HOME (#671):

    • Sync write before spawn (no boot race). Overlay write failure fails the run in-thread, not log-only.
    • coder-memory?project= and coder-threads?projectId= so the server owns scope.
    • Foreign [mcp_servers.*] dropped; GROK_CLAUDE_MCPS_ENABLED=false / GROK_CURSOR_MCPS_ENABLED=false so Claude/Cursor MCP compat is off for that child.
    • User ~/.grok/config.toml is not rewritten on the local run path (Concurrent 'grok mcp add' writes corrupt ~/.grok/config.toml and kill every grok run #626 tear avoided).

    ssh/WSL (overlay is local-host) still uses grok mcp add --scope user, but now with bound URLs and await whenGrokMcpIdle() so the spawn cannot beat the add.

    Plugin activation resolves grok/codex through CODER_GROK_BIN / CODER_CODEX_BIN after the allowlist check.

    Out of scope here: workflow grok agents still inherit user-global MCP.

  3. added
    plan:done
    and removed
    plan:doing
    on Aug 27, 2026
  4. added
    plan:doing
    plan:done
    and removed
    plan:done
    plan:doing
    on Oct 3, 2026
  5. currentbits commented on Oct 3, 2026

    @currentbits
    OwnerAuthor

    Landed on main via 734b0cb "Merge worktree coder/fork-grok-mcp-registration-is-fire-and-f-9f06ce", the branch named in the implementation comment above. The issue was left open with plan:done; closing during the 2026-10-03 board cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugplan:done

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions