Skip to content

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

Open
tylergraydev wants to merge 2 commits intomainfrom
fix/sync-config-overwrite-and-import
Open

fix: prevent sync config from destroying externally-managed configs#204
tylergraydev wants to merge 2 commits intomainfrom
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>
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