MCP server configurations should inherit from parent directories

Open 💬 1 comment Opened May 27, 2026 by fd-cyamasaki

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:

  1. Check /Users/username/git/tf-network/tf-network-idn → no config
  2. Check /Users/username/git/tf-network → no config
  3. Check /Users/username/git → no config
  4. Check /Users/usernamefound!
  5. 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

  1. User Experience: Users expect their MCP integrations (Datadog, Jira, etc.) to be available regardless of which subdirectory they're working in
  2. Configuration Management: Forcing users to duplicate MCP configs for every subdirectory is error-prone and unmaintainable
  3. 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:

  1. Always launch Claude Code from the root directory where MCP is configured
  2. Duplicate MCP server configurations for every working directory (not recommended)

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