[BUG] 'env' vars from .claude/settings.json not passed to the plugins/mcps.
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
I have developed a set of Claude code plugins for the company I work for. Part of using the plugins involves adding a settings.json file in the .claude folder within the local repository.
This is how it looks (of course, with secrets and information masked).
{
"env": {
"SET_OF_ENV_VARS": "ENV_VARS_VALUE",
},
"enabledPlugins": {
"plugin_name@plugin_owner": true,
"plugin_name@plugin_owner": true,
"plugin_name@splugin_owner": true
},
"extraKnownMarketplaces": {
"claude-code-plugins": {
"source": {
"source": "github",
"repo": "NAME_OF_PLUGIN_REPO",
}
}
}
}
The issue is that from a few versions onwards (I am not sure which one), you no longer pass the 'env' variables properly. As a result, when using claude --debug, it reports that some ENV vars are missing, even though I have them and it was working perfectly before. Consequently, many MCPs no longer function correctly, or due to their retry mechanisms, it results in duplicated sessions for that MCP (e.g., context7, Serena, etc).
As a note: if I put the env vars inside .env file and I use the MCPs locally directly (not through the plugin or passing .env vars through .claude/settings.json) - it seems to be working.
Let me know if you need more info. Thanks
What Should Happen?
ENV vars should be passed
Error Messages/Logs
2025-11-18T07:02:43.389Z [DEBUG] Found 5 plugins (4 enabled, 1 disabled)
2025-11-18T07:02:43.389Z [DEBUG] Plugin not available for MCP: plugin_name@plugin_owner - error type: hook-load-failed
2025-11-18T07:02:43.390Z [WARN] Missing environment variables in plugin MCP config: OPENAI_API_KEY, VECTOR_STORE_HOST, VECTOR_STORE_USERNAME, VECTOR_STORE_PASSWORD
2025-11-18T07:02:43.390Z [WARN] Missing environment variables in plugin MCP config: SERENA_PROJECT_PATH
Steps to Reproduce
- Create a plugin that requires environment variables to be passed, for MCPs or other purposes.
- Set it up in a local repository with .claude/settings.json, enabling the plugin and providing the necessary .env variables.
- Attempt to use it and verify that everything functions correctly.
Claude Model
None
Is this a regression?
Yes, this worked in a previous version
Last Working Version
No response
Claude Code Version
2.0.46 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
No response
Any update on this one?
OTLP Telemetry Not Working Due to Env Var Bug
Version: Claude Code 2.0.65
Platform: macOS
Impact: Critical - All OTLP telemetry stopped working
Issue
Environment variables from ~/.claude/settings.json are not being loaded by Claude Code, which breaks OTLP telemetry completely. The env section configuration is correct and validated:
{
"env": {
"CLAUDE_CODE_ENABLE_TELEMETRY": "1",
"OTEL_METRICS_EXPORTER": "otlp",
"OTEL_EXPORTER_OTLP_ENDPOINT": "http://10.90.55.3:4317",
"OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
"OTEL_METRIC_EXPORT_INTERVAL": "10000",
"OTEL_RESOURCE_ATTRIBUTES": "[email protected]"
}
}
Verification
Running ps eww -p <claude-pid> confirms NO OTEL environment variables are set for the Claude Code process, despite being correctly configured in settings.json.
Running lsof -nP -i4TCP | grep claude shows Claude Code has NO active connections to the configured OTLP endpoint (port 4317), confirming the env vars aren't being loaded.
Impact
- Datadog OTLP ingestion receives zero metrics
- Affects entire team that upgraded to 2.0.65
- Monitoring dashboards completely broken
- Worked in previous versions, confirmed regression
This significantly impacts teams using OTLP for monitoring Claude Code usage and costs.