Commit 55efeaa
LittleCoinCoin
fix: resolve configuration file corruption and data loss issues
Root cause: MCPServerConfig model was rejecting host-specific fields and
configuration writing was overwriting existing servers instead of merging.
Critical fixes:
1. **Allow host-specific fields**: Changed MCPServerConfig.Config.extra from
'forbid' to 'allow' to support Gemini's cwd, timeout, trust fields
2. **Preserve existing servers**: Modified write_configuration to merge new
servers with existing ones instead of complete replacement
3. **Enhanced JSON validation**: Added JSON verification after write to
prevent invalid output with missing brackets
4. **Improved error handling**: Better cleanup and error reporting for
JSON serialization failures
Resolves Issue 1: Configuration File Corruption and Data Loss
- ✅ Existing mcpServers configuration preserved (no data loss)
- ✅ Valid JSON output with proper structure
- ✅ Host-specific fields (cwd, timeout, trust) supported
Tested: All MCP CLI tests pass (100% success rate)
Verified: Configuration merge preserves existing servers while adding new ones1 parent 6119fe2 commit 55efeaa
2 files changed
+27
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
104 | | - | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
458 | 458 | | |
459 | 459 | | |
460 | 460 | | |
461 | | - | |
462 | | - | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
463 | 465 | | |
464 | | - | |
465 | | - | |
466 | | - | |
467 | | - | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
468 | 470 | | |
469 | | - | |
| 471 | + | |
470 | 472 | | |
471 | | - | |
472 | | - | |
473 | | - | |
474 | | - | |
475 | | - | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
476 | 490 | | |
477 | 491 | | |
478 | 492 | | |
| |||
0 commit comments