Skip to content

Fix Sync Config destroying .mcp.json#192

Merged
tylergraydev merged 1 commit into
mainfrom
fix/sync-config-destroys-mcp-json
Apr 13, 2026
Merged

Fix Sync Config destroying .mcp.json#192
tylergraydev merged 1 commit into
mainfrom
fix/sync-config-destroys-mcp-json

Conversation

@tylergraydev

Copy link
Copy Markdown
Owner

Summary

  • Fixes [Bug]: Sync Config destroys .mcp.json #191 — Sync Config was overwriting .mcp.json with {"mcpServers": {}} instead of merging
  • write_project_config() now reads the existing .mcp.json, backs it up, and merges DB-managed mcpServers into the existing config — matching the pattern already used by write_global_config() for ~/.claude.json
  • Refuses to overwrite if the existing file contains invalid JSON, preventing silent data loss

Test plan

  • 4 new unit tests covering: preserving existing keys, backup creation, corrupt JSON rejection, empty MCPs with existing file
  • All 42 config_writer tests pass
  • Full test suite (1908 tests) passes
  • Manual: create a project with .mcp.json containing external MCPs, run Sync Config, verify they aren't destroyed

write_project_config() now reads the existing .mcp.json before writing,
backs it up, and merges DB-managed mcpServers into the existing config
instead of overwriting the entire file. This mirrors the pattern already
used by write_global_config() for ~/.claude.json.

Refuses to overwrite if the existing file contains invalid JSON to
prevent silent data loss.
@tylergraydev tylergraydev merged commit 6de7ade into main Apr 13, 2026
10 checks passed
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.

[Bug]: Sync Config destroys .mcp.json

1 participant