MCP server config args and env not passed to spawned subprocesses

Resolved 💬 3 comments Opened Feb 10, 2026 by prong-raft-squishy Closed Feb 10, 2026

When defining an MCP server in ~/.claude/.mcp.json, the args (beyond the package name) and env fields are silently ignored — they never reach the spawned subprocess.

Reproduction

{
  "mcpServers": {
    "playwright": {
      "command": "npx",
      "args": ["@playwright/mcp@latest", "--browser=chromium"],
      "env": {
        "PLAYWRIGHT_MCP_BROWSER": "chromium"
      }
    }
  }
}

The spawned process (verified via ps -wwE) shows:

  • Command: npm exec @playwright/mcp@latest — no --browser=chromium flag
  • Environment: no PLAYWRIGHT_MCP_BROWSER variable present

Expected

Both the CLI flag and the env var should be passed through to the MCP subprocess.

Impact

Any MCP server that requires configuration via CLI flags or environment variables cannot be configured through .mcp.json. The only workaround is to either patch the MCP server's source code in the npx cache or use a wrapper script that sets env vars before exec.

Environment

  • Claude Code version: latest (as of 2026-02-09)
  • macOS, Apple Silicon
  • Node 25.4.0, npm 11.7.0

Notes

  • The args issue may be related to npxnpm exec conversion, where args after the package spec need a -- separator to be forwarded to the package rather than interpreted by npm itself.
  • The env issue appears to be a separate bug — the env block is simply not applied to the child process environment.

View original on GitHub ↗

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