MCP server configurations should inherit from parent directories
Problem
MCP server configurations in ~/.claude.json are keyed by exact project path and do not inherit from parent directories. This means launching Claude Code from a subdirectory will show "No MCP servers configured" even when a parent directory has MCP configs defined.
Current Behavior
Config in ~/.claude.json:
{
"projects": {
"/Users/username": {
"mcpServers": {
"datadog": { ... },
"solarwinds-orion": { ... }
}
}
}
}
Launch from subdirectory:
cd ~/git/tf-network/tf-network-idn
claude
# Result: "No MCP servers configured"
Claude Code looks for an exact match for /Users/username/git/tf-network/tf-network-idn, doesn't find it, and reports no MCP servers available.
Expected Behavior
Claude Code should walk up the directory tree to find MCP configurations:
- Check
/Users/username/git/tf-network/tf-network-idn→ no config - Check
/Users/username/git/tf-network→ no config - Check
/Users/username/git→ no config - Check
/Users/username→ found! - Use parent's MCP configuration (with optional local overrides)
This is standard behavior in most development tools (git config, eslint, prettier, .editorconfig, etc.).
Why This Matters
- User Experience: Users expect their MCP integrations (Datadog, Jira, etc.) to be available regardless of which subdirectory they're working in
- Configuration Management: Forcing users to duplicate MCP configs for every subdirectory is error-prone and unmaintainable
- Predictability: The current behavior is surprising - users don't understand why their MCP servers work from
~/but not from~/projects/foo
Suggested Solution
Implement hierarchical configuration lookup:
- Walk up directory tree to find first matching project config
- Allow subdirectories to define their own configs that override/extend parent configs
- Bonus: Support a true "global default" config that applies when no project-specific config exists
Workaround
Currently, users must either:
- Always launch Claude Code from the root directory where MCP is configured
- Duplicate MCP server configurations for every working directory (not recommended)
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