Description
sbx up writes enabledMcpjsonServers: ["sandbox"] into .claude/settings.json to pre-approve the sandbox MCP server, and sbx doctor checks that same key. On a fresh clone the key does not suppress Claude Code's trust prompt: the user is still asked, the highlighted default declines, and declining leaves the agent with no tools at all.
Observed on a first session, mocactl sbx up run from a clean clone of rossoctl/moca-experiments.
What up wrote (correct, per the user guide)
.mcp.json and .claude/settings.json, both at the git root, timestamped together:
$ ls -la .mcp.json .claude/
-rw-r--r--@ 1 sabath staff 130 Oct 21 20:39 .mcp.json
-rw-r--r--@ 1 sabath staff 429 Oct 21 20:39 .claude/settings.json// .mcp.json
{ "mcpServers": { "sandbox": { "command": "mocactl", "args": ["sbx", "mcp"] } } }// .claude/settings.json (abridged)
{
"permissions": { "allow": ["mcp__sandbox__*"], "deny": ["Bash", "Read", "Edit", "Write", "…"] },
"enabledMcpjsonServers": ["sandbox"]
}This matches agent-config.ts:976 and the up table in docs/sbx/user-guide.md.
What the user still sees
New MCP server found in this project: sandbox
Use this MCP server
Use this and all future MCP servers in this project
❯ Continue without using this MCP server
Claude Code did read the root config — the session was launched from a subdirectory with no .mcp.json or .claude/ of its own, so discovery traversed up to the root and found the file up wrote. The prompt appeared anyway.
Global state was empty, so nothing there caused it:
$ jq '.projects["/Users/sabath/workspace/rossoctl/moca-experiments"]
| {enabledMcpjsonServers, enableAllProjectMcpServers, disabledMcpjsonServers}' ~/.claude.json
{ "enabledMcpjsonServers": [], "enableAllProjectMcpServers": null, "disabledMcpjsonServers": [] }No prior approval, no prior rejection. The only pre-approval in play was up's key in .claude/settings.json, and it did not take effect. There are reports upstream that enabledMcpjsonServers in .claude/settings.json / settings.local.json is not consulted for servers defined in .mcp.json — anthropics/claude-code#24657 and #16402 — which matches this behaviour, though I have not confirmed the upstream mechanism from official docs.
Why this is more than an extra keystroke
The default is the decline. Accepting it writes a persistent rejection:
$ cat .claude/settings.local.json
{ "disabledMcpjsonServers": ["sandbox"] }Combined with the permissions.deny list up writes, that is precisely the state writeAgentConfig refuses to create (agent-config.ts:915-921):
rejects the sandbox MCP server, so Claude Code would have no tools
So a user who presses Enter gets an agent with no sandbox tools and no local tools. settings.local.json is never rewritten by up, and the marker suppresses the prompt on subsequent runs, so the broken state is sticky and self-concealing. The recovery — delete .claude/settings.local.json — is not discoverable from any message the user sees.
This is also the first thing a reader does in the sbx/demo exercise (rossoctl/moca-experiments#16), so it lands on step one of the onboarding path.
doctor reports healthy
checkAgentConfig (agent-config.ts:1226-1234) accepts enabledMcpjsonServers containing sandbox as sufficient:
Claude Code: .claude/settings.json enabledMcpjsonServers does not list sandbox, so Claude Code asks before loading it
The diagnosis is exactly right and the remedy it validates does not work, so doctor passes while the prompt still fires. enableAllProjectMcpServers is read in the same check but never written by up (it appears nowhere else in the package), and up writes neither settings.local.json nor ~/.claude.json.
Suggested direction
Deferring to you on the approach — the options I can see:
- Write the approval where Claude Code reads it. If the project entry in
~/.claude.json(projects[<abs path>].enabledMcpjsonServers) is the effective location,upwould need to write there. That is outside the working tree, so it breaksup's present "ordinary files in your working tree, whichgit statusshows" property and needs a matching entry intakeBackAgentConfig/removeAgentConfig. - Keep the key, fix the expectation. Leave
settings.jsonas is, and haveup's final output tell the user the prompt is coming, that the default declines, and which option to pick. Cheap, no new state, and the guide gains a line. - Detect and repair. Have
doctorflagdisabledMcpjsonServersinsettings.local.jsonas the actionable "delete this file" state. It already inspects that file (lines 1235-1242), so this may be a wording change rather than new logic.
(2) plus (3) looks like the smallest change that stops users landing in the toolless state. Happy to send a PR for whichever you prefer, including the user-guide wording — docs/sbx/user-guide.md documents the key in the up table but never mentions the trust prompt, its default, or the recovery.
Activity
docs(sbx): the first claude asks about the sandbox MCP server
cwiklik commentedon Oct 22, 2026
Picked this up — PR #591 implements your (2) + (3). One correction to the diagnosis first, since
it changes what the fix can say.
enabledMcpjsonServersin.claude/settings.jsonis consulted, and it does work. I probedthis against
claude2.1.263 with a stub stdio MCP server namedsandbox,claude mcp listasthe oracle (
⏸ Pending approvalvs✔ Connected), isolatedHOME, reset between cases. Thereare two independent gates and both must hold:
~/.claude.json→projects[cwd].hasTrustDialogAccepted)settings.jsonenabledMcpjsonServers: [sandbox]settings.local.jsonenabledMcpjsonServerssettings.jsonenableAllProjectMcpServers: trueprojects[cwd].enabledMcpjsonServersSo the key is necessary but not sufficient. The other half is folder trust, and that lives in
~/.claude.jsonwhere only the user's own answer to the trust dialog puts it — no in-tree keygrants it (
hasTrustDialogAccepted,trustedFolder,trustFolder,autoApproveMcpServersinsettings.jsonall still prompt). Also worth noting: the emptyprojects[...].enabledMcpjsonServers: []in yourjqoutput does not override a populatedsettings.json, so global state really was not the cause.The trigger is in your report already: you note the session was launched from a subdirectory.
Both gates are keyed on the directory
claudestarted in, while.mcp.jsonis found bysearching upwards — so a subdirectory session finds the server and has no approval for it:
repo/pkg/deeprepo/pkg/deep.mcp.jsoncopied beside cwdrepo/pkg/deepprojects[<git root>]trust + enablerepo/pkg/deepA nested directory that is its own git root works fine, so the discriminator is "cwd is not the
directory holding the config", not nesting depth.
upwrites at the git root, so whatever itwrites cannot help a session started below it. Incidentally, the upstream issues you cite
(anthropics/claude-code#24657, #16402) are both closed as duplicates of #5037 (completed) and are
about
settings.local.json— they do not describe this.That rules out your option (1): the missing half is folder trust, so "write the approval where
Claude Code reads it" means recording a trust decision on the user's behalf, outside the tree.
That is a security decision rather than a config fix, and I did not want
upmaking it.So #591 is (2) + (3), plus one bug your writeup did not mention.
doctor's fix line wasmocactl sbx up merges it again (anything it names as a conflict is for you to fix by hand)—a dead end for exactly this state, because
upnever writessettings.local.jsonandwriteAgentConfigthrows rather than merge over the rejection.doctordiagnosed the toollessstate and then pointed at a remedy guaranteed to fail. It now carries the recovery itself:
upnow also warns, right after writing the config, that the first session will ask, that thehighlighted default declines, which option to pick, and to start
claudein the root. The userguide's "why" is corrected and the subdirectory case documented — thanks for flagging that the
guide never mentioned the prompt, its default or the recovery.
The prompt still appears once on a first session; it cannot be suppressed from inside the tree.
Accepting the folder trust and the server once ends it.
Merge pull request #591 from rossoctl/fix/577-trust-prompt-expectation
fix(sbx): up warns about Claude Code's MCP prompt; doctor names the r…
feat(sbx): add mocactl sbx claude, a launcher that asks nothing (#577)
feat(sbx): sbx up configures IBM Bob
docs(sbx): name mocactl sbx claude in the agent table