entry
No. 19
date

updated
filed under
mcp, debugging
checked against
8 sources

spawn npx ENOENT: MCP Server Not Showing Up in Claude Desktop

When a local MCP server doesn't show up in Claude Desktop, the cause is almost always that the app could not start it. The most common error is spawn npx ENOENT: the app tried to launch npx, and the operating system found no program by that name on the PATH the app passed down. The fix is to give the full path to npx in claude_desktop_config.json, add an env block whose PATH includes the folder where node lives, then fully quit and reopen the app. If that doesn't do it, the server's own log file names the real error.

This post walks through how to find that error, what each common message means, and the fixes. The ENOENT cases were reproduced with Node.js 22 and the official MCP TypeScript SDK client (version 1.32.2), launching @modelcontextprotocol/server-filesystem over stdio with a stripped-down environment.

Step 1: Read the logs

Claude Desktop writes MCP logs to a folder per platform. The MCP docs list:

  • macOS: ~/Library/Logs/Claude
  • Windows: %APPDATA%\Claude\logs
  • Linux: ~/.config/Claude/logs

Two kinds of file matter. mcp.log holds general logging about MCP connections and connection failures. Files named mcp-server-SERVERNAME.log hold the stderr output of each named server, where SERVERNAME is the key you used under mcpServers. To follow them live on macOS:

tail -n 20 -F ~/Library/Logs/Claude/mcp*.log

On Windows, in PowerShell:

type "$env:AppData\Claude\logs\mcp*.log"

If your server's name never appears in these logs, the app didn't read your entry at all. Check the config file itself first (Step 2). If it appears with an error, match the error against the table in Step 3.

Step 2: Check the config file

The config lives at:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

You can open it from Claude Desktop under Settings, then the Developer tab, then Edit Config. The MCP docs' checklist for a server that isn't showing up is short: restart Claude Desktop completely, check the JSON syntax, make sure every file path is valid and absolute rather than relative, read the logs, and run the server command by hand.

JSON is strict. A trailing comma or a missing brace breaks the whole file, not just one server. Check it before you restart:

python3 -m json.tool ~/Library/Application\ Support/Claude/claude_desktop_config.json

The command prints the file back if it parses and names the line of the error if it doesn't.

Then restart properly. The MCP debugging guide says that for Claude Desktop you must fully quit and reopen; closing the window is not enough. Config changes are only read on startup.

Step 3: Match the error

What you see What it means
spawn npx ENOENT The app could not find a program called npx on the PATH it gave the server.
/usr/bin/env: 'node': No such file or directory, then Connection closed npx was found, but node was not, so npx exited at once.
Request timed out on first start The server started but did not answer in time. With npx -y, a package download that can't complete is one cause.
An error with ${APPDATA} in a path (Windows) The server's environment is missing APPDATA. See the Windows section.
A traceback or stack trace in mcp-server-NAME.log The server started and crashed. This is a bug or missing setting in the server, not a launch problem.

Why ENOENT happens

ENOENT is the operating system's "no such file or directory" code. The Node.js docs for child_process.spawn() say it is emitted "when the command does not exist," and that command lookup uses options.env.PATH when an env object is passed. So the question is never whether npx works in your terminal. It is whether npx is on the PATH that the app hands to the server.

That PATH is often shorter than your terminal's. The MCP debugging guide says servers launched over stdio "inherit only a limited subset of environment variables automatically," and that the exact set depends on the platform. The official TypeScript SDK shows what that looks like in code. Its stdio client builds the child's environment from an allowlist, DEFAULT_INHERITED_ENV_VARS, which on macOS and Linux is HOME, LOGNAME, PATH, SHELL, TERM and USER, then merges your env block on top and spawns with shell: false. Nothing from your shell startup files runs.

That matters most if you installed Node with a version manager. nvm's README shows that its install script adds lines to ~/.bashrc, ~/.bash_profile, ~/.zshrc or ~/.profile that load nvm.sh, which is what puts your Node version on PATH. A process that isn't started from that shell never runs those lines, so it never sees nvm's Node.

Reproducing it

This script uses the SDK client to launch the filesystem server the way a desktop host does. The command and an optional PATH come from the command line:

