#112
fix: make mcp config writes idempotent
Summary
This PR makes dev3000’s automatic MCP config updates idempotent and safer when config files already contain a dev3000 entry.
- Add a shared
upsertMcpServerConfighelper for Claude, Cursor, and OpenCode config shapes - Update stale dev3000 localhost MCP URLs when the MCP port changes
- Avoid rewriting config files when the dev3000 entry is already up to date
- Preserve existing MCP servers and top-level config fields
- Preserve OpenCode
enabled: false - Avoid overwriting custom user-managed
dev3000entries
Why
dev3000 keeps MCP client config files around between runs. If the MCP port changes, an existing dev3000 entry can point at a stale localhost URL, while repeated runs should not rewrite files that are already current.
This keeps the auto-config behavior useful while making the write path more conservative and predictable.
Tests
pnpm.cmd test src\utils\mcp-configs.test.tspnpm.cmd exec tsc --noEmit --pretty falsepnpm.cmd exec biome check src\dev-environment.ts src\utils\mcp-configs.ts src\utils\mcp-configs.test.tsgit diff --check
@takagibit18 is attempting to deploy a commit to the Vercel Labs Team on Vercel.
A member of the Team first needs to authorize it.