Skip to content

Commit 7981c86

Browse files
raydocsjunhoyeo
andauthored
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 <[email protected]>
1 parent 115e465 commit 7981c86

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/mcp/index.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,21 @@ import type { McpName } from "./types"
55

66
export { McpNameSchema, type McpName } from "./types"
77

8-
const allBuiltinMcps: Record<McpName, { type: "remote"; url: string; enabled: boolean }> = {
8+
type RemoteMcpConfig = {
9+
type: "remote"
10+
url: string
11+
enabled: boolean
12+
headers?: Record<string, string>
13+
}
14+
15+
const allBuiltinMcps: Record<McpName, RemoteMcpConfig> = {
916
websearch,
1017
context7,
1118
grep_app,
1219
}
1320

1421
export function createBuiltinMcps(disabledMcps: string[] = []) {
15-
const mcps: Record<string, { type: "remote"; url: string; enabled: boolean }> = {}
22+
const mcps: Record<string, RemoteMcpConfig> = {}
1623

1724
for (const [name, config] of Object.entries(allBuiltinMcps)) {
1825
if (!disabledMcps.includes(name)) {

src/mcp/websearch.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ export const websearch = {
22
type: "remote" as const,
33
url: "https://mcp.exa.ai/mcp?tools=web_search_exa",
44
enabled: true,
5+
headers: process.env.EXA_API_KEY
6+
? { "x-api-key": process.env.EXA_API_KEY }
7+
: undefined,
58
}

0 commit comments

Comments
 (0)