// probe.mjs: npm install @modelcontextprotocol/sdk
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

const [command, pathOverride] = process.argv.slice(2);
const transport = new StdioClientTransport({
  command,
  args: ["-y", "@modelcontextprotocol/server-filesystem", "/tmp"],
  ...(pathOverride ? { env: { PATH: pathOverride } } : {}),
  stderr: "pipe",
});
transport.stderr?.on("data", (d) => process.stderr.write("server stderr: " + d));

const client = new Client({ name: "probe", version: "1.0.0" });
try {
  await client.connect(transport);
  const { tools } = await client.listTools();
  console.log("connected,", tools.length, "tools");
} catch (e) {
  console.log("failed:", e.message);
} finally {
  await client.close().catch(() => {});
}

Running it with env -i and PATH=/usr/bin:/bin imitates an app whose PATH lacks the Node folder (here /opt/node22/bin). Four runs gave four different results:

$ node probe.mjs npx
failed: spawn npx ENOENT

$ node probe.mjs /opt/node22/bin/npx
server stderr: /usr/bin/env: 'node': No such file or directory
failed: MCP error -32000: Connection closed

$ node probe.mjs /opt/node22/bin/npx /opt/node22/bin:/usr/bin:/bin
server stderr: Secure MCP Filesystem Server running on stdio
connected, 14 tools

$ node probe.mjs npx /opt/node22/bin:/usr/bin:/bin
server stderr: Secure MCP Filesystem Server running on stdio
connected, 14 tools

The second run is the trap. An absolute path to npx alone is not enough, because npx is a script whose first line is #!/usr/bin/env node. It still looks up node on PATH, fails, and the client only sees the connection close.

Fix 1: Absolute command plus PATH (macOS and Linux)

Find the real paths in the terminal where npx works:

command -v npx
command -v node

With nvm, nvm which prints the path to a version's node too. Then put both into the config: the full path in command, and the folder that holds node at the front of PATH in env:

{
  "mcpServers": {
    "filesystem": {
      "command": "/Users/username/.nvm/versions/node/v22.12.0/bin/npx",
      "args": [
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "/Users/username/Desktop"
      ],
      "env": {
        "PATH": "/Users/username/.nvm/versions/node/v22.12.0/bin:/usr/local/bin:/usr/bin:/bin"
      }
    }
  }
}

Replace the user name and version with what command -v printed. In the test above, the PATH entry alone was enough for the SDK client, since Node looks commands up on env.PATH. The absolute command costs nothing and keeps working if a host resolves the command some other way, so set both. Remember to update the paths when you switch Node versions with nvm, because the folder name contains the version.

The same applies to Python servers. If the log says spawn uv ENOENT or spawn python ENOENT, use the output of command -v uv or command -v python3 as the command. For a server you wrote yourself, see Build an MCP server in Python for a launch command that uses absolute paths throughout.

Fix 2: Windows

Two Windows problems show up often.

npx is a .cmd file. npm ships npx.cmd as the Windows launcher. The Node.js docs say .bat and .cmd files "are not executable on their own without a terminal," and list spawning cmd.exe with the file as an argument as one way to run them. A host that spawns without a shell, as the TypeScript SDK client does with shell: false, can't run npx directly on Windows. Have cmd run it:

{
  "mcpServers": {
    "filesystem": {
      "command": "cmd",
      "args": [
        "/c",
        "npx",
        "-y",
        "@modelcontextprotocol/server-filesystem",
        "C:\\Users\\username\\Desktop"
      ]
    }
  }
}

We could not run Windows for this post, so this config follows the Node.js docs rather than a test. Note the doubled backslashes; JSON requires them.

${APPDATA} in an error path. The MCP docs cover this case: if the server's log shows an error with ${APPDATA} in a path, add the expanded value of %APPDATA% to the server's env:

"env": {
  "APPDATA": "C:\\Users\\username\\AppData\\Roaming"
}

The same docs warn that npx may keep failing if npm isn't installed globally. If %APPDATA%\npm doesn't exist, they suggest running npm install -g npm.

Fix 3: Run the exact command by hand

Before you restart the app again, run the command and arguments from your config in a terminal. The MCP docs suggest this for any server that doesn't show up:

