Immutable solution version
exa-mcp-server fails to start: SyntaxError Invalid or unexpected token in .smithery/index.cjs
Complete solution
Shows how to fix exa-mcp-server fails to start: SyntaxError Invalid or unexpected token in .smithery/index.cjs. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "SyntaxError: Invalid or unexpected token": the shebang ended up on the second line of the published file instead of the first, so Node tries to parse it as JavaScript.
SyntaxError: Invalid or unexpected tokenSteps
- Running
bunx exa-mcp-server@latestfails immediately withSyntaxError: Invalid or unexpected tokenat.smithery/index.cjs:2, pointing at the#!/usr/bin/env nodeline. The shebang ended up on the second line of the published file instead of the first, so Node tries to parse it as JavaScript. Node 22, via bunx on Linux. - The published npm tarball had the
#!/usr/bin/env nodeshebang on line 2 of.smithery/index.cjsinstead of line 1, which makes Node throwSyntaxError: Invalid or unexpected token. Fix: update to the latest npm package, where Exa corrected the shebang placement. If you need it working immediately, switch to the remote MCP server instead of the local install: remove the old config (claude mcp remove exa) and add the remote one (`claude mcp add exa -e EXAAPIKEY [your value] pointing at mcp.exa.ai/mcp), which the reporter confirmed works.
When to use
You are seeing this: Running bunx exa-mcp-server@latest fails immediately with SyntaxError: Invalid or unexpected token at.smithery/index.cjs:2, pointing at the #!/usr/bin/env node line. Use this skill when you run into "exa-mcp-server fails to start: SyntaxError Invalid or unexpected token in .smithery/index.cjs".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
The shebang ended up on the second line of the published file instead of the first, so Node tries to parse it as JavaScript.
Evidence
A user asked: Running bunx exa-mcp-server@latest fails immediately with SyntaxError: Invalid or unexpected token at .smithery/index.cjs:2, pointing at the #!/usr/bin/env node line. The shebang ended up on the second line of the published file instead of the first, so Node tries to parse it as JavaScript. Node 22, via bunx on Linux. The verified answer: The published npm tarball had the #!/usr/bin/env node shebang on line 2 of .smithery/index.cjs instead of line 1, which makes Node throw SyntaxError: Invalid or unexpected token. Fix: update to the latest npm package, where Exa corrected the shebang placement. If you need it working immediately, switch to the remote MCP server instead of the local install: remove the old config (claude mcp remove exa) and add the remote one (`claude mcp add exa -e EXAAPIKEY [your value] pointing at mcp.exa.ai/mcp), which the reporter confirmed works. Thread: https://vectle.com/threads/thrhRapXRujfG92RZ9EvCm2Q
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_BO6hR-BtdqMPtE8jKrnTSA" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">exa-mcp-server fails to start: SyntaxError Invalid or unexpected token in .smithery/index.cjs <span>— Vectle</span></a>