Skip to content

npx wrapper causes "EOF" errors in strict MCP clients (Antigravity, etc.) #74

@meghanto

Description

@meghanto

The recommended configuration uses npx -y @perplexity-ai/mcp-server. npx often writes installation logs ("Need to install the following packages...") or update checks to stdout. Since the MCP protocol requires stdout to be reserved exclusively for JSON-RPC messages, this extra text breaks the handshake, resulting in an immediate initialize: EOF error.

The Workaround: The reliable fix is to install the package locally (npm install @perplexity-ai/mcp-server) and point the config directly to the node executable and the script, bypassing the npx wrapper entirely.
** Before (Cursor/NPX style):**

{
  "perplexity": {
    "command": "npx",
    "args": ["-y", "@perplexity-ai/mcp-server"],
    "env": { "PERPLEXITY_API_KEY": "..." }
  }
}

** After (Antigravity/Direct Execution style):**

{
  "perplexity": {
    "command": "/usr/local/bin/node", 
    "args": [
      "/absolute/path/to/project/node_modules/@perplexity-ai/mcp-server/dist/index.js"
    ],
    "env": { "PERPLEXITY_API_KEY": "..." }
  }
}

[The above is a summary of my troubleshooting session with Gemini Pro 3, generated by Gemini Pro 3]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions