Skip to content

fix(acp): keep a repo's unapproved .mcp.json servers off in claude chats - #30765

Open
shubhamkurkure wants to merge 1 commit into
kirodotdev:mainfrom
shubhamkurkure:fix/claude-disable-unapproved-project-mcp
Open

shubhamkurkure wants to merge 1 commit into
kirodotdev:mainfrom
shubhamkurkure:fix/claude-disable-unapproved-project-mcp

Conversation

@shubhamkurkure

@shubhamkurkure shubhamkurkure commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: Opening a Claude Code chat in a cloned repository no longer starts the MCP servers that repository's .mcp.json files declare, unless the user approved them.

With agent.acp_backend = claude, an ordinary chat starts every server in every .mcp.json from the work dir up toward the filesystem root at session/new, before the first prompt, with no approval step. Claude Code's interactive CLI asks before it starts such a server. The SDK session the adapter runs is non-interactive, and Claude Code then approves each pending project server by itself (by: "non_interactive") while the project setting source is on. So a repository's own server commands run as the user the moment a Crew chat opens in it.

Why it matters

Anyone who opens a Crew chat on the claude backend in a repository they did not write runs the server commands of that repository's .mcp.json files without being asked. Crew does not send these servers, the dashboard does not show them, and no Crew gate sees them start. A session that leaves the project tier out (a project that owns its settings.local.json) already keeps them off; every other chat does not.

Not a goal

  • Turning off the user's own user-scope or local-scope servers, plugin servers or claude.ai connectors. The issue also reports those; the spec documents that the harness mounts them, and making a Crew chat run only Crew's servers (strictMcpConfig for every session) is a separate design decision. This PR keeps them on, except in a session where Crew cannot name every project server or the adapter is too old to carry the list (see Backwards compatibility).
  • Servers from plugins a repository enables through its own settings.
  • Honouring project-server approvals from anywhere but the user settings.json of the child's config directory (see Backwards compatibility).
  • Project .claude/settings.json hooks. A committed SessionStart command hook still runs at session/new on this branch (verified live, below); it needs its own issue.
  • The shared claude runtime from feat(acp): let claude dashboard chats share one ACP process, switch off by default #37540 (the chat-sharing preview, off by default). There ClaudeSharedSession is built without the chat's extra_env, so its gate reads approvals from the gateway's config dir while the shared process runs with the chat's extra_env. The gate still applies there, which main does not do at all, but approvals set only through extra_env are not followed on that path. Passing extra_env to the shared session's state is a change to harness/claude.py and belongs in its own PR.
  • A writer that changes .mcp.json during one launch, between Crew's read and Claude Code's own read at session/new. The list is built from Crew's read, so a name added in that gap is not on it. Closing the gap needs Claude Code to start only servers Crew mounts (strictMcpConfig for every session, the design decision in the first bullet), not a second read.

What changed (motivation → approach → change)

Symptom: a repository's .mcp.json servers start with no approval. Root cause: in a non-interactive session Claude Code approves every project server that no setting decides. The one key it checks before any approval is disabledMcpjsonServers, which rejects by name.

