MCP config shows false positive environment variable warnings despite vars being set and servers working
Resolved 💬 3 comments Opened Nov 23, 2025 by Jstyle1 Closed Jan 23, 2026
Description
Claude Code shows warnings about missing environment variables for MCP servers even when:
- The variables ARE set in the shell environment
- The MCP servers work correctly and return data
Environment
- macOS Darwin 25.1.0
- Claude Code (Haiku 4.5)
- Variables loaded from macOS Keychain via shell profile
Reproduction Steps
- Set env vars in
.zshrcwith Keychain lookups:export META_ACCESS_TOKEN="$(security find-generic-password -s 'service' -a 'account' -w)" - Configure
.mcp.jsonwith env var references:"env": {"META_ACCESS_TOKEN": "${env:META_ACCESS_TOKEN}"} - Verify vars are set:
echo $META_ACCESS_TOKENshows value - Start Claude Code
- Warning appears:
[Warning] [meta-ads] mcpServers.meta-ads: Missing environment variables: env:META_ACCESS_TOKEN, env:META_APP_ID, env:META_APP_SECRET - Despite warning, MCP tools work:
mcp__meta-ads__get_ad_accountsreturns valid ad account data
Expected Behavior
No warning should appear when environment variables are set and accessible to MCP servers (which clearly have access since they work).
Suspected Root Cause
Claude Code's config validation may run in a subprocess or initialization context that doesn't fully inherit shell environment variables, even though the MCP servers themselves have full access to those variables when they execute later.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