Skip to content

fix: prevent sync config from destroying externally-managed configs#204

Merged
tylergraydev merged 2 commits into
mainfrom
fix/sync-config-overwrite-and-import
Apr 22, 2026
Merged

fix: prevent sync config from destroying externally-managed configs#204
tylergraydev merged 2 commits into
mainfrom
fix/sync-config-overwrite-and-import

Conversation

@tylergraydev

Copy link
Copy Markdown
Owner

Summary

  • Fixes [Bug]: Sync Config destroys .mcp.json #191 (reopened) — Sync Config was still overwriting .mcp.json, claude.json, opencode.json, and other editor configs with empty {} when a project had no MCPs in the app's database
  • Imports MCPs from .mcp.json on project add — externally-configured servers now appear in the UI instead of showing an empty project
  • Adds missing Tauri commandsopen_folder and update_project_editor_type were invoked by the frontend but never implemented

Root cause

The previous fix (3064d5f) only guarded write_project_config() and write_global_config(), but missed write_project_to_claude_json() and all other editor config writers (OpenCode, Copilot, Cursor, Gemini, Codex). Additionally, .mcp.json was never read/imported when adding a project — the app only checked if the file existed but never parsed it.

Changes

File Change
config_writer.rs Guard write_project_to_claude_json against empty overwrite
opencode_config.rs Guard both global and project writers
copilot_config.rs Early return when mcps empty
cursor_config.rs Early return when mcps empty
gemini_config.rs Early return when mcps empty
codex_config.rs Early return when mcps empty
scanner.rs New import_mcps_from_project_mcp_json function
projects.rs Import MCPs on add, fix .mcp.json path, add open_folder + update_project_editor_type commands
lib.rs Register new commands

Test plan

  • cargo check — 0 errors
  • cargo test — 1991 tests pass (including updated preservation test)
  • Manual: add a project with an existing .mcp.json → servers should appear in the UI
  • Manual: click Sync Config on a project with no app-managed MCPs → .mcp.json should be preserved
  • Manual: verify open_folder and editor type switching work in project dashboard

🤖 Generated with Claude Code

Tyler Gray and others added 2 commits April 16, 2026 14:00
When the database has no MCP servers for a project, sync was replacing
the mcpServers key with an empty object, destroying hand-configured
servers. Now skips the overwrite when DB returns no servers.

Fixes #191

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
… import .mcp.json on project add

Fixes #191 (reopened) — Sync Config was still overwriting .mcp.json, claude.json,
opencode.json, and other editor configs with empty settings when a project had no
MCPs in the app's database.

Root cause: The previous fix (3064d5f) only guarded write_project_config() and
write_global_config(), but missed write_project_to_claude_json() and all other
editor config writers (OpenCode, Copilot, Cursor, Gemini, Codex).

Changes:
- Guard all 7 config writers against overwriting with empty MCP data
- Import MCPs from .mcp.json when a project is added (so externally-configured
  servers appear in the UI instead of showing an empty project)
- Fix has_mcp_file check (was looking at .claude/.mcp.json, now checks .mcp.json
  in project root per the official spec)
- Add missing Tauri commands: open_folder, update_project_editor_type

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
@tylergraydev tylergraydev merged commit 4b2a0fb into main Apr 22, 2026
10 checks passed
@tylergraydev tylergraydev deleted the fix/sync-config-overwrite-and-import branch April 22, 2026 16:24
tylergraydev pushed a commit that referenced this pull request May 4, 2026
User-facing additions:
- Model picker now uses Claude Code aliases (opus/sonnet/haiku/opusplan/best)
  with a 1M context toggle and a free-form "Other (custom model ID)" field
  for Bedrock ARNs / Vertex / Foundry IDs (#213).
- Rules dropped into ~/.claude/rules/ or {project}/.claude/rules/ now show
  up in the UI via new global/project scanners (#200).

Fixes:
- Sync Config no longer wipes externally-managed configs (.mcp.json,
  claude.json, OpenCode/Copilot/Cursor/Gemini/Codex) — extends the #191
  guard to all 7 writers and imports .mcp.json on project add (#204).
- Skill/command/sub-agent writers emit `tags` as JSON arrays so they
  round-trip through the DB reader (#202).
- PR builds from forks/Dependabot no longer fail on missing
  TAURI_SIGNING_PRIVATE_KEY (#203).
- delete_rule_inner returns real DB errors instead of swallowing them as
  "row absent" (follow-up to #200).

Internal:
- Cargo clippy from 134 warnings to 0; CI now enforces -D warnings on
  --lib --tests (#205).

All 1565 frontend tests and 2021 Rust tests pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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