store: MCP manager was writing to wrong config path - ~/.claude/.mcp.json instead of project .mcp.json

This commit is contained in:
Cal Corum 2026-02-19 21:52:57 -06:00
parent 32bec53125
commit 47267fd420

View File

@ -0,0 +1,42 @@
---
id: b3c2d454-3b8e-4d3d-b24c-6241f12d03e6
type: fix
title: "MCP manager was writing to wrong config path - ~/.claude/.mcp.json instead of project .mcp.json"
tags: [mcp, claude-code, mcp-manager, fix, configuration]
importance: 0.9
confidence: 0.8
created: "2026-02-20T03:52:57.247423+00:00"
updated: "2026-02-20T03:52:57.247423+00:00"
---
## Problem
The mcp-manager skill's `mcp_control.py` was reading/writing `~/.claude/.mcp.json`, but Claude Code does NOT read that file. Claude Code reads MCP config from two locations:
1. **Global**: `~/.claude.json``mcpServers` key (always-on MCPs like cognitive-memory)
2. **Project**: `<project-root>/.mcp.json``mcpServers` key (on-demand MCPs)
This meant n8n-mcp was correctly configured in `~/.claude/.mcp.json` but never loaded by Claude Code, even after multiple session restarts.
## Root Cause
The original mcp_control.py had hardcoded:
```python
MCP_CONFIG = CLAUDE_DIR / ".mcp.json" # ~/.claude/.mcp.json - WRONG
```
## Fix
1. Updated `mcp_control.py` to auto-detect project root via `git rev-parse --show-toplevel` and write to `<project-root>/.mcp.json`
2. Added `GLOBAL_CONFIG` constant pointing to `~/.claude.json` for reference
3. Cleaned up stale MCP registry (removed Daniel Miessler's MCPs: httpx, naabu, apify, brightdata, Ref, stripe, content, daemon, Foundry)
4. Added `n8n-mcp` to the registry
5. Updated SKILL.md to document correct config locations
6. Also found the project-level `.mcp.json` at `/mnt/NV2/Development/claude-home/.mcp.json` had `"mcpServers": {}` which was overriding global config
## Key Lesson
Claude Code MCP config hierarchy:
- `~/.claude.json` → global, always loaded
- `<project>/.mcp.json` → project-specific, merged with global
- `~/.claude/.mcp.json` → NOT USED by Claude Code (was a mistake)