npx-based MCP plugins (Playwright, Context7) fail to connect with concurrent sessions

Resolved 💬 4 comments Opened Mar 16, 2026 by KCW89 Closed Apr 15, 2026

Description

MCP plugins that use npx @pkg@latest (stdio transport) consistently fail to connect when multiple Claude Code sessions are open concurrently. HTTP-based plugins (Supabase, Sentry) connect fine.

Affected plugins:

  • playwright@claude-plugins-official — uses npx @playwright/mcp@latest
  • context7@claude-plugins-official — uses npx -y @upstash/context7-mcp

Root Cause Analysis

The @latest tag in npx forces an npm registry lookup on every MCP server startup. With multiple concurrent sessions:

  1. Each session spawns its own npx processes for each plugin
  2. Registry lookups take 2-5s each under normal conditions
  3. With N concurrent sessions × M plugins, the npm registry gets N×M simultaneous requests
  4. The 10s MCP connection timeout is exceeded before npx finishes the registry check + process startup
  5. Stale orphan processes from crashed/closed sessions accumulate, compounding the problem

Steps to Reproduce

  1. Open 3+ Claude Code sessions in the same project
  2. All sessions have playwright and context7 plugins enabled
  3. Run /mcp in any session
  4. Observe: stdio-based plugins show ✗ Failed to connect while HTTP-based plugins show ✓ Connected

Evidence

claude mcp list output (with 8 concurrent sessions):

plugin:supabase:supabase: https://mcp.supabase.com/mcp (HTTP) - ✓ Connected
plugin:sentry:sentry: https://mcp.sentry.dev/mcp (HTTP) - ✓ Connected
plugin:context7:context7: npx -y @upstash/context7-mcp - ✗ Failed to connect
plugin:playwright:playwright: npx @playwright/mcp@latest - ✗ Failed to connect

Orphan process accumulation (stale sessions):

$ ps aux | grep -E "playwright-mcp|context7-mcp" | grep -v grep | wc -l
12  # should be ≤2 per active session per plugin

Workaround

Pin packages locally as devDependencies and use .mcp.json with direct node execution:

pnpm add -D @playwright/mcp @upstash/context7-mcp
{
  "mcpServers": {
    "playwright": {
      "command": "node",
      "args": ["node_modules/@playwright/mcp/cli.js"]
    },
    "context7": {
      "command": "node",
      "args": ["node_modules/@upstash/context7-mcp/dist/index.js"]
    }
  }
}

This eliminates registry lookups entirely — startup goes from ~5s to ~100ms.

Suggested Fix

Consider one or more of:

  1. Cache npx resolution: Skip registry check if the package was fetched within the last N minutes
  2. Use pinned versions: Plugin configs could use exact versions instead of @latest (update via claude plugins update)
  3. Orphan cleanup: Kill stale MCP stdio processes from previous sessions on startup (check PPID=1 orphans)
  4. Increase timeout: The 10s connection timeout is too tight for npx @latest under concurrent load — consider a graduated timeout or retry

Environment

  • Claude Code version: latest (Mar 2026)
  • OS: macOS Darwin 25.3.0
  • Node: v22.x
  • pnpm: 10.17.1
  • Typical concurrent sessions: 3-8

View original on GitHub ↗

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