Skip to content

Commit 65c1b2a

Browse files
committed
feat(mcp): support custom base URLs via environment variables
The MCP server hardcodes `api.helicone.ai` as the API base URL, which makes it unusable for EU customers whose data lives on `eu.api.helicone.ai`. Add support for `HELICONE_BASE_URL` and `HELICONE_AI_GATEWAY_BASE_URL` environment variables so users can point the MCP server at the correct regional endpoint.
1 parent d7d8b4b commit 65c1b2a

File tree

2 files changed

+35
-4
lines changed

2 files changed

+35
-4
lines changed

helicone-mcp/README.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ A Model Context Protocol (MCP) server for querying Helicone observability platfo
1212
"command": "npx",
1313
"args": ["@helicone/mcp@latest"],
1414
"env": {
15-
"HELICONE_API_KEY": "sk-helicone-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx"
15+
"HELICONE_API_KEY": "sk-helicone-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx",
16+
"HELICONE_BASE_URL": "https://api.helicone.ai"
1617
}
1718
}
1819
}
@@ -66,6 +67,36 @@ Query sessions with search, time range filtering, and advanced filters.
6667

6768
Both tools support full filter capabilities including model/provider, status/error, time, cost/latency, custom properties, and complex AND/OR combinations.
6869

69-
## API Key
70+
## Configuration
71+
72+
### API Key
7073

7174
Get your API key from [Settings → API Keys](https://us.helicone.ai/settings/api-keys) (or for [EU](https://eu.helicone.ai/settings/api-keys)) and set it as `HELICONE_API_KEY` in your MCP configuration.
75+
76+
### Environment Variables
77+
78+
| Variable | Default | Description |
79+
|---|---|---|
80+
| `HELICONE_API_KEY` | *(required)* | Your Helicone API key |
81+
| `HELICONE_BASE_URL` | `https://api.helicone.ai` | Base URL for the Helicone API. Set to `https://eu.api.helicone.ai` for EU users. |
82+
| `HELICONE_AI_GATEWAY_BASE_URL` | `https://ai-gateway.helicone.ai` | Base URL for the AI Gateway. |
83+
84+
### EU Configuration
85+
86+
For EU users, set `HELICONE_BASE_URL` to point to the EU API endpoint:
87+
88+
```json
89+
{
90+
"mcpServers": {
91+
"helicone": {
92+
"type": "stdio",
93+
"command": "npx",
94+
"args": ["@helicone/mcp@latest"],
95+
"env": {
96+
"HELICONE_API_KEY": "sk-helicone-eu-xxxxxxx-xxxxxxx-xxxxxxx-xxxxxxx",
97+
"HELICONE_BASE_URL": "https://eu.api.helicone.ai"
98+
}
99+
}
100+
}
101+
}
102+
```

helicone-mcp/src/lib/helicone-client.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ type SessionQueryParams = components["schemas"]["SessionQueryParams"];
55
type HeliconeRequest = components["schemas"]["HeliconeRequest"];
66
type SessionResult = components["schemas"]["SessionResult"];
77

8-
const HELICONE_API_BASE = "https://api.helicone.ai";
9-
const HELICONE_AI_GATEWAY_BASE = "https://ai-gateway.helicone.ai";
8+
const HELICONE_API_BASE = process.env.HELICONE_BASE_URL || "https://api.helicone.ai";
9+
const HELICONE_AI_GATEWAY_BASE = process.env.HELICONE_AI_GATEWAY_BASE_URL || "https://ai-gateway.helicone.ai";
1010
const REQUEST_BODY_CACHE = new Map<string, { request?: any; response?: any }>();
1111
const CACHE_MAX_SIZE = 10000;
1212

0 commit comments

Comments
 (0)