mcp-framework
Version:
Framework for building Model Context Protocol (MCP) servers in Typescript
14 lines (13 loc) • 744 B
TypeScript
import { IncomingMessage, ServerResponse } from 'node:http';
import { AuthConfig } from '../../auth/types.js';
/**
* Shared authentication handler for transport layers.
* Handles both API Key and OAuth authentication with proper error responses.
*
* @param req - Incoming HTTP request
* @param res - HTTP response object
* @param authConfig - Authentication configuration from transport
* @param context - Description of the context (e.g., "initialize", "message", "SSE connection")
* @returns True if authenticated, false if authentication failed (response already sent)
*/
export declare function handleAuthentication(req: IncomingMessage, res: ServerResponse, authConfig: AuthConfig | undefined, context: string): Promise<boolean>;