fix: point Claude Code profile at ~/.claude.json, not settings.json
Claude Code stores user-scope MCP servers in ~/.claude.json (what 'claude mcp add' writes); ~/.claude/settings.json is for permissions and hooks and rejects an mcpServers key with a schema error, so BCC was reading (and writing) servers where Claude Code never looks. If servers are found parked in settings.json, that file is still listed as 'Claude Code (legacy settings.json)' so they can be copied into the real config via Copy to. Docs updated; verified against docs.claude.com/en/docs/claude-code/settings.
This commit is contained in:
+20
-4
@@ -87,7 +87,10 @@ def discover_profiles() -> list[Profile]:
|
||||
|
||||
Claude Desktop: scans the platform app-support folder for any `Claude*`
|
||||
directory (catches `Claude`, `Claude-Work`, etc.).
|
||||
Claude Code: always at ~/.claude/settings.json on every platform.
|
||||
Claude Code: user-scope MCP servers live in ~/.claude.json (that's what
|
||||
`claude mcp add` writes; project scope is a per-repo .mcp.json, which can
|
||||
be opened via 'Add config…'). NOT ~/.claude/settings.json — that file is
|
||||
for permissions/hooks and rejects an mcpServers key with a schema error.
|
||||
"""
|
||||
base = app_support_base()
|
||||
out: list[Profile] = []
|
||||
@@ -99,11 +102,24 @@ def discover_profiles() -> list[Profile]:
|
||||
cfg = d / CONFIG_FILENAME
|
||||
out.append(Profile(label=d.name, path=cfg, config_exists=cfg.is_file()))
|
||||
|
||||
# Claude Code global settings (~/.claude/settings.json) — same mcpServers format,
|
||||
# cross-platform (the ~/.claude/ directory is always in the same place).
|
||||
cc_cfg = Path.home() / ".claude" / "settings.json"
|
||||
home = Path.home()
|
||||
cc_cfg = home / ".claude.json"
|
||||
out.append(Profile(label="Claude Code", path=cc_cfg, config_exists=cc_cfg.is_file()))
|
||||
|
||||
# Legacy: earlier BCC versions (and hand-edits) may have parked servers in
|
||||
# ~/.claude/settings.json, where Claude Code ignores them. Surface that
|
||||
# file only when it actually contains an mcpServers block, so the user can
|
||||
# Copy to ▸ the entries into the real config.
|
||||
legacy = home / ".claude" / "settings.json"
|
||||
if legacy.is_file():
|
||||
with contextlib.suppress(Exception):
|
||||
if "mcpServers" in load_config(legacy):
|
||||
out.append(
|
||||
Profile(
|
||||
label="Claude Code (legacy settings.json)", path=legacy, config_exists=True
|
||||
)
|
||||
)
|
||||
|
||||
return out
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user