Provides HTTP auth headers for internal fetches using async local storage.
// Source: https://github.com/diegosouzapw/OmniRoute | License: MIT | Copyright 2026 diegosouzapw
// Provided via justclaw.it.com; keep this notice with the code.
import { AsyncLocalStorage } from "node:async_hooks";
type McpHttpAuthContext = {
authorization?: string;
cookie?: string;
xApiKey?: string;
anthropicVersion?: string;
};
/**
* Minimal shape of the MCP SDK's `AuthInfo` (server/auth/types.ts) that
* `httpTransport.ts` passes into `transport.handleRequest(req, { authInfo })`
* so per-tool-call `extra.authInfo` — and therefore
* `scopeEnforcement.ts::resolveCallerScopeContext` — sees the caller's real
* per-key scopes instead of falling back to the `OMNIROUTE_MCP_SCOPES` env var.
*/
export type McpCallerAuthInfo = {
token: string;
clientId: string;
scopes: stri
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key