Skip to content

fix: pass valid empty MCP config to Claude CLI#465

Open
snvtac wants to merge 1 commit into
nashsu:mainfrom
snvtac:snvtac/459-local-claude-code-mcp-config
Open

fix: pass valid empty MCP config to Claude CLI#465
snvtac wants to merge 1 commit into
nashsu:mainfrom
snvtac:snvtac/459-local-claude-code-mcp-config

Conversation

@snvtac

@snvtac snvtac commented Jun 23, 2026

Copy link
Copy Markdown

Problem

Fixes #459.

The local Claude Code CLI provider passed --mcp-config "{}" when local CLI config isolation was enabled. Claude Code CLI rejects that shape because it expects an explicit top-level mcpServers record, even when there are no MCP servers.

Root cause

build_claude_cli_args serialized an empty isolated MCP config as {}. Newer Claude Code CLI versions validate that config as missing mcpServers, so provider connection checks can fail before the prompt is sent.

Fix

  • Pass {"mcpServers":{}} for the isolated empty MCP config.
  • Keep --strict-mcp-config and the existing isolation flags intact.
  • Update the Rust unit test to assert both the exact argument value and valid JSON shape.

Validation

  • npm run typecheck
  • npm run test:mocks -- src/lib/connection-tests.test.ts src/lib/__tests__/claude-cli-transport.test.ts (37 tests)
  • npm run build
  • Not run locally: cargo test --manifest-path src-tauri/Cargo.toml claude_args_can_isolate_user_config_tools_and_mcp (cargo/rustup are not installed in this shell)

@snvtac snvtac marked this pull request as ready for review June 23, 2026 09:41
@BookWormSC

Copy link
Copy Markdown

还没修复吗

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Local Claude Code CLI provider passes invalid --mcp-config "{}", breaking the connection

2 participants