CLAUDE LABJP
FORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as OctoberFORK — Claude Code 2.1.212 changes what /fork does: it copies your conversation into a new background session with its own row in claude agents, so you can keep working. The old in-session subagent is now /subtaskLIMITS — WebSearch calls are now capped at 200 per session by default, and subagent spawns get the same 200 ceiling, so a runaway search or delegation loop stops on its ownMCPBG — MCP tool calls running past two minutes now move to the background automatically, keeping the session usable. Tune the threshold with CLAUDE_CODE_MCP_AUTO_BACKGROUND_MSPLANFIX — Fixed plan mode auto-running file-modifying Bash commands such as touch and rm without a permission prompt or an SDK canUseTool callbackSONNET5 — Claude Sonnet 5 is running on introductory pricing of $2 per million input tokens and $10 per million output. After August 31 it moves to $3 and $15IPO — Bankers are reportedly lining up investor meetings for Anthropic ahead of a possible public listing as soon as October
Articles/Claude Code
Claude Code/2026-05-11Intermediate

Claude Code MCP Server Won't Start — How to Fix "spawn npx ENOENT" and PATH Issues

You configured an MCP server in Claude Code's settings.json, but it never starts — just "spawn npx ENOENT" or "spawn uvx ENOENT" errors. The culprit is a PATH mismatch between your shell and Claude Code's spawning environment. Here's how to diagnose and fix it.

Claude Code197MCP45troubleshooting87spawn ENOENTPATH2configuration6

You've added an MCP server to your settings.json, waited, and... nothing appears in the tools panel. Checking the logs reveals spawn npx ENOENT or spawn uvx ENOENT staring back at you.

Running the same npx command directly in your terminal works fine. The server starts, responds correctly, everything looks good. But Claude Code refuses to launch it. This disconnect frustrated me for over half an hour when I was setting up additional third-party MCP servers while working on app projects I've been building independently since 2014. The fix turned out to be simpler than expected — once you understand what's actually happening.

What ENOENT Means

ENOENT stands for "Error NO ENTry" — a POSIX error code that Node.js surfaces when a file or executable doesn't exist at the specified path. When you see spawn npx ENOENT, it literally means: Node.js tried to spawn a process called npx, but couldn't find that executable anywhere.

The confusing part is that npx clearly exists on your system. So why can't Claude Code find it?

The Root Cause: Claude Code Uses a Different PATH

Your shell (bash, zsh, fish) loads configuration files like .bashrc, .zshrc, or config.fish when it starts. These files set up your PATH — the list of directories where the OS looks for executables.

But when Claude Code spawns an MCP server using child_process.spawn, it doesn't load your shell's configuration files. It starts the process with a minimal, system-level PATH that often doesn't include the directories where your tools are installed.

The most common scenarios where this bites:

  • Node.js installed via nvm: nvm modifies your PATH dynamically inside shell config files. Any process that doesn't source those files — including Claude Code's MCP spawner — won't find node, npm, or npx
  • Homebrew on Apple Silicon Mac: /opt/homebrew/bin is added to PATH by Homebrew's installer in your shell config, but it's not in the system default PATH
  • uvx installed via uv: Both install to ~/.local/bin or ~/.cargo/bin, directories that aren't in the system PATH by default

You can confirm this by comparing your shell's PATH with what Claude Code actually sees:

# In your terminal — find where npx lives
which npx
# Example output with nvm: /Users/you/.nvm/versions/node/v22.3.0/bin/npx
 
# In Claude Code's Bash tool — see what PATH it has
echo $PATH

The two outputs will likely differ, and the directory containing npx will be missing from Claude Code's version.

Fix 1: Use Absolute Paths in Your MCP Configuration

The most bulletproof solution: replace the short command name with its full path.

Before (broken):

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
    }
  }
}

After (working):

{
  "mcpServers": {
    "filesystem": {
      "command": "/Users/you/.nvm/versions/node/v22.3.0/bin/npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"]
    }
  }
}

The downside: if you switch Node.js versions with nvm, this path breaks. For nvm users, Fix 2 is more maintainable.

Fix 2: Extend PATH via the env Field (Recommended)

Claude Code's settings.json supports an env field for each MCP server, letting you set environment variables for that server's process. You can use this to inject the missing PATH directories:

