-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: add EXA_API_KEY header support for websearch_exa MCP
#499
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: add EXA_API_KEY header support for websearch_exa MCP
#499
Conversation
The remote MCP endpoint https://mcp.exa.ai/mcp requires API key authentication via x-api-key header. Without this, the connection times out waiting for auth. This change: - Reads EXA_API_KEY from environment variable - Passes it as x-api-key header when available - Updates RemoteMcpConfig type to support optional headers
|
All contributors have signed the CLA. Thank you! ✅ |
Greptile SummaryThis PR fixes authentication for the Exa MCP server by adding support for API key headers. The Key Changes:
Implementation: Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant ENV as Environment Variables
participant Config as websearch_exa.ts
participant Type as RemoteMcpConfig Type
participant Handler as config-handler.ts
participant MCP as Exa MCP Server
Note over ENV,MCP: MCP Connection Initialization Flow
ENV->>Config: Read EXA_API_KEY
Config->>Config: Check if EXA_API_KEY exists
alt EXA_API_KEY is set
Config->>Config: Set headers: { "x-api-key": EXA_API_KEY }
else EXA_API_KEY not set
Config->>Config: Set headers: undefined
end
Config->>Type: Return config object with optional headers
Note over Config,Type: Config conforms to<br/>RemoteMcpConfig interface
Handler->>Config: Call createBuiltinMcps()
Handler->>Handler: Merge builtin MCPs into config.mcp
Handler->>MCP: Connect to https://mcp.exa.ai/mcp
alt Headers present
Handler->>MCP: Include x-api-key header
MCP->>MCP: Authenticate with API key
MCP-->>Handler: Connection successful
else No headers
Handler->>MCP: Connect without headers
MCP-->>Handler: May timeout or succeed<br/>(depending on server config)
end
|
Greptile found no issues!From now on, if a review finishes and we haven't found any issues, we will not post anything, but you can confirm that we reviewed your changes in the status check section. This feature can be toggled off in your Code Review Settings by deselecting "Create a status check for each PR". |
|
I have read the CLA Document and I hereby sign the CLA |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No issues found across 2 files
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
junhoyeo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm!
EXA_API_KEY header support for websearch_exa MCP
|
Hi @raydocs, thanks for the fix! 👋 I've merged File Rename
This happened in PR #549 which restored Exa support after it was temporarily removed due to timeout issues (the exact issue your fix addresses!). Type ChangeYour original PR used
Your header fix is still the correct solution - it just needed adapting to the new file structure. Thanks for the contribution! 🙏 |
Problem
The remote MCP endpoint
https://mcp.exa.ai/mcprequires API key authentication viax-api-keyheader. Without this header, the connection hangs indefinitely waiting for authentication, eventually timing out with:Root Cause Analysis
type,url, andenabled- no auth headersapi.exa.ai) and website work fine - only MCP endpoint affectedSolution
EXA_API_KEYfrom environment variable (same as localexa-mcp-serverdoes)x-api-keyheader when availableRemoteMcpConfigtype to support optionalheadersfieldChanges
src/mcp/websearch-exa.ts
src/mcp/index.ts
headers?: Record<string, string>toRemoteMcpConfigtypeTesting
EXA_API_KEYin environment (e.g., in.zshrc)websearch_exaMCP should connect successfullyReferences
headersfield in configMcpRemoteConfig.headersfieldSummary by cubic
Add EXA API key header support to the websearch MCP to fix connection timeouts when connecting to https://mcp.exa.ai/mcp. Reads EXA_API_KEY from the environment and sends it as the x-api-key header; RemoteMcpConfig now supports optional headers.
Bug Fixes
Migration
Written for commit 156588e. Summary will update on new commits.