fix: add EXA_API_KEY header support for websearch_exa MCP (#499)

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

Co-authored-by: Junho Yeo <i@junho.io>
This commit is contained in:
Ruirui Wan
2026-01-06 14:12:22 -07:00
committed by GitHub
parent 115e46517f
commit 7981c86613
2 changed files with 12 additions and 2 deletions

View File

@@ -5,14 +5,21 @@ import type { McpName } from "./types"
export { McpNameSchema, type McpName } from "./types"
const allBuiltinMcps: Record<McpName, { type: "remote"; url: string; enabled: boolean }> = {
type RemoteMcpConfig = {
type: "remote"
url: string
enabled: boolean
headers?: Record<string, string>
}
const allBuiltinMcps: Record<McpName, RemoteMcpConfig> = {
websearch,
context7,
grep_app,
}
export function createBuiltinMcps(disabledMcps: string[] = []) {
const mcps: Record<string, { type: "remote"; url: string; enabled: boolean }> = {}
const mcps: Record<string, RemoteMcpConfig> = {}
for (const [name, config] of Object.entries(allBuiltinMcps)) {
if (!disabledMcps.includes(name)) {

View File

@@ -2,4 +2,7 @@ export const websearch = {
type: "remote" as const,
url: "https://mcp.exa.ai/mcp?tools=web_search_exa",
enabled: true,
headers: process.env.EXA_API_KEY
? { "x-api-key": process.env.EXA_API_KEY }
: undefined,
}