Skip to content

[BUG] apm install rewrites a JSONC or trailing-comma MCP config from scratch and deletes the user's servers #3674

Closed

Description

Describe the bug

VS Code accepts comments in .vscode/mcp.json (JSONC), and hand-edited files often contain a trailing comma. When such a file exists and a dependency declares an MCP server, apm install cannot parse the file, treats it as empty and writes a new file that contains only APM's servers. Every user-defined server is deleted and the command exits 0 with no warning.

Affected writers: Copilot project .github/mcp.json and the Copilot CLI user config, VS Code .vscode/mcp.json, Gemini .gemini/settings.json (the whole settings file, including theme and hooks, is replaced) and Kiro .kiro/settings/mcp.json. Cursor and OpenCode already refuse with "skipping config write to avoid data loss".

To reproduce

  1. Create .vscode/mcp.json:
    {
      // my servers
      "servers": { "user-srv": { "command": "node", "args": ["u.js"] } }
    }
  2. Add a dependency that declares an MCP server and run apm install --target vscode.
  3. grep -c user-srv .vscode/mcp.json

Expected behavior

APM never discards a config it cannot parse. It leaves the file byte-identical, reports the server as not configured, exits non-zero and asks the user to fix the file (the behavior Cursor and OpenCode already have).

Actual behavior

Exit 0. The file now holds only APM's server; user-srv is gone.

Found by the 0.36.0 pre-release lifecycle sweep, round 2 (#3649). Same behavior on v0.35.1, so this is not a 0.36 regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/mcp-configMCP server configuration depth, transports, variable resolution.pillar/consumePillar: install any agent package into any harness, reproduciblytype/bugSomething does not work as documented.

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions