fix: preserve user MCP servers when spawning Claude from dashboard#542
Merged
khaliqgant merged 4 commits intomainfrom Mar 11, 2026
Merged
fix: preserve user MCP servers when spawning Claude from dashboard#542khaliqgant merged 4 commits intomainfrom
khaliqgant merged 4 commits intomainfrom
Conversation
When the broker spawns Claude agents, it was passing --strict-mcp-config with only the relaycast server, which nuked all other MCP servers the user had configured in .mcp.json (filesystem, database, etc.). Now reads the project-level .mcp.json, merges all non-relaycast servers with the broker-injected relaycast config, and passes the combined config. The relaycast entry always wins to prevent stale credentials, but other MCPs are preserved. 3 new tests: merge with existing, no .mcp.json, malformed .mcp.json 199/199 Rust unit tests pass.
Reads MCP servers from all 3 Claude config sources in precedence order: 1. ~/.claude/settings.json (global) 2. ~/.claude/settings.local.json (local, gitignored) 3. .mcp.json (project-level) Later sources override earlier ones, matching Claude's own loading order. Relaycast entry always wins. 200/200 tests pass.
e4817a8 to
889c5e4
Compare
Refactors merge_relaycast_with_project_mcp to accept an optional home_dir parameter (via _inner variant) for testability, then adds 7 integration tests: - E2E Claude spawn with user servers (Test A) - Precedence: project overrides global/local (Test B) - Precedence: local overrides global (Test B cont) - Global-only MCP servers appear in output (Test C) - Disabled servers preserved as-is (Test D) - Large config with 15+ servers (Test E) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
b8be559 to
d7a2be3
Compare
khaliqgant
added a commit
that referenced
this pull request
Mar 25, 2026
) * fix: merge user MCP servers with relaycast when spawning Claude agents When the broker spawns Claude agents, it was passing --strict-mcp-config with only the relaycast server, which nuked all other MCP servers the user had configured in .mcp.json (filesystem, database, etc.). Now reads the project-level .mcp.json, merges all non-relaycast servers with the broker-injected relaycast config, and passes the combined config. The relaycast entry always wins to prevent stale credentials, but other MCPs are preserved. 3 new tests: merge with existing, no .mcp.json, malformed .mcp.json 199/199 Rust unit tests pass. * fix: also merge global MCP configs (~/.claude/settings.json) Reads MCP servers from all 3 Claude config sources in precedence order: 1. ~/.claude/settings.json (global) 2. ~/.claude/settings.local.json (local, gitignored) 3. .mcp.json (project-level) Later sources override earlier ones, matching Claude's own loading order. Relaycast entry always wins. 200/200 tests pass. * test: add comprehensive integration tests for MCP config merging Refactors merge_relaycast_with_project_mcp to accept an optional home_dir parameter (via _inner variant) for testability, then adds 7 integration tests: - E2E Claude spawn with user servers (Test A) - Precedence: project overrides global/local (Test B) - Precedence: local overrides global (Test B cont) - Global-only MCP servers appear in output (Test C) - Disabled servers preserved as-is (Test D) - Large config with 15+ servers (Test E) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * style: auto-format Rust code with cargo fmt --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When the broker spawns Claude agents, it passes
--strict-mcp-configwith only the relaycast MCP server. This nukes all other MCP servers from.mcp.json.Fix
New
merge_relaycast_with_project_mcp(): reads.mcp.json, merges non-relaycast servers with broker-injected relaycast config. Relaycast always wins (prevents stale creds), other MCPs preserved.3 new tests, 199/199 Rust unit tests pass.