Skip to content

npm output pollutes JSON-RPC protocol channel causing parse errors #2895

@prtc

Description

@prtc

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions