[BUG] MCP servers using `npx` fail silently in VS Code extension (no TTY) — workaround included
Description
MCP servers configured with npx commands work in the CLI but fail silently in the VS Code extension. This is because the VS Code panel/sidebar has no TTY (process.stdin.isTTY is false), and npx (especially on Windows, where it's a .cmd wrapper) fails without one.
This is NOT a config file mismatch — both the CLI and VS Code extension read from the same ~/.claude.json. The servers are seen but fail to spawn.
Related issues
This is the same symptom reported in:
- #24770 (macOS)
- #19054 (macOS)
- #3321 (macOS)
This report adds the root cause analysis and a working solution.
Root cause
- The VS Code extension runs Claude Code in panel/sidebar mode, which has no TTY
npx(and on Windows,npx.cmd) requires a TTY to work reliably — it fails silently when spawned without one- The servers appear in config but never connect, so no MCP tools are available to the agent
Steps to reproduce
- Configure an MCP server in
~/.claude.jsonusingnpx:
``json``
"mcpServers": {
"github": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-github"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." }
}
}
- Run
claude mcp listin terminal →github: ✓ Connected - Open Claude Code in VS Code → server tools are not available
Workaround (confirmed working)
Replace npx with node + direct paths to the installed package entry points.
Option A: Global install + wrapper scripts
- Install packages globally:
npm install -g @modelcontextprotocol/server-github - Create a wrapper
.mjsfile (e.g.~/.claude/mcp-wrappers/github.mjs):
``js``
import "file:///C:/Users/YourUser/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-github/dist/index.js";
- Configure in
~/.claude.json:
``json``
"github": {
"type": "stdio",
"command": "node",
"args": ["C:/Users/YourUser/.claude/mcp-wrappers/github.mjs"],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." }
}
Option B: Direct node path to globally installed package
"github": {
"type": "stdio",
"command": "node",
"args": [
"C:/Users/YourUser/AppData/Roaming/npm/node_modules/@modelcontextprotocol/server-github/dist/index.js"
],
"env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "..." }
}
For mcp-remote (e.g. Linear):
"linear": {
"type": "stdio",
"command": "node",
"args": [
"C:/Users/YourUser/AppData/Roaming/npm/node_modules/mcp-remote/dist/proxy.js",
"https://mcp.linear.app/mcp"
],
"env": {}
}
Result after workaround
All 5 MCP servers (GitHub, Puppeteer, Chrome DevTools, Linear, Maestro) connect and provide tools in VS Code extension.
Expected behavior
npx-based MCP server commands should work in the VS Code extension, or Claude Code should automatically resolve npx to the underlying node command when running without a TTY.
Environment
- Claude Code CLI: v2.1.x (latest)
- VS Code Extension: latest
- OS: Windows 10 (likely affects all platforms based on #24770 and #19054 on macOS)
- Node: v24.13.0
🤖 Generated with Claude Code
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