npx -y @modelcontextprotocol/server-filesystem /Users/username/Desktop

A working stdio server prints a startup line to stderr, or nothing, and waits for input. Press Ctrl+C to stop it. An error here is a server problem, and no config change will fix it. If the server starts and then exits, so the client only reports MCP error -32000: Connection closed, see MCP error -32000: Connection closed for the common causes and fixes.

To test without the app's environment, run the probe script above with env -i, or open the server in the MCP Inspector, which the debugging guide recommends as the first stop. Keep in mind that logs must go to stderr. The guide warns that local servers "should not log messages to stdout," because stdout carries the protocol.

When the server starts but times out

If you route traffic through a proxy, npx -y may need it to download the package. HTTPS_PROXY is not on the SDK's inherited list, so a server launched by an SDK-based client won't see it unless you add it to env. In our test that showed up as MCP error -32001: Request timed out on first launch, and adding the proxy settings to env fixed it. Installing the server package globally once and pointing command at the installed binary also avoids the download on every start.

Consider a desktop extension

Claude's help center describes desktop extensions (.mcpb files) as "a streamlined way to install and manage local MCP servers," and says Claude Desktop "includes a built-in Node.js environment, so Node.js installation isn't required." If you are packaging a Node server for other people, an extension sidesteps most PATH problems. To install one by hand, the help center points to Settings, then Desktop app, then Manage next to Extensions, where the Extension Developer section under Advanced settings has an Install Extension button. You can turn an existing server into one by adding a manifest.json and running mcpb pack.

Once the server connects, the work moves to its tools. Clear names and descriptions decide whether the model uses them well; see why your agent calls the wrong tool. And a filesystem server lets the model read any file in the folders you allow, including instructions someone planted in those files, so read prompt injection attacks on AI agents before you give it broad folders.

Checklist

  • Read mcp.log and mcp-server-NAME.log before changing anything.
  • Validate the config with python3 -m json.tool.
  • Use absolute paths for command and every path argument.
  • Add an env block whose PATH includes the folder that holds node.
  • On Windows, run npx through cmd /c, and add APPDATA to env if the log shows ${APPDATA}.
  • Add proxy variables to env if npx -y has to download through a proxy.
  • Fully quit Claude Desktop and reopen it after every change.
  • Run the exact command by hand to separate launch problems from server bugs.

FAQ

What does spawn npx ENOENT mean?

The host tried to start npx and the operating system found no file by that name on the PATH the host passed to the server. npx working in your terminal doesn't help, because the server doesn't get your terminal's environment.

I set the full path to npx and it still fails. Why?

npx starts with #!/usr/bin/env node, so it still needs node on PATH. Add the Node folder to PATH in the server's env block. Without it the log shows /usr/bin/env: 'node': No such file or directory.

Where are the Claude Desktop MCP logs?

~/Library/Logs/Claude on macOS, %APPDATA%\Claude\logs on Windows and ~/.config/Claude/logs on Linux. Each server writes its stderr to mcp-server-NAME.log.

Do I need to restart Claude Desktop after editing the config?

Yes, and fully. The MCP debugging guide says to quit and reopen Claude Desktop; closing the window is not enough.

Why does the MCP server work in Claude Code but not Claude Desktop?

Each host launches servers with its own environment and config. When the same command works in one and not the other, compare the PATH and paths each one uses, starting with the Desktop logs.

Sources

Server not starting? Paste your config into the MCP config checker to find the usual causes.

Stuck on a different message? The error index lists every agent error covered here, by tool.

Next in the notebook

  1. No. 23MCP error -32000: Connection closed: Fix stdio Servers That Exit

    Fix MCP error -32000 Connection closed: find why a stdio server exits at startup, from import errors and missing env vars to relative paths and stdout.

  2. No. 28Claude Code MCP Failed to Connect: Read the Error, Then Fix It

    Fix a Claude Code MCP server stuck on Failed to connect: read the detail in claude mcp list, then fix paths, env vars, timeouts, approvals and URLs.

  3. No. 2AI Agent Calling the Wrong Tool? 7 Causes and How to Fix Them

    A debugging checklist for tool-calling agents: overlapping tools, vague descriptions, ambiguous parameters, noisy output and bad errors, with a fix for each.