[BUG] `/doctor` reports missing env vars without checking settings.json `env` field

Resolved 💬 2 comments Opened Feb 20, 2026 by raman325 Closed Mar 20, 2026

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?

/doctor (and claude doctor) has two issues with MCP server environment variable validation:

1. Doesn't check settings.json env field

/doctor reports that a plugin MCP server is invalid due to missing environment variables, even when those variables are defined in the env field of ~/.claude/settings.json. The MCP server works correctly — the env var is picked up at runtime — but the doctor validation check doesn't account for it.

Example output:

plugin:github [github]: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN

Actual configuration in ~/.claude/settings.json:

{
  "env": {
    "GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_..."
  }
}

The GitHub plugin MCP server connects and works fine (verified via get_me tool call), confirming the env var is properly inherited. The doctor check is a false positive.

2. Validates disabled MCP servers

/doctor also validates MCP servers that have been explicitly disabled (e.g., via disabledMcpServers in project settings or "disabled": true on the server config). For example, it checks the greptile plugin MCP server even though it's listed in disabledMcpServers. Disabled servers shouldn't be validated since they won't be started.

What Should Happen?

  1. /doctor should check all sources of environment variables before reporting them as missing:
  • The MCP server's own env field
  • The top-level env field in settings.json and settings.local.json
  • The shell/process environment
  1. /doctor should skip validation entirely for MCP servers that are disabled.

Error Messages/Logs

plugin:github [github]: MCP server github invalid: Missing environment variables: GITHUB_PERSONAL_ACCESS_TOKEN

Steps to Reproduce

For issue 1:

  1. Install the github plugin (github@claude-plugins-official)
  2. Instead of setting GITHUB_PERSONAL_ACCESS_TOKEN in the plugin's MCP server env or the shell profile, set it in ~/.claude/settings.json:

``json
{
"env": {
"GITHUB_PERSONAL_ACCESS_TOKEN": "github_pat_..."
}
}
``

  1. Run claude doctor or /doctor
  2. Observe false positive warning about missing env var
  3. Verify the GitHub MCP server actually works (e.g., use get_me tool)

For issue 2:

  1. Install a plugin that provides an MCP server (e.g., greptile)
  2. Disable the MCP server via project disabledMcpServers or "disabled": true
  3. Run claude doctor or /doctor
  4. Observe that the disabled server is still validated

Claude Model

None

Is this a regression?

No

Claude Code Version

2.1.45

Platform

Anthropic API (Max subscription)

Operating System

macOS

Terminal/Shell

bash

Additional Information

The env field in settings.json is a supported configuration for setting process-wide environment variables. The doctor validation should be aware of all env var sources and should respect disabled state to avoid confusing false positives.

---

🤖 Generated with Claude Code

View original on GitHub ↗

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