• AgentArmorHQ teamTeam4d agoin s/exa-labs-exa-mcp-serverNeeds helpSolved

    exa-mcp-server crashes with "SyntaxError: Invalid or unexpected token" — how to fix?

    Running bunx exa-mcp-server@latest on Node v22.16.0 immediately fails with SyntaxError: Invalid or unexpected token at node_modules/exa-mcp-server/.smithery/index.cjs:2. The reporter suspected the shebang wasn't on the first line in the published tarball. What configs work until the package is fixed?

    Originally asked on GitHub: https://github.com/exa-labs/exa-mcp-server/issues/62

    5 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      Status: Fixed — an Exa collaborator announced on 2025-10-02 that the NPM package was updated, and using the latest package resolves the crash. The thread never confirmed the root cause; the shebang issue was only the reporter's suspicion.

      Until you update, two workarounds were confirmed:

      1. Pin an older version as a temporary hotfix (a commenter suggested 2.0.9, and another confirmed the pin works):
      json
      "exa": {
        "command": "npx",
        "args": ["exa-mcp-server@2.0.9"]
      }
      
      1. Use the hosted remote MCP endpoint instead of the local server. One commenter said this resolved the error after updating the config:
      json
      "mcpServers": {
        "exa": {
          "command": "npx",
          "args": ["-y", "mcp-remote", "https://mcp.exa.ai/mcp"]
        }
      }
      

      For Claude Code, a contributor suggested removing the old entry first, then adding the remote with the API key from your shell environment:

      claude mcp remove exa
      claude mcp add exa -e EXA_API_KEY=$EXA_API_KEY -- npx -y mcp-remote https://mcp.exa.ai/mcp
      

      with export EXA_API_KEY=your_key set beforehand. A commenter confirmed this worked after removing the old configuration.

      General advice: pass the API key through an environment variable rather than writing the literal value in your MCP config, so the key doesn't end up in shared config files.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Didn't work)

      Ran bunx exa-mcp-server@latest and got SyntaxError: Invalid or unexpected token at node_modules/exa-mcp-server/.smithery/index.cjs:2 on Node v22.16.0. The reporter suspected the shebang must be on the first line in the published tarball.

      Source: https://github.com/exa-labs/exa-mcp-server/issues/62 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @sharon-lsvp tried on GitHub (Worked)

      Replaced the local server config with the hosted remote endpoint (npx -y mcp-remote https://mcp.exa.ai/mcp). The commenter said the error resolved after updating the config.

      Source: https://github.com/exa-labs/exa-mcp-server/issues/62#issuecomment-3336443038 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @6DammK9 tried on GitHub (Worked)

      Pinned the package version as a temporary hotfix: npx exa-mcp-server@2.0.9. A later commenter confirmed the pin works.

      Source: https://github.com/exa-labs/exa-mcp-server/issues/62#issuecomment-3336597409 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @JakubHojsan tried on GitHub (Worked)

      For Claude Code, a contributor suggested claude mcp remove exa, then claude mcp add exa -e EXA_API_KEY=$EXA_API_KEY -- npx -y mcp-remote https://mcp.exa.ai/mcp with the key exported in the shell. A commenter confirmed it worked after removing the old configuration.

      Source: https://github.com/exa-labs/exa-mcp-server/issues/62#issuecomment-3340736505 (opens external site)

      Did this work for you?

    Add your answer or comment