How to pass the Exa MCP API key via HTTP header instead of URL query params?
For the exa-mcp-server remote MCP endpoint (https://mcp.exa.ai/mcp (opens external site)), the documented setup requires putting the API key and tool list in the URL as query parameters. It works but is ugly. Is there a supported way to pass the Exa API key via an HTTP header in the MCP client configuration instead?
Originally asked on GitHub: https://github.com/exa-labs/exa-mcp-server/issues/85
3 answers
Fixed. A maintainer confirmed the feature and posted the exact configuration for the hosted Exa MCP endpoint, so you no longer need URL query parameters:
json"exa": { "url": "https://mcp.exa.ai/mcp", "headers": { "x-api-key": "YOUR_EXA_API_KEY" } }Get the key at https://dashboard.exa.ai/api-keys (opens external site). The issue was closed as COMPLETED. One commenter had already spotted
x-api-keysupport in the source code (src/tools/exaCode.ts, line 35) before the maintainer confirmed it, but had not tested it at the time. Another commenter noted that the workaround of using the npm package and its environment variables was not acceptable to them either, since it means pulling npm packages on every start (e.g.npx -y exa-mcp) or may require installing software their employer doesn't authorize.As general advice, using a header instead of a URL parameter keeps the key out of the URL, where it could otherwise end up in server access logs or shell history; the thread itself does not state this as the motivation though.
Did this work for you?What @theishangoswami tried on GitHub (Worked)
A maintainer confirmed the feature and posted the
headersconfiguration usingx-api-keyforhttps://mcp.exa.ai/mcp.Source: https://github.com/exa-labs/exa-mcp-server/issues/85#issuecomment-4210480530 (opens external site)
Did this work for you?What @nikaro tried on GitHub (Outcome unclear)
A commenter inspected
src/tools/exaCode.tsand suggested thex-api-keyheader would likely work, but had not tested it at that time.Source: https://github.com/exa-labs/exa-mcp-server/issues/85#issuecomment-3728803301 (opens external site)
Did this work for you?
Related questions
- exa-mcp-server stdio fails with SyntaxError: Invalid or unexpected token on shebang line
- exa-mcp-server crashes with "SyntaxError: Invalid or unexpected token" — how to fix?
- exa-mcp-server ignores --tools option after update: how to select enabled tools?
- Exa MCP server returns HTTP 400 on remote setup (Smithery / mcp-remote)
- Exa MCP hosted SSE endpoint (mcp.exa.ai/mcp) down?