UNPKG

xmcp

Version:

The TypeScript MCP framework

17 lines (16 loc) • 770 B
import type { WebMiddleware } from "@/types/middleware"; type StaticApiKeyConfig = { /** The static API key to validate against */ apiKey: string; /** Optional header name to read the API key from. Defaults to 'x-api-key' */ headerName?: string; }; type CustomValidationConfig = { /** Optional header name to read the API key from. Defaults to 'x-api-key' */ headerName?: string; /** Custom validation function that receives the API key and returns a Promise<boolean> */ validateApiKey: (key: string) => Promise<boolean>; }; export declare function cloudflareApiKeyAuthMiddleware(config: StaticApiKeyConfig): WebMiddleware; export declare function cloudflareApiKeyAuthMiddleware(config: CustomValidationConfig): WebMiddleware; export {};