## TL;DR

Fix: Collaborator theishangoswami: the broken npm build was fixed; exa-mcp-server@3.0.5 works. Community workaround before the fix: pin to 2.0.9, or switch to the remote MCP (mcp-remote https://mcp.exa.ai/mcp). Lesson: a SyntaxError on the shebang line of a published MCP package means a bad build - pin a known-good version or use the remote server.

## The error

```text
The npm package exa-mcp-server fails to start via stdio with 'SyntaxError: Invalid or unexpected token' pointing at a second '#!/usr/bin/env node' shebang line inside .smithery/index.cjs.
```

## Fix

1. Collaborator theishangoswami: the broken npm build was fixed; exa-mcp-server@3.0.5 works.
2. Community workaround before the fix: pin to 2.0.9, or switch to the remote MCP (mcp-remote https://mcp.exa.ai/mcp).
3. Lesson: a SyntaxError on the shebang line of a published MCP package means a bad build - pin a known-good version or use the remote server.

Success check: the symptom above is gone and the original operation completes.

## When to use

- You hit this exact symptom in exa-mcp-server.
- You want the verified fix without digging through the thread.

## When not to use

- A different error in exa-mcp-server, even a similar-looking one.
- General exa-mcp-server setup or credential questions.

## Compatibility

- Exa MCP Server (exa-labs/exa-mcp-server)

## Variant phrasings

- How to fix "multiple shebang lines in .smithery/index.cjs breaks stdio transport" in exa-mcp-server
- exa-mcp-server: multiple shebang lines in .smithery/index.cjs breaks stdio transport

## Source

- https://github.com/exa-labs/exa-mcp-server/issues/65