RuVector icon indicating copy to clipboard operation
RuVector copied to clipboard

MCP server overwrites .mcp.json, stripping autoStart and other user-added fields

Open PogeystickJoe opened this issue 8 months ago • 1 comments

Bug

When ruvector (and ruflo) MCP servers start via npx ruvector@latest mcp start, the .mcp.json file gets modified — specifically, "autoStart": true fields are silently removed from the config.

Steps to Reproduce

  1. Create .mcp.json with both ruvector and ruflo configured:
{
  "mcpServers": {
    "ruvector": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "ruvector@latest", "mcp", "start"],
      "autoStart": true
    },
    "ruflo": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "ruflo@latest", "mcp", "start"],
      "env": {
        "CLAUDE_FLOW_MODE": "v3",
        "CLAUDE_FLOW_HOOKS_ENABLED": "true"
      },
      "autoStart": true
    }
  }
}
  1. Start Claude Code (or restart session)
  2. Check .mcp.json — autoStart fields have been removed from both entries

Expected

.mcp.json should not be modified by the MCP server process. User-added fields like autoStart should be preserved.

Actual

The file is rewritten without autoStart, causing both servers to fall back to lazy/on-demand startup instead of auto-starting. This happens repeatedly across sessions — every restart strips the field again.

Impact

  • Servers don't auto-start, so tools aren't available until first explicit call
  • Any statusline or dashboard integration that depends on the servers being live at session start breaks silently
  • Users have to manually re-add autoStart: true after every session

Environment

  • Windows 11, ruvector@latest + ruflo@latest via npx
  • Claude Code .mcp.json project-level config
  • Observed across multiple sessions/restarts

PogeystickJoe avatar Mar 08 '26 17:03 PogeystickJoe

Fixed in [email protected] (published to npm).

Root cause: hooks init was writing an empty mcpServers: {} key to .claude/settings.json. This could trigger Claude Code to regenerate .mcp.json from its internal state, stripping user-added fields like autoStart.

Changes:

  • hooks init no longer writes empty mcpServers: {} — it only uses enabledMcpjsonServers to reference servers already defined in .mcp.json
  • Existing empty mcpServers: {} entries are now cleaned up automatically
  • doctor --fix detects and removes stale empty mcpServers entries

To update:

npx [email protected] hooks init --force

Or run npx ruvector doctor --fix to clean up the empty mcpServers key without re-initializing.

Thanks for the report @PogeystickJoe!

ruvnet avatar Mar 10 '26 14:03 ruvnet