Environment
- Platform (select one):
- Claude CLI version: Claude Code v1.0.85
- Operating System: WSL on Windows 11
- Terminal: bash
Bug Description
When configuring an MCP server in .mcp.json with headers that use environment variable substitution, Claude Code is not sending these headers to the MCP server.
Steps to Reproduce
- Set environment variables: export MCP_TOKEN="token-value" and export MCP_USER_ID="user-id"
- Configure .mcp.json:
{
"mcpServers": {
"df-core": {
"transport": {
"type": "http",
"url": "http://localhost:8002",
"headers": {
"x-mcp-token": "${MCP_TOKEN}",
"x-mcp-user-id": "${MCP_USER_ID}"
}
}
}
}
}
- Connect to MCP server via /mcp command
- Server logs show headers are not received
Expected Behavior
Headers should be sent with environment variables expanded
Actual Behavior
No custom headers are sent (confirmed via server debug logs)
Additional Context
- Environment variables are properly set (confirmed via env | grep MCP)
- Server works correctly when headers are sent via curl
- Documentation states environment variable substitution is supported in headers
Environment
Bug Description
When configuring an MCP server in .mcp.json with headers that use environment variable substitution, Claude Code is not sending these headers to the MCP server.
Steps to Reproduce
Expected Behavior
Headers should be sent with environment variables expanded
Actual Behavior
No custom headers are sent (confirmed via server debug logs)
Additional Context