servers icon indicating copy to clipboard operation
servers copied to clipboard

npm output pollutes JSON-RPC protocol channel causing parse errors

Open prtc opened this issue 2 months ago • 1 comments

Description: When mcp-server-fetch is launched via uvx, npm diagnostic messages are written to stdout and interfere with the JSON-RPC protocol communication with Claude Desktop.

Steps to reproduce:

Configure Claude Desktop to use mcp-server-fetch via uvx:

{
  "mcpServers": {
    "fetch": {
      "command": "uvx",
      "args": ["mcp-server-fetch"]
    }
  }
}
  1. Launch Claude Desktop
  2. Check logs at ~/Library/Logs/Claude/mcp-server-fetch.log

Expected behavior: Clean JSON-RPC communication without parse errors

Actual behavior: JSON parsing errors during initialization:

Unexpected token 'r', "  run `npm f"... is not valid JSON
Unexpected token 'o', "found 0 vul"... is not valid JSON`

These appear to be npm audit/vulnerability check messages bleeding into the protocol channel.

Impact:

Error messages shown to users despite successful operation Confusing UX - appears broken when it works fine JSON-RPC protocol contamination

Workaround: Users can suppress npm output via environment variables:

"fetch": {
  "command": "uvx",
  "args": ["mcp-server-fetch"],
  "env": {
    "NPM_CONFIG_LOGLEVEL": "error",
    "NPM_CONFIG_AUDIT": "false"
  }
}

Suggested fix: The MCP server should either:

Redirect npm/package manager output to stderr instead of stdout Suppress these messages at the package level Document the environment variable workaround

Environment: uvx 0.9.2 Claude Desktop 0.14.1 macOS 15.4.1

The server functions correctly after initialization, but the startup noise creates unnecessary friction.

prtc avatar Oct 21 '25 17:10 prtc