Pit record

A corrupted or cold npx cache makes an MCP server fail to start or time out

An npx-launched MCP server that intermittently fails or yields 'Client closed' / 'MCP error -32001: Request timed out' is often a npx/npm cache problem: an interrupted download leaves a partial package, or a cold first download exceeds the client startup timeout. Clear the cache or pre-install the package.

Fast answer

Problem: npx-launched MCP server worked before and now fails, or fails only on first launch

Root cause: npx downloads the package into the npm cache before running it.

Fix first: Clear the npm/npx cache and relaunch.

Verify: Relaunch after clearing the cache or pre-installing.

Queries this answers

  • comment confirming a corrupted npx cache from network errors caused the server to crash; clearing it fixed startup
  • comment confirming a corrupted npx cache from network errors caused the server to crash; clearing it fixed startup fix
  • comment confirming a corrupted npx cache from network errors caused the server to crash; clearing it fixed startup root cause
  • Client closed / -32001 Request timed out around npx MCP startup
  • Client closed / -32001 Request timed out around npx MCP startup fix
  • Client closed / -32001 Request timed out around npx MCP startup root cause
  • A corrupted or cold npx cache makes an MCP server fail to start or time out
  • A corrupted or cold npx cache makes an MCP server fail to start or time out fix

Record metadata

Statusverified
Confidencemedium
Created2026-06-21
Updated2026-06-21
Last verified2026-06-21
Affected toolsclaude-desktop, cursor, cline, mcp-server
Tagsmcp, npx, cache, startup, timeout, error-32001

Common search queries

  • mcp-npx-cache-corrupted-server-fails-to-start
  • mcp npx cache corrupted server fails to start
  • A corrupted or cold npx cache makes an MCP server fail to start or time out
  • A corrupted or cold npx cache makes an MCP server fail to start or time out fix
  • A corrupted or cold npx cache makes an MCP server fail to start or time out root cause
  • cache
  • startup
  • timeout
  • error-32001
  • claude-desktop
  • cursor
  • cline

Symptoms

  • npx-launched MCP server worked before and now fails, or fails only on first launch
  • client log shows Client closed and/or MCP error -32001: Request timed out
  • the failure is intermittent and sometimes clears up on its own
  • a recent flaky network or interrupted install preceded it

Environment

runtimeNode.js
package_managernpm
constraintsMCP server launched via npx -y <package>, client enforces a startup timeout

Root cause

  • npx downloads the package into the npm cache before running it.
  • An interrupted or rate-limited fetch can leave a partial or corrupted package, so the next launch crashes on missing files.
  • A genuine cold download can exceed the client's startup timeout, producing -32001: Request timed out.

Fix

  1. Clear the npm/npx cache and relaunch.

    npm cache clean --force
  2. Pre-install the package so launch does not depend on a fresh download, and point the config at it.

    npm i -g <package>
  3. If it was a cold-start timeout, retry once the package is cached, or raise the client's MCP startup timeout if configurable.

Verification

  • Relaunch after clearing the cache or pre-installing.

    Expected: Server starts on first try with no Client closed / -32001: Request timed out.

Workarounds

  • Pin a globally installed package by absolute path instead of relying on npx download at launch.

Anti-patterns

  • Repeatedly editing the config when the real fault is a half-written cache.
  • Assuming the server package is broken when a clean cache fixes it.

Sources

No matching fix?

If this record is close but does not solve the user's failure, create a safe unresolved-pit report instead of guessing. Include exact symptoms, environment, attempted fixes, and the record ids already checked.