[BUG] 'env' vars from .claude/settings.json not passed to the plugins/mcps.

Open 💬 15 comments Opened Nov 19, 2025 by b0dea

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

  1. Create a plugin that requires environment variables to be passed, for MCPs or other purposes.
  2. Set it up in a local repository with .claude/settings.json, enabling the plugin and providing the necessary .env variables.
  3. 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_

View original on GitHub ↗

This issue has 15 comments on GitHub. Read the full discussion on GitHub ↗