Case Before After
a server in the work dir's or a parent's .mcp.json starts listed in disabledMcpjsonServers in the session's inline settings (not in the seed file); does not start
that server named exactly in enabledMcpjsonServers, or any server under enableAllProjectMcpServers: true, in the user settings.json of the claude child's config dir starts starts
a session no seed reaches: .claude or .claude/settings.local.json is a link, .claude is a regular file, the exclusion is refused, or the write fails starts the inline list keeps it off; the user's own, plugin and approved servers still start
names Crew cannot learn (a link through /proc/self/cwd or any hop under /proc/ or /dev/fd/, a missing or sensitive target, an unreadable, oversized or non-regular file, JSON Python refuses but Claude Code reads), a list over 16 KiB, no finished read, or a listed server on an adapter below 0.84.0 or reporting no version starts strictMcpConfig, so nothing but Crew's own servers can mount
a rewind's native fork (session/fork) starts the servers, because the fork sent no claudeCode.options the fork sends the same options as the session/load after it
a session that leaves the project tier out (a project-owned settings.local.json) project servers stay pending the same; no list and no strictMcpConfig, so its inline settings (the project's own file) do not grow
the child home's own ~/.mcp.json, where Crew writes its discovered servers starts skipped by resolved path, so it starts as before, unless the work dir is the home dir; an empty or relative HOME names no home, so nothing is skipped
user-scope, local-scope and plugin servers, and Crew's own array start start, except in a strictMcpConfig session
  • New acp/claude_project_mcp.py (project_mcp_gate) lists the servers of every .mcp.json from the work dir to the root, along the given and the resolved path. Approvals match the exact name, which fails closed; a name the user also disabled stays listed.
  • Approvals come from the config dir the child uses: the gateway's environment, then agent.env, then extra_env, as the per-chat launch builds it. On Windows, CLAUDE_CONFIG_DIR, HOME and USERPROFILE match in any case; one of them spelled two ways with different values approves nothing.
  • claude_settings_sources.claude_config_dir(environ) and claude_home(environ) serve the gate and the four older callers. An empty or relative CLAUDE_CONFIG_DIR or home resolves to none: Claude Code resolves it against its own cwd, the repository (claude mcp list in w read w/rel/settings.json for CLAUDE_CONFIG_DIR=rel, and w/settings.json for an empty one). Only an absent variable falls back to the account's home.
  • Files are read bounded through read_claude_settings_bytes and parsed with loads_user_json; only the keys of a top-level mcpServers count. Only json.JSONDecodeError means Claude Code starts nothing; any other ValueError or RecursionError means unknown. A link is resolved one hop at a time, refusing a hop under /proc/ or /dev/fd/ after collapsing leading slashes. Contents are never logged.
  • The writer reads the files once (_claude_project_mcp_gate, a ClaudeAcpClient field, None until a read finishes). _claude_session_meta puts the list into _meta.claudeCode.options.settings on all four requests that start a Claude Code process, on every session that keeps the project setting source. The seed file does not carry it, so the user's own claude in that work dir still asks.
  • strictMcpConfig is sent only when the list cannot keep the servers off: no gate, an unknown name, or the adapter below CLAUDE_ACP_SETTING_SOURCES_MIN_VERSION (0.84.0) while a server is listed. The SDK passes options.settings as one --settings argument (Linux refuses one over 128 KiB, Windows a command line over 32,767 characters), so a list is strict instead when its escaped JSON, encoded as a JSON string once more, is over 16 KiB. That second encoding is never shorter than Windows' quoting of the argument. The walk keeps only names it would list and goes strict as soon as they pass 16 KiB, before reading another file.
  • One warning per session names the .mcp.json paths (never server names) and the remedies, which apply in every repository. A rewind's fork and load, or a re-seed of the same files, does not log it again.
  • _fork_session (client_claude_session.py) sends {**self._claude_session_meta(), "jetbrains": ...}, because adapter 0.100.0's unstable_forkSession starts the fork's process before Crew's session/load.
  • On the wire encode_frame turns a lone surrogate in a name into U+FFFD; Claude Code compares names after mapping every character outside [A-Za-z0-9_-] to _, so both match. Spec: claude-code-provider.md gains a "Project .mcp.json servers" section; session.md notes the fork's options.

Backwards compatibility

Breaking: a server from a .mcp.json that the user has not approved in the user settings.json of the claude child's config directory no longer starts in a Crew chat on the claude backend. This is fail-closed on purpose and has these visible sides.

  • An approval clicked in Claude Code's own CLI dialog is not honoured. The dialog stores it in the repository's .claude/settings.local.json or in the workspace entry of ~/.claude.json. An untracked settings.local.json is the user's own choice: this PR turns its approvals off on the branch where the exclusion is refused, and elsewhere main already leaves a project-owned settings.local.json out. Such a server stays off until the user adds its name to enabledMcpjsonServers in ~/.claude/settings.json (or $CLAUDE_CONFIG_DIR/settings.json), the place Claude Code's own hint names for a lasting approval. Approvals in the managed and project tiers are not honoured either, and an approval spelled differently from the .mcp.json key keeps the server off. The gateway log names the files and both remedies.
  • A session where Crew cannot name every project server (a .mcp.json it cannot read, such as a crafted link or a padded file, or a list too long for one command-line argument), or whose adapter is older than 0.84.0 while a server is listed, also loses the user's own user-scope and plugin servers for that session, because strictMcpConfig is all-or-nothing. The gateway log names the files and the remedy.
  • The config directory and the home are the operator's choice: CLAUDE_CONFIG_DIR and HOME (USERPROFILE on Windows) come from the gateway's environment, agent.env in Crew's config, or the session's extra_env, which Crew sets. No repository file sets them. If an absolute one points inside a repository, Claude Code itself reads that repository's file as the user tier (settings.json there, or .claude/settings.json under the home), so the gate's approvals follow what Claude Code reads, and the gate skips the .mcp.json in that home as the home's own file. Crew does not second-guess that choice: treating such a root as untrusted would turn off approvals that work today.
  • An empty or relative CLAUDE_CONFIG_DIR, or an empty or relative HOME (USERPROFILE on Windows) with no CLAUDE_CONFIG_DIR, now resolves to no config directory in all five callers: the gate approves nothing and skips no home file, other_sources_define_available_models does not read a user file, nor does a_source_decides_thinking (from feat: show the claude-agent-acp surfaces the dashboard drops #37512) when the spawn environment names no config dir, so the claude launch's thinking display is withheld only by the project and managed files there, the transcript cleanup answers not done and deletes nothing, as it already did when no home resolves, and the background-call reader (claude_session_dir, from fix(acp): three handshake, provider and model registry fixes #33279) reads no subagent transcript, so the turn keeps the adapter's incomplete_tool_call error. Before, the older callers used a relative path against the gateway's cwd, and an empty value fell back to the gateway's own home; neither is where the claude child reads it. test/test_claude_settings_sources.py::test_empty_claude_config_dir_env_falls_back_to_home pinned that fallback; it is now test_empty_claude_config_dir_env_reads_no_home_file.

This is on by default, with no Crew setting. On #30308 a maintainer asked that added strictness nobody asked for not be the default; there the strictness overrode a mode the user had chosen. Here the command comes from a file in a cloned repository, not from the user's choice. Claude Code's own CLI asks before it starts such a server; only the non-interactive path the adapter runs skips that question. Main already refuses a tree holding that file for Copilot: src/kiro_crew/acp/harness/copilot.py lists .mcp.json in _PROJECT_CONFIG_FILES (line 294) and refuses the session because those servers "would bypass Kiro Crew's tool approval" (line 441). The user keeps their own user-scope and plugin servers, and approvals in their own settings.json are honoured; approvals stored elsewhere are not (first bullet). One line in their own <config dir>/settings.json brings main's behaviour back: enableAllProjectMcpServers: true (every project server starts, as on main) or the server's name in enabledMcpjsonServers. Both apply in every repository.

Writer sweep on origin/main @ c970398: git grep -n "disabledMcpjsonServers\|enabledMcpjsonServers\|enableAllProjectMcpServers" origin/main -- src test docs finds one other writer, test/real_adapters/harness_probe/drive.py (#30640). It writes enableAllProjectMcpServers: true into the probe's own throwaway home, which is the claude child's config dir there, so the gate approves every name and lists nothing, and the probe's claude-project decoy still starts as its expectations.json says. The gate run on that layout listed nothing, and listed the decoy once that file was removed; the real-adapter lane itself did not run here. No other writer or reader; disabledMcpjsonServers is new in Crew's payload.

Reader: src/kiro_crew/mcp_discovery.py:register_servers_for_cc -- chat -- writes Crew's discovered servers into ~/.mcp.json, which the gate skips by resolved path unless the work dir is the home dir, so those servers start as before (test_the_homes_own_mcp_json_is_skipped, test_the_homes_own_mcp_json_is_skipped_under_a_third_spelling)
Reader: src/kiro_crew/acp/client_claude_seed.py:_share_sibling_settings_seed -- chat -- the seed carries no disabledMcpjsonServers, so the bytes siblings compare are main's (test_a_sharing_sibling_is_strict_exactly_when_a_name_is_unknown, test/test_acp_seed_provenance_sibling_sharing.py passes)
Reader: src/kiro_crew/acp/client_claude_session.py:_exclude_foreign_local_settings -- chat|cron|subagent -- carries the payload inline as on main; the envelope adds no list there, and a list the project's own file holds passes through unchanged (test_the_exclusion_path_adds_no_list, test_an_excluded_sessions_own_list_passes_through)
Reader: src/kiro_crew/acp/claude_settings_sources.py:other_sources_define_available_models -- chat -- passes os.environ to the shared resolver; an absolute or unset CLAUDE_CONFIG_DIR and an absolute home resolve as before (test/test_claude_settings_sources.py passes)
Reader: src/kiro_crew/acp/claude_settings_sources.py:a_source_decides_thinking -- chat|cron|subagent -- passes os.environ to the shared resolver when the claude launch names no config dir; an absolute or unset CLAUDE_CONFIG_DIR and an absolute home resolve as before (test_the_thinking_check_falls_back_to_the_same_config_dir, test/test_claude_thinking_display.py passes)
Reader: src/kiro_crew/agent_sdk/claude_transcripts.py:delete_claude_session_files -- chat|subagent -- passes os.environ to the shared resolver; an absolute or unset CLAUDE_CONFIG_DIR and an absolute home resolve as before (test/test_claude_transcripts.py passes)
Reader: src/kiro_crew/agent_sdk/claude_transcripts.py:claude_session_dir -- chat|subagent -- passes os.environ to the shared resolver; an absolute or unset CLAUDE_CONFIG_DIR and an absolute home resolve as before (test/test_claude_background_incomplete_tool_calls.py passes)

Tests

  • test/test_claude_project_mcp_gate.py (new, 132 tests):

    • names from the work dir's and a parent's .mcp.json, including a parent seen only through a symlinked work dir, and a walk that reaches the root; a file reached two ways is one source, and a file whose names are all approved is none;
    • approvals: an exact-name approval, a one-name string, a string that is not one whole name, enableAllProjectMcpServers only when it is true, non-string entries, a normalised spelling that does not approve, a project name the user also disabled, a symlinked user settings.json, and no config dir;
    • the config dir: CLAUDE_CONFIG_DIR, the child's home, a relative value, and a relative home, which names neither and skips no .mcp.json beside it; an empty CLAUDE_CONFIG_DIR beside an absolute home, an empty home, and an empty USERPROFILE on the Windows branch, which name no config dir, approve nothing from extra_env and skip no .mcp.json in the gateway's home, while absent keys fall back to the account's home; the gateway's own config dir when the session names none; the session's extra_env over an ambient approval; agent.env under extra_env; on Windows a name spelled two ways approves nothing and skips no home file, and one spelling names the dir; any-case matching is on only on Windows by default;
    • parsing: invalid JSON, a non-object document, a nested mcpServers, nesting too deep for the parser, a 5,000-digit integer after, before and inside a list beside mcpServers, a BOM, an escaped duplicate key (the last wins), invalid UTF-8 bytes, and a lone surrogate, which reaches the wire frame as U+FFFD; under enableAllProjectMcpServers a name Crew cannot learn is approved;
    • files: a relative link and a chain of two links followed, a sensitive link, a loop, a dangling link, a link through /proc/self/cwd (directly, through a linked directory, through a relative ../ chain to the root, and spelled //proc, with a decoy file in the test's cwd), //proc, ///proc and //dev/fd read as process-relative, a link to /dev/stdin, a link to an existing sysfs file read as Claude Code reads it, an oversized file, a directory and too many names; a list over the 16 KiB cap but under 64K characters (45,000 three-byte characters, or 35,000 ASCII ones) is strict and sends no inline list, so are 10 names of 500 quotes, about 10,000 bytes of JSON that Windows quotes to about 20,000 characters, and one under the cap rides inline;
    • bound: a work dir 30 levels deep whose every directory names 200 distinct servers goes strict after the second file and reads no third, and the warning names those two files; a list exactly at the cap, split over two files, is sent and one byte more is not; a name in all 30 files counts once; 6,000 approved names do not count unless the user also disabled them; under enableAllProjectMcpServers only the user-disabled names are kept, and over 40 files of 2,000 names each the gate's traced peak is about 10 times one file (119 times on 57505e402, which held every file's names);
    • sessions: the inline settings carry the list, the seed does not, and no strict flag is sent; a client whose files were never read is strict; one seed write reads the files once; an empty list sends no key; the exclusion adds no list, no strict flag and no notice, also when a name is unknown, and a list in its own inline settings passes through unchanged; an unlistable name gives strictMcpConfig; each no-seed branch (linked or dangling settings.local.json, linked .claude, a regular file .claude, refused exclusion, failed write) carries the inline list and no strict flag, is strict with only unknown names, and carries nothing without a project server; below the 0.84.0 floor a listed session is strict and one with no project server is not; the child home's own .mcp.json is skipped with the home spelled directly, through a link, with the work dir through that link, and with the work dir through a link the home does not use, and counts in the home dir itself; the strict and the listing notices name the files and the remedies but no server name, the read itself logs nothing, each is logged once across a fork, a load and a re-seed and again after a read that differs, a zero-tool or Side Chat session logs neither, and below the floor an unreadable file is named as the cause; a sharing sibling and a create-race loser that shares are strict exactly when a name is unknown; a raise in the read leaves the session strict and keeps nothing of the earlier read;
    • fork: a fork from an excluded session, a session carrying the inline list and a strict session carries the same claudeCode.options as session/load.
  • test/test_rewind_native_fork.py::test_a_claude_fork_request_forks_then_loads_the_fork pinned the fork's _meta as the fork point alone. It now pins the fork point beside the same claudeCode block the load sends, which is this fix.

  • test/test_claude_auto_memory_envelope.py (its _client helper, and test_a_memory_withholding_subagent_turns_auto_memory_off from fix: keep withheld memory out of claude sub-agents #32293, whose client comes from the provider factory) and test/test_acp_session_mcp_client_seam.py::TestClientSeam::test_a_side_session_without_its_deny_rules_never_starts built a client that never read the project files and pinned its empty envelope. Such a client is now strict, which is this fix, so each sets the gate a launch's read of a tree without a .mcp.json sets (ProjectMcpGate([], False)); what they check is unchanged.

  • The autouse fixtures patch through _floor_monkeypatch.

  • Round 5: the new quoted_on_windows case fails with the round-4 measure, and test_the_exclusion_path_adds_no_list and test_an_excluded_sessions_own_list_passes_through fail with the list added on the exclusion.

  • A mutation sweep of round 4's 24 mutants is killed by named tests in this file: a relative home kept, the cap counted in characters, in raw UTF-8 bytes or not at all, the list back in the seed, no gate not strict, the gate not reset before a read, the home skip by spelling, never or with no work-dir check, the Side Chat or zero-tool quiet dropped, either notice dedupe key without the gate, the old-adapter wording despite an unreadable file, the ambiguous Windows environment keeping the home, and earlier rounds' strict, inline, exclusion, //proc and enableAllProjectMcpServers mutants.

  • Determinism after the last change: 10 of 10 runs at -n0 of the same three files (164 tests), and 3 of 3 at -n 4 --dist loadgroup with the four co-tenants (275 tests). Before it: 20 of 20 runs at -n0 of this file, test/test_rewind_native_fork.py and test/test_claude_auto_memory_envelope.py (163 tests); 10 of 10 runs at -n 4 --dist loadgroup --max-worker-restart=2 with test/test_claude_settings_sources.py, test/test_cc_permission_mode_seed.py, test/test_acp_seed_provenance_sibling_sharing.py and test/test_acp_client_settings_restore.py as co-tenants (274 tests); four shuffled orders of the 163 ids (seeds 7, 1234, 99991, 20261105) all passed.

  • test/test_flake_pattern_ratchet.py passed. After the rebase onto fix(acp): keep Crew's tools when a claude session asks for default mode #30670, 38 test files that reference the functions this PR or fix(acp): keep Crew's tools when a claude session asks for default mode #30670 changed passed together (2,442 tests). After the rebase onto fix(acp): add an opt-in to move unrequested claude sessions out of auto #30308, the 30 test files that reference the functions this PR or fix(acp): add an opt-in to move unrequested claude sessions out of auto #30308 changed passed together (1,772 tests), once with KIROCREW_CC_PIN_INHERITED_MODE unset and once set to 1.

  • After the rebase onto ad553518b: 30 test files passed together on the final head (2,521 passed, 1 skipped): this PR's 5, the 22 others that fix(acp): keep Crew's tools for a claude session that asks for auto beside a foreign settings file #33847, feat(connections): bridge Crew-owned OAuth per session for claude #33597, fix(session-background): kill oversized and long-parked _bg runtimes #32376, fix(pi): carry the agent spec's own MCP servers into a pi session #30188, fix: keep withheld memory out of claude sub-agents #32293 and fix(acp): exclude a foreign settings file that wins the create race #32471 added or changed beside their edits to the files this PR changes, and the 3 that reference claude_transcripts or claude_background_calls (fix(acp): three handshake, provider and model registry fixes #33279). On db5f8e48a the related-test runner's backend set ran 10,781 tests: 10,764 passed, 13 skipped, and 4 failed, all in test/test_codex_inner_sandbox_approval.py (test_real_codex_acp_*, which drive a real codex binary). The same 4 fail on a clean ad553518b checkout on this host. test/test_flake_pattern_ratchet.py passed.

  • After the review of db5f8e48a: test_nesting_the_parser_refuses_is_unlisted collects at depth zero and holds the cyclic collector off for the deep parse (no_cyclic_gc_at_the_recursion_limit, as in test/test_acp_client_more_coverage_encode_refusal.py). It passed 20 of 20 runs alone at -n0, and 10 of 10 runs at -n 4 --dist loadgroup beside test/test_claude_settings_sources.py, test/test_cc_permission_mode_seed.py, test/test_acp_seed_provenance_sibling_sharing.py and test/test_acp_client_settings_restore.py (236 tests). A scratch run planted cyclic garbage whose finalizer recurses 80 frames, under gc.set_threshold(1, 1, 1). With the pure-Python JSON scanner the test without the fixture raised an unraisable RecursionError 3 of 3 times, and with it passed 3 of 3. With CPython's C scanner both passed: since 3.12 the collector runs only at bytecode eval-breaker points, and the C parse runs no bytecode at depth.

  • With the absent-or-set check reverted to a truthy one in claude_home, test_an_empty_home_names_no_home_and_no_config_dir, test_an_empty_value_in_extra_env_approves_nothing[HOME], test_an_empty_home_skips_no_mcp_json and test_on_windows_an_empty_userprofile_names_no_home fail. With it reverted in claude_config_dir, test_an_empty_config_dir_names_none_beside_an_absolute_home, test_an_empty_value_in_extra_env_approves_nothing[CLAUDE_CONFIG_DIR] and test_empty_claude_config_dir_env_reads_no_home_file fail.

  • After the rebase onto 06d61fe53 and the review of 57505e402: 33 test files passed together on the final head (2,769 passed, 1 skipped): this PR's 5, the 25 that fix(acp): keep Crew's tools for a claude session that asks for auto beside a foreign settings file #33847, feat(connections): bridge Crew-owned OAuth per session for claude #33597, fix(session-background): kill oversized and long-parked _bg runtimes #32376, fix(pi): carry the agent spec's own MCP servers into a pi session #30188, fix: keep withheld memory out of claude sub-agents #32293, fix(acp): exclude a foreign settings file that wins the create race #32471 and feat: carry a claude crewmate worker's native-tool excludes #34475 added or changed, and the 3 that reference claude_transcripts or claude_background_calls. Every test/test_acp_*.py and test/test_claude_*.py file passed together (8,704 passed, 16 skipped), and test/test_flake_pattern_ratchet.py passed. The two truthy-check reverts above fail the same 4 and 3 tests, and with the list line removed from _claude_session_meta, 21 tests in test/test_claude_project_mcp_gate.py fail.

  • The walk's bound: on 57505e402 test_the_walk_stops_and_goes_strict_once_the_names_pass_the_cap failed (the gate read all 30 files and named them all) and test_under_enable_all_only_user_disabled_names_are_kept failed (a traced peak of 15.5 MB, 119 times one file). Both pass now. With the cap checked only after the walk, the first fails. With approved names counted toward the cap, test_approved_names_do_not_count_toward_the_cap and the enable-all test fail. With a repeated name counted again, test_a_name_repeated_across_files_counts_once fails. With the user's disabled names no longer overriding an approval, 3 tests fail. With every file's names held, the enable-all test fails. The six new tests passed 10 of 10 runs alone at -n0, and the file passed 5 of 5 runs at -n 4 --dist loadgroup beside test/test_claude_settings_sources.py, test/test_cc_permission_mode_seed.py, test/test_acp_seed_provenance_sibling_sharing.py and test/test_acp_client_settings_restore.py.

  • After the rebase onto 4c530d0bd (refactor(acp): move the claude-agent-acp session code off AcpClient into ClaudeAcpClient #37484 moved the claude session code into ClaudeAcpClient), no test changed and test/test_client_bindings.py needed no new digest: this PR adds no member and changes no signature. The 54 test files that reference the functions this PR changed, or that refactor(acp): move the claude-agent-acp session code off AcpClient into ClaudeAcpClient #37484, fix(acp): refuse an option-bound claude session before it spawns #37163, perf(acp): end the post-start drain at once on the claude harness #37154 or fix(acp): read a wrapped claude-agent-acp's version from its handshake #26459 added or changed (among them test/test_client_bindings.py, test/test_claude_prepare_session.py, test/test_acp_claude_mode_pin_seam.py, test/test_acp_seed_provenance*.py, test/test_acp_session_mcp_client_seam.py, test/test_claude_below_floor_before_spawn.py, test/test_acp_post_session_new_drain.py and test/test_acp_refactor_facade.py), passed together (3,375 passed). Every test/test_acp_*.py and test/test_claude_*.py file passed together (9,649 passed, 19 skipped), and test/test_flake_pattern_ratchet.py passed. The reverts above fail the same tests: 4 and 3 for the two truthy checks, 21 for the list line, 2 for the list on the exclusion, 1 for the cap checked after the walk, 2 for approved names counted, 1 for a repeated name counted, 3 for user-disabled names not overriding an approval, 1 for every file's names held, 2 for the round-4 measure (quoted_on_windows among them) and 1 for the plugin: rule. In the new homes, the fork sent without the options fails 4 tests (TestFork and test_rewind_native_fork.py), the gate not set in ClaudeAcpClient.__init__ fails test_a_client_whose_files_were_never_read_is_strict, the gate not cleared before the read fails test_a_raise_before_the_gate_answers_leaves_the_session_strict, and no read in the writer fails 58.

  • After the rebase onto c97039886 (feat: show the claude-agent-acp surfaces the dashboard drops #37512 added a_source_decides_thinking, a fourth older caller of claude_config_dir, which now passes os.environ like the others), test/test_claude_settings_sources.py::test_the_thinking_check_falls_back_to_the_same_config_dir is new: with CLAUDE_CONFIG_DIR absent the home's .claude/settings.json decides thinking, and with it empty nothing does. It fails with a TypeError with the call left as claude_config_dir(), and its empty case fails with main's resolution there. It passed 10 of 10 runs alone at -n0, and the file's 48 tests passed in four shuffled orders (seeds 7, 1234, 99991, 20261115). The 79 test files that reference the functions this PR changed, or that refactor(acp): move the claude-agent-acp session code off AcpClient into ClaudeAcpClient #37484, fix(acp): refuse an option-bound claude session before it spawns #37163, perf(acp): end the post-start drain at once on the claude harness #37154, fix(acp): read a wrapped claude-agent-acp's version from its handshake #26459, feat: show the claude-agent-acp surfaces the dashboard drops #37512 or refactor(acp): move the goose session code off AcpClient into GooseAcpClient #37535 added or changed (among them test/test_claude_thinking_display.py, test/test_claude_harness_notices.py, test/test_claude_raw_sdk_tasks.py, test/test_claude_zero_tools.py and test/test_client_bindings.py), passed together (5,048 passed). Every test/test_acp_*.py and test/test_claude_*.py file passed together (10,095 passed, 19 skipped), and test/test_flake_pattern_ratchet.py passed. The revert set fails the same tests as on 93f12a826; the claude_config_dir truthy check now fails 4, the new test among them.

  • After the rebase onto d5fbf0b3e (fix(crew): keep a bot's deny rules when the upgrade moves it #35011 carries a Bot's held limits as permissions.ask rules, and as strictMcpConfig when they cover MCP, in the same _claude_session_meta), only the module docstring's list of fields written conflicted. The held asks and this PR's disabledMcpjsonServers ride the same options.settings on a seeded session and on a rewind's fork, and an excluded session keeps its inline settings and the asks with no list; a session whose held limits cover MCP is strict already and logs no project-server notice. test/test_mate_held_rules.py::test_a_claude_worker_asks_for_the_built_ins_a_held_limit_covers (fix(crew): keep a bot's deny rules when the upgrade moves it #35011) builds its client with no launch, so this PR's rule for files never read made it strict and it failed. Its client now carries a finished read that found no .mcp.json, as the clients in test/test_claude_auto_memory_envelope.py do; it passed 10 of 10 runs alone at -n0, and it still fails with fix(crew): keep a bot's deny rules when the upgrade moves it #35011's held-MCP strictMcpConfig line removed. The 113 test files that reference the functions this PR changed, or that fix(crew): keep a bot's deny rules when the upgrade moves it #35011, feat(acp): ClaudeHarness, claude-agent-acp on the shared runtime with per-session setup (not routed) #37521, feat(acp): route claude Agent-tool children per session on the shared runtime #37601, feat(acp): let claude dashboard chats share one ACP process, switch off by default #37540 or the earlier rounds' main commits added or changed (among them test/test_mate_held_rules.py, test/test_claude_prepare_session.py, test/test_client_bindings.py, test/test_claude_shared_runtime.py and test/test_claude_shared_children.py), passed together (7,934 passed). Every test/test_acp_*.py and test/test_claude_*.py file passed together (10,235 passed, 16 skipped), and test/test_flake_pattern_ratchet.py passed. Each revert above fails the number of tests named; no read in the writer fails 57, the same 57 as on d32fc9c83.

Proof: PROVEN test/test_claude_project_mcp_gate.py::TestSession::test_names_it_cannot_list_mount_only_crews_servers, test/test_claude_project_mcp_gate.py::TestSession::test_unknown_names_on_a_branch_no_seed_reaches_are_strict[symlinked_local_settings], test/test_claude_project_mcp_gate.py::TestSession::test_unknown_names_on_a_branch_no_seed_reaches_are_strict[dangling_local_settings], test/test_claude_project_mcp_gate.py::TestSession::test_unknown_names_on_a_branch_no_seed_reaches_are_strict[symlinked_claude_dir], test/test_claude_project_mcp_gate.py::TestSession::test_unknown_names_on_a_branch_no_seed_reaches_are_strict[regular_file_claude] (head 704ad89)

Gate proof: tree b396b645d4ad; ran 24; skipped none

Manual verification

Kiro Crew's real AcpClient drove claude-agent-acp 0.100.0 (Node 24.20.0, Claude Code 2.1.318) to session/new, with no prompt, on this branch's final tree. It used a scratch CLAUDE_CONFIG_DIR, KIROCREW_HOME and KIRO_HOME, and a gateway cwd holding a decoy servers.json with no servers. Each canary is a stdio server that writes a marker file when it starts: a user server in .claude.json, canary_proj and canary_approved in the work dir's .mcp.json, canary_parent in the parent's, canary_approved named in the user's enabledMcpjsonServers, and canary_wire in Crew's array.

Run user proj parent approved wire _meta.claudeCode.options
plain repository started off off started started settings.disabledMcpjsonServers; the seed file holds no list
main (e33330f8f, run in the first round), plain repository started started started started started {}
.claude committed as a link started off off started off (withheld on that path, as on main) the inline list, no strictMcpConfig
a project-owned settings.local.json and a session that requests acceptEdits, a mode other than default (the exclusion is refused; run after the rebase onto #30670) started off off started off (withheld, as on main) the inline list, no strictMcpConfig
a project-owned settings.local.json and a session that requests default (since #30670 the exclusion is taken; run after the rebase) started off off off started settingSources: ["user"], no list, no strictMcpConfig
.claude a link, plus a server whose name holds a lone surrogate started off off started off (withheld) the inline list; the lone-surrogate server stays off too
plain repository with a committed SessionStart command hook started off off started started the inline list; the hook ran
a directory named .mcp.json two levels higher off off off off started strictMcpConfig
.mcp.json -> /proc/self/cwd/servers.json off off off off started strictMcpConfig
.mcp.json -> //proc/self/cwd/servers.json off off off off started strictMcpConfig
the work dir's .mcp.json padded with a 5,000-digit integer off off off off started strictMcpConfig
a project-owned settings.local.json and the /proc/self/cwd link started off off off started settingSources: ["user"], no list, no strictMcpConfig (re-run after the last change)
the /proc/self/cwd link with enableAllProjectMcpServers: true in the user's settings.json started started started started started {}
plus 90 server names of 500 three-byte characters (45,026 characters) off off off off started strictMcpConfig, no inline list; on the previous head (a 64K-character cap) session/new failed with spawn E2BIG and no server started
plus 40 such names (20,026 characters) off off off off started strictMcpConfig, no inline list
session HOME=h, work dir <gateway cwd>/h/repo, canary_home in <gateway cwd>/h/.mcp.json started off (none) started started the inline list names canary_home too, which stays off; on the previous head it was skipped as the home's own file and started

On this branch every session that lists servers logged one warning naming the .mcp.json paths and the config dir's settings.json; the excluded session and the enableAllProjectMcpServers session logged none. The two long-name runs also logged the gate's "more MCP servers than Crew writes" line once per read (the seed and the re-seed after model capture). The hook run shows the residual named under Not a goal: a committed SessionStart hook ran at session/new while the .mcp.json servers stayed off. Claude Code's own claude mcp list was used to check how it reads a .mcp.json. A comment or a trailing comma makes it read the file as invalid and start nothing from it. It accepts a UTF-8 BOM, keeps the last of duplicate keys, accepts integers of any length, and accepts names with spaces, plugin: prefixes, lone surrogates and invalid bytes. Python's errors="replace" decode produced the same names as Claude Code on 11 invalid UTF-8 sequences.

After the last change, the plain-repository and excluded runs were repeated on the final tree. The excluded session sent no list and canary_parent stayed off; the plain one sent [canary_parent, canary_proj] and both stayed off. After the rebase onto #30670, the two requested-mode runs were repeated on the rebased tree. With default the session took the exclusion, sent no list and no strictMcpConfig, mounted Crew's array, and no project server started. With acceptEdits it sent [canary_parent, canary_proj] and both stayed off.

After the review of db5f8e48a, Claude Code 2.1.310's claude mcp list ran in a scratch w whose .mcp.json holds a server canary, with HOME at a scratch home. With the approval only in w/settings.json, canary was pending with CLAUDE_CONFIG_DIR absent and started with it set to "". With the approval only in the home's .claude/settings.json, it started with the variable absent and stayed pending with it set to "" or " ". Its config root is CLAUDE_CONFIG_DIR ?? join(homedir(), ".claude"). An empty HOME was not run, because homedir() might then fall back to the account's real home and its ~/.claude.json; Node's os.homedir() returns "" for it, which would make the user tier the work dir's own .claude. Crew names no home there either way.

The native fork was not run live, because a fork needs a prompted source session. The unit tests pin what it sends, and the adapter source (unstable_forkSession → getOrCreateSession → createSession reading _meta.claudeCode.options) is quoted above.

Open questions for a maintainer:

  • On by default or opt-in? On fix(acp): add an opt-in to move unrequested claude sessions out of auto #30308 you asked for added strictness to be opt-in. This PR keeps it on because the command comes from a cloned repository's file rather than the user's choice, and main already refuses the same file for Copilot. With opt-in, every user who has not found the setting keeps running repository commands when a chat opens.
  • Should the notices reach the chat? Today only the gateway log says that a user's own repository server went off (the common loss) or that a strict session has none of the user's servers.
  • Should Crew later honour a per-repository approval (Claude Code's untracked settings.local.json, with the same git-tracked check Claude Code uses), so that users are not pushed to approvals that apply by name in every repository? That would be a follow-up, not this PR.
  • A committed .claude/settings.json hook still runs a repository's command at session/new (the hook run). Should that be its own issue, and does it change whether this .mcp.json-only fix ships on by default?
  • Is Claude Code's own enableAllProjectMcpServers: true in the user's settings.json an acceptable off switch, or do you want a Crew setting too?
  • Below adapter 0.84.0 a session that lists a server is sent strictMcpConfig. Should such a session be stopped instead, as a zero-tool session is below that floor, or does strictMcpConfig need its own floor?

Related Issues

Part of #30171

Still out of scope from that issue: the user's own user-scope servers and plugin servers, which the harness still mounts beside Crew's array.

#30241 (claude Bot workers, by another contributor) has landed and edits the same block in _claude_session_meta; this branch is rebased on it. Its worker rule runs first, so a worker session is already strict and logs no project-server notice. It is not a duplicate: it changes Bot workers only and leaves #30171 to this PR.

#30308 (the KIROCREW_CC_PIN_INHERITED_MODE opt-in) has merged, and this branch is rebased on it. Only the module docstring's list of fields read conflicted; it now names both _claude_project_mcp_gate and _mcp_mount_servers. The pin runs after session/new or session/load has sent its _meta, so it does not change which sessions get disabledMcpjsonServers or strictMcpConfig: a scratch run of 128 start layouts sent the same claudeCode.options with the setting off and on.

This branch is rebased on ad553518b. Only the module docstrings' field lists conflicted, in client_class.py, client_claude_seed.py and client_claude_session.py; each now names this PR's fields beside #33847's claude_mode_pinned_notice and #32293's _include_memory. #33279 added claude_session_dir, a fourth caller of claude_config_dir, which now passes os.environ like the other callers; without it, 8 tests in test/test_claude_background_incomplete_tool_calls.py fail with a TypeError. #32293's new envelope test sets the gate as the _client helper there does (Tests). A scratch run on the rebased tree checked main's new settings paths. A session that asks for auto or bypassPermissions beside a project-owned settings.local.json now takes the exclusion (#33847), so it sends settingSources: ["user"] and no list. A create-race loser that takes the exclusion (#32471) does the same; one whose exclusion is refused sends the list, or strictMcpConfig when a name is unknown. With a bridged Connection (#33597) and with a sub-agent's memory off (#32293), the session still sends the list beside their permissions.ask rule and env switch. With the list line removed, the 5 cases that expect the list failed.

This branch is now rebased on 06d61fe53. Only client_claude_session.py conflicted, with #34475 (a claude Bot worker whose crewmate file excludes a native tool gets a narrowed tools option): the module docstring's list of fields read, and the worker block of _claude_session_meta. Both sides are kept. #34475's tools line runs right after the worker rule and before this PR's list, and the field list names _claude_project_mcp_gate beside _claude_worker_builtin_tools. #34475 does not change which sessions are workers or strict, and it adds no settings key, since tools is its own option. So a worker is still strict and logs no project-server notice, and its seed carries the same deny rules and no list. A scratch run on the rebased tree built a narrowed worker and an ordinary chat with an ask rule, each over a .mcp.json with two unapproved servers. Each sent the same options twice. The chat sent permissions then disabledMcpjsonServers in settings and no strictMcpConfig; the worker sent its tools, strictMcpConfig and the list.

This branch is now rebased on 4c530d0bd. #37484 moved the claude-only members off AcpClient into ClaudeAcpClient, so client_class.py, client_start.py, client_claude_seed.py and client_claude_session.py conflicted. client_class.py and client_start.py are now main's. The two fields are set in ClaudeAcpClient.__init__ (client_claude.py); the fork's options moved with _fork_session to client_claude_session.py and need no backend check there, since only claude forks (ACP_BACKENDS_FORK_AT_MESSAGE); the other two files conflicted only in their field lists. No hook was added, and the kiro path is main's. #37163 refuses an option-bound session below the floor before it spawns, after the writer's read but before any _meta is built, so that session sends no list and logs no notice. One refused at the handshake instead (a wrapper whose version cannot be read) logs none either, because a Side Chat, zero-tool or worker session is already strict and an excluded one gets no list. #37154 shortens the drain after session/new, which this PR reads nothing from. #26459 changes only the pre-handshake version that the exclusion and #37163 read; the list's old-adapter rule reads the session's own handshake version on all four requests. #30062 can keep a resumed session's cwd inside its rejoined scratch tree; the walk starts from whatever work dir the session gets, as before. A scratch run on the rebased tree checked the #37163 and #26459 cases, and that a kiro client carries none of these fields and forks nothing.

This branch is now rebased on c97039886. Only claude_settings_sources.py conflicted, in its module docstring, with #37512, which added a_source_decides_thinking: both texts are kept, and its fallback passes os.environ (Tests). Its user tier is the spawn environment's CLAUDE_CONFIG_DIR when that is set and not empty, else the gateway's config dir; the gate still reads only the child config dir's settings.json and the .mcp.json files, through the same _settings_object and read_claude_settings_bytes. #37512 also adds emitRawSDKMessages beside options in _claude_session_meta; the list, strict and notice block and its dedupe are unchanged, and the native fork, which sends the whole claudeCode block, carries it too, as the session/load after it does (claude-agent-acp 0.97.0 counts it in the session fingerprint). Its harness notices are the adapter's own notice and mode updates, read inside a turn; this PR's project-server notice stays a gateway log line, so the open question on reaching the chat stands. #37535 (goose) touches none of this PR's code.

Sibling sweep

Swept: git grep -n "strictMcpConfig\|\.mcp\.json\|CLAUDE_CONFIG_DIR\|def claude_config_dir" -- src/kiro_crew/acp src/kiro_crew/agent_sdk
Sibling: src/kiro_crew/acp/claude_project_mcp.py -- changed here
Sibling: src/kiro_crew/acp/claude_settings_sources.py -- changed here
Sibling: src/kiro_crew/acp/client_claude.py -- changed here
Sibling: src/kiro_crew/acp/client_claude_seed.py -- changed here
Sibling: src/kiro_crew/acp/client_claude_session.py -- changed here
Sibling: src/kiro_crew/acp/harness/copilot.py -- not affected -- the Copilot harness refuses a session whose tree carries a .mcp.json
Sibling: src/kiro_crew/agent_sdk/backends_mcp.py -- not affected -- a comment on the zero-tool strictMcpConfig contract
Sibling: src/kiro_crew/agent_sdk/host_auth.py -- not affected -- names CLAUDE_CONFIG_DIR as a credential home override, not the approvals file
Sibling: src/kiro_crew/agent_sdk/native_allow_stores.py -- not affected -- locates Claude Code's native allow stores, not the approvals file
Sibling: src/kiro_crew/agent_sdk/provider_identity.py -- not affected -- a docstring naming the config dir
Sibling: src/kiro_crew/agent_sdk/tool_gate.py -- not affected -- a comment on relocated credential homes

Pattern harvest

Not generalizable: the hole is one Claude Code rule (non-interactive sessions approve pending project servers), closed at the one place Crew builds Claude's settings and on each request that creates a Claude Code process.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

Contribution License Agreement

This contribution is offered under the project's Apache-2.0 license. It adds or updates no third-party dependency.

@github-actions github-actions Bot added fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 5, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from 44e3140 to c520480 Compare November 5, 2026 23:27
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 5, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from c520480 to e574f35 Compare November 6, 2026 07:07
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 6, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from e574f35 to 8ecec16 Compare November 9, 2026 20:03
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 9, 2026
@shubhamkurkure

Copy link
Copy Markdown
Contributor Author

Hi @bolichen97 and @buluoray, when you have a moment, would you mind reviewing this PR? It covers part of #30171: opening a Claude Code chat in a cloned repository no longer starts the MCP servers that repository's .mcp.json files declare, unless the user approved them. It merges cleanly with current main.

Please let me know if you would like anything changed. Thank you for your time!

@github-actions github-actions Bot added the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 11, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 25% chance that this change introduces a defect, above the 12% limit for approving on its own.

The PR closes a real hole: on main, a claude-backend chat opened in a cloned repository starts that repository's .mcp.json server commands without asking. The writer now reads the .mcp.json files once (in _write_claude_local_settings) and lists unapproved names in disabledMcpjsonServers in the inline session settings. It falls back to strictMcpConfig when there is no gate, a name Crew cannot learn, a list over the cap, or an adapter below the floor. Verified in the code: every launch, reset and re-seed path runs the writer first; a missing or raised read leaves no gate, so the session is strict (fails closed); the child environment is merged in the launch's order (gateway env, then agent.env, then extra_env); read errors come back as None, so an unreadable file never breaks the seed; the exclusion and Side Chat sessions and the worker settings are unaffected; the rewind fork now sends the same options as the load after it; every claude_config_dir caller was updated. The spec is updated in the same change and the tests are extensive. Remaining concerns are judgement calls or unconfirmed edge cases, listed as non-blocking notes.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit d32fc9c83f · 1877 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from 8ecec16 to f50c5a5 Compare November 11, 2026 12:05
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 11, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from f50c5a5 to 8e5ebd3 Compare November 12, 2026 09:04
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 12, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from 8e5ebd3 to c1ce290 Compare November 13, 2026 15:16
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 13, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from c1ce290 to 57ad142 Compare November 14, 2026 03:31
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 14, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from 57ad142 to 93f12a8 Compare November 15, 2026 07:37
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 15, 2026
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from 93f12a8 to d32fc9c Compare November 15, 2026 11:40
@github-actions github-actions Bot added merge conflict Branch has merge conflicts with its base — author must resolve before merge and removed merge conflict Branch has merge conflicts with its base — author must resolve before merge labels Nov 15, 2026
A non-interactive Claude Code session approves every pending project
server by itself, so opening a Crew chat in a cloned repository started
the commands in its .mcp.json files with no approval. Each session's
inline settings (the flag tier) now list those servers in
disabledMcpjsonServers, the key Claude Code checks before any approval,
except the names approved exactly in the user settings.json of the
config directory the claude child reads. Every request that starts a
Claude Code process carries the list, so the user's own and plugin
servers keep starting. The seed file does not carry it, so the user's
own claude in that work dir still asks.

A session gets strictMcpConfig, so only Crew's own servers mount, only
when the list cannot keep the servers off: no read of the files
finished, a name cannot be learned, the list is over 16 KiB as escaped
JSON (the SDK passes it as one --settings argument), or the adapter is
below the floor the inline settings rely on. A session that leaves the
project setting source out never needs it. A rewind's native fork sends
the same claudeCode options as the session/load after it, because the
fork's process starts its servers first. One warning per session names
the .mcp.json paths, never server names, and how to approve them.

The .mcp.json files are read once per seed write, bounded, and parsed
with loads_user_json; only a JSON syntax error means Claude Code starts
nothing, and anything else Python refuses counts as unknown. The walk
reads the user settings first, keeps only the names the list would
carry, and goes strict as soon as their encoded size passes the cap,
before it reads another file. A link is followed one hop at a time; a
hop into /proc or /dev/fd, however many leading slashes spell it, a
missing target or a sensitive path counts as unknown. The child home's
own .mcp.json, where Crew writes its discovered servers, is skipped by
resolved path unless the work dir is the home dir. An empty or relative
HOME or CLAUDE_CONFIG_DIR names no home and no config dir, so it
approves nothing and skips nothing; only an absent one falls back to the
account's home.

Part of kirodotdev#30171
@shubhamkurkure
shubhamkurkure force-pushed the fix/claude-disable-unapproved-project-mcp branch from d32fc9c to 704ad89 Compare November 16, 2026 07:22
@github-actions github-actions Bot removed the merge conflict Branch has merge conflicts with its base — author must resolve before merge label Nov 16, 2026

This branch has not been deployed

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

Labels

fork Pull request from a fork (external contributor) readiness: action required A blocking check or review needs attention

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants