@ultimatelemon-eu/mcp-http 2.1.0 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -53,7 +53,8 @@ With `apiKey` set, every request to `/mcp` must carry the caller's own key for
53
53
  the upstream API, in `X-Api-Key` or as `Authorization: Bearer <key>`
54
54
  (`X-Api-Key` wins when both are present). Without one the server answers 401
55
55
  before building an MCP server. The key reaches `createMcpServer` as
56
- `apiKey`; it is never logged or stored.
56
+ `apiKey`; it is never logged or stored. Other per-caller settings can travel
57
+ as headers of their own, read from `headers` in the same context.
57
58
 
58
59
  This suits public servers where each user brings their own credentials: no
59
60
  OAuth, no sessions, no database. In claude.ai, add the connector with
package/dist/server.d.ts CHANGED
@@ -6,6 +6,8 @@ export interface Logger {
6
6
  export interface RequestContext {
7
7
  /** The caller's own key for the upstream API. Set when `apiKey` is configured. */
8
8
  apiKey?: string;
9
+ /** Headers of the HTTP request, for per-caller settings beyond the key. */
10
+ headers: Headers;
9
11
  }
10
12
  export interface ApiKeyOptions {
11
13
  /** Added to the 401 message, e.g. where to get a key. */
package/dist/server.js CHANGED
@@ -82,7 +82,10 @@ export async function startMcpHttpServer(options) {
82
82
  const healthPaths = new Set([`${base}/healthz`, '/healthz']);
83
83
  // The key travels as pass-through authInfo, the SDK's channel from the
84
84
  // HTTP request to the per-request factory.
85
- const mcpHandler = createMcpHandler(({ authInfo }) => options.createMcpServer(authInfo ? { apiKey: authInfo.token } : {}), {
85
+ const mcpHandler = createMcpHandler(({ authInfo, requestInfo }) => options.createMcpServer({
86
+ ...(authInfo ? { apiKey: authInfo.token } : {}),
87
+ headers: requestInfo?.headers ?? new Headers()
88
+ }), {
86
89
  onerror: (error) => {
87
90
  logger.error({ err: String(error) }, 'mcp request failed');
88
91
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ultimatelemon-eu/mcp-http",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "Run an MCP server over stateless Streamable HTTP: /mcp, /healthz, a base path for proxies, the caller's own API key per request, and errors that never leak a stack trace.",
5
5
  "license": "MIT",
6
6
  "repository": {