Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(grok): let a t3-started Grok session run with only the MCP servers t3 declares #12914

Closedkkolodziej7(GitHub profile, opens in a new tab) opened this issue 1 comment

What I'm building

An external orchestrator that starts t3 threads for automated work. Some of those threads must run with a narrow MCP surface: a worker that reaches exactly one server and provably not the operator's others — production database servers among them.

Problem

For Claude Code, t3 passes the server set per process (--mcp-config <inline JSON>), and Claude Code additionally offers --strict-mcp-config to suppress inherited configuration. For Codex, t3 passes -c mcp_servers.<name>..... For Grok there is no equivalent: t3 starts the session over ACP and session/new carries mcpServers, but the Grok CLI (1.0.40) admits that list on top of what it already has (admit_client_mcp_servers) instead of substituting it.

Everything else in the Grok CLI that looks like an answer is not one: a project-level .grok/config.toml replaces entries by name only, disabled_mcp_servers is a user-layer key, and there is no --strict-mcp-config equivalent.

Net effect: a Grok session started by t3 inherits the user's full MCP server set, including servers imported through [compat.claude] / [compat.cursor]. A client can neither scope that session nor verify that it is scoped.

Workaround, and why it is not enough

[compat.claude] mcps = false + [compat.cursor] mcps = false in ~/.grok/config.toml. Verified at both layers: config (every compat-imported server disabled) and live session (connected set becomes t3-code and nothing else). That is acceptable on a machine dedicated to t3, but it is machine-global rather than per session, and it disables the compat import for anyone who also uses Grok interactively.

Ask

Either (a) spawn Grok with an isolated config root — a t3-owned GROK_HOME — so the session sees only what t3 declares, or (b) if the strictness has to come from the Grok CLI itself, document that t3-started Grok sessions inherit user-level MCP servers, so clients that need a scoped session can fail closed instead of assuming.

  1. Thanks for the precise report — this is a real isolation gap, and it is not a duplicate of #7746.

    What t3 does today

    On Grok session start, t3 already injects the thread-scoped t3-code MCP server on ACP session/new (and the load/resume paths):

    • apps/server/src/provider/Layers/GrokAdapter.ts
    • apps/server/src/provider/acp/AcpSessionRuntime.ts

    Spawn (apps/server/src/provider/acp/GrokAcpSupport.ts) forwards the instance environment and does not set a t3-owned GROK_HOME. GrokSettings also has no first-class homePath (unlike Codex CODEX_HOME / Claude CLAUDE_CONFIG_DIR).

    So t3 is doing the ACP-correct thing: declare mcpServers. Merge-vs-replace is Grok CLI behavior (admit_client_mcp_servers on 1.0.40), including [compat.claude] / [compat.cursor]. There is no Grok --strict-mcp-config.

    #7746 / #9154 only stopped the health check from calling session/new. Live threads still inherit user MCP.

    Claude / Codex nuance

    The comparison is directionally right, but t3 is not fully strict there either:

    • Claude sessions pass mcpServers: { t3-code } and still load user/project/local setting sources. --strict-mcp-config is used on the capabilities probe, not every chat session.
    • Codex adds -c mcp_servers.t3-code.*; that is additive unless the instance uses a separate homePath.

    The Grok-specific hole is: no CLI strict flag and no first-class home setting / user doc, so an orchestrator cannot fail closed from public docs.

    Why a default isolated GROK_HOME is the wrong default

    Auth, skills (grok inspect), sessions/plans, and usage all live under ~/.grok (GROK_HOME). Forcing a hidden t3 home on every Grok thread would drop login/skills for interactive use. Codex/Claude isolation is an explicit per-instance home, not a silent override.

    Workarounds

    1. The machine-global [compat.claude] mcps = false + [compat.cursor] mcps = false you verified — fine on a dedicated host, not per-session.
    2. Tighter on t3 today: a second Grok instance with instance env GROK_HOME pointed at a stripped config (Grok already merges instance env in GrokDriver). Auth must be set up in that home, or use XAI_API_KEY. That is undocumented and has no Settings field.

    Next step

    1. Document now so clients that need a scoped Grok session can fail closed: t3-started Grok inherits user/compat MCP; session/new adds t3-code.
    2. Optional later: a Grok homePath (same shape as Claude/Codex) for a dedicated worker instance.
    3. Upstream: Grok CLI replace-not-admit, or a strict-MCP flag t3 can pass.

    Not treating this as a t3 wiring bug. Leaving it open as enhancement + docs + upstream.

  2. juliusmarminge added labelsdocumentation

  3. juliusmarminge added labelsenhancement

  4. juliusmarminge added labelsupstream

  5. juliusmarminge added labelsvia-triage

Sign in to join this conversation.