{
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/Users/you/projects"],
      "env": {
        "PATH": "/Users/you/.nvm/versions/node/v22.3.0/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

To get the right value, run echo $PATH in your terminal and copy the output directly into env.PATH. This preserves your shell's PATH configuration without requiring absolute paths in the command field.

# Copy this output into env.PATH
echo $PATH

This approach scales better than absolute paths — when you update Node.js, you only need to update the PATH string, not each individual server's command.

Fix 3: Create a Symlink in the System PATH

For a system-wide solution that works across all tools (not just Claude Code), create symlinks to your executables in /usr/local/bin:

# Link your nvm-managed npx into the system PATH
sudo ln -sf "$(which npx)" /usr/local/bin/npx
sudo ln -sf "$(which node)" /usr/local/bin/node
 
# For uvx
sudo ln -sf "$(which uvx)" /usr/local/bin/uvx

This works because /usr/local/bin is typically included in the minimal system PATH. The caveat: you'll need to update the symlinks when you switch Node.js versions via nvm.

After Applying the Fix

Fully restart Claude Code — closing and reopening the window may not be enough in all cases; quit the application completely and relaunch.

Then test whether the MCP server is recognized:

# In Claude Code's Bash tool — verify the command is now findable
which npx
 
# If it returns a path, the fix worked
# The MCP server tools should now appear in Claude Code's tool panel

If you're still seeing connection errors after fixing the PATH, the issue may be something different. The Claude Code MCP Connection Troubleshooting Guide covers other common failure modes like permission errors, OAuth token expiry, and server configuration mistakes.

Quick Reference by Tool

npx not found (using nvm)

# Get the path to add
which npx  # /Users/you/.nvm/versions/node/v22.3.0/bin/npx
# Add /Users/you/.nvm/versions/node/v22.3.0/bin to env.PATH

uvx not found

# Get the path to add
which uvx  # /Users/you/.local/bin/uvx  or  /Users/you/.cargo/bin/uvx
# Add that directory to env.PATH

Homebrew commands not found (Apple Silicon)

# Homebrew root
which brew  # /opt/homebrew/bin/brew
# Add /opt/homebrew/bin to env.PATH

When the env Fix Doesn't Work: Checking settings.json Scope

Claude Code has two levels of MCP configuration:

  • Global: ~/.claude/settings.json — applies to all projects
  • Project-local: .claude/settings.local.json in your project root — applies only to that project

If you edited the wrong file, the env fix won't take effect. Verify you're editing the right one:

# Check which settings files Claude Code is reading
cat ~/.claude/settings.json         # Global settings
cat .claude/settings.local.json     # Project-local settings (if it exists)

Also double-check the JSON syntax. A missing comma or mismatched bracket will silently prevent the entire mcpServers block from loading. Claude Code won't always display a clear error for malformed JSON — the server simply won't appear. Use a JSON validator before saving:

# Validate JSON syntax
cat ~/.claude/settings.json | python3 -m json.tool
# If it prints the formatted JSON, the syntax is valid
# If it throws an error, you have a syntax problem

Distinguishing spawn ENOENT from Other MCP Errors

spawn ENOENT is specifically a "can't find the executable" error. It's worth distinguishing from similar-looking errors you might encounter:

  • spawn ENOENT: The command binary doesn't exist in PATH → Fix with absolute path or env.PATH
  • ECONNREFUSED: The server process started but refused a network connection → Usually a port conflict or server startup error
  • Error: Cannot find module: The server started (Node.js ran), but a required npm package is missing → Run npm install in the server directory
  • Permission denied: The binary exists but can't be executed → Check file permissions with ls -la $(which npx)

If your log shows something other than spawn ENOENT, the issue is downstream from PATH — the executable was found, but something else went wrong during server initialization.

The Broader Pattern

This PATH mismatch problem isn't unique to Claude Code or MCP servers — it appears any time a GUI app or background service needs to run CLI tools that were installed in shell-specific locations. Once you recognize the pattern ("it works in my terminal but not when spawned by X"), the diagnosis becomes straightforward: compare the PATHs, find the missing directory, add it explicitly.

Development environments built up over years of installing tools incrementally — nvm here, Homebrew there, uv later — tend to accumulate these PATH fragmentation issues. If you hit this problem with one MCP server, it's worth auditing the entire configuration to make sure other servers won't fail the same way.

For a broader look at what MCP servers are available and how to choose them, MCP × Claude Practical Guide covers setup, recommended servers, and real workflow integrations.

Start with echo $PATH in your terminal, copy the output into env.PATH in your settings.json, and restart Claude Code. That single change resolves the issue in most cases.

Putting It All Together: A Diagnostic Checklist

When an MCP server fails to start with a spawn error, work through these steps in order:

Step 1 — Confirm the executable exists

which npx    # or: which uvx / which python3

If which returns nothing, the tool isn't installed at all — install it first.

Step 2 — Note the full path from Step 1

which npx
# /Users/you/.nvm/versions/node/v22.3.0/bin/npx

Copy this path. You'll need the directory part: /Users/you/.nvm/versions/node/v22.3.0/bin

Step 3 — Add that directory to env.PATH in your MCP server config

{
  "mcpServers": {
    "your-server": {
      "command": "npx",
      "args": ["..."],
      "env": {
        "PATH": "/Users/you/.nvm/versions/node/v22.3.0/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

Step 4 — Validate the JSON syntax

cat ~/.claude/settings.json | python3 -m json.tool > /dev/null && echo "Valid JSON"

Step 5 — Fully quit and restart Claude Code, then check the tool panel

If the server now appears and its tools are available, you're done. If not, check the Claude Code logs for a different error type, which may point to a separate issue such as a missing npm package or a server-side configuration problem.

Running through this checklist takes about two minutes and covers the majority of MCP server startup failures.

Share

Thank You for Reading

Claude Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

If you found this article helpful, a small tip ($1.50) would mean a lot to us. Your support helps keep this site ad-free and covers server and hosting costs.

Related Articles

Claude Code2026-05-05
MCP Server Suddenly Stopped Working in Claude Code: A 5-Step Diagnosis Guide
Five steps for diagnosing a broken MCP server: check /mcp status, read stderr logs, validate JSON config, verify auth tokens, and restart Claude Code cleanly.
Claude Code2026-04-24
Three Minutes with /doctor: Catching Claude Code Config Drift Before It Costs You an Hour
When Claude Code acts up, the first thing to run is /doctor. It shows merged settings, MCP server status, and permission mode at a glance.
Claude Code2026-04-12
CLAUDE.md Not Working? A Complete Troubleshooting Guide for Claude Code
Claude Code ignoring your CLAUDE.md settings? This guide covers the most common causes — wrong file location, formatting issues, conflicting configs, and more — with clear fixes for each.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →