histoire
Version:
A fast story book powered by Vite
21 lines • 1.29 kB
TypeScript
import type { IncomingMessage, ServerResponse } from 'node:http';
/** Transport policy shared by separate local dev and mounted production listeners. */
export interface McpHttpPolicy {
/** Local allows absent token; protected production requires one. */
mode: 'dev-local' | 'protected-node';
/** Canonical public endpoint origin, never derived from forwarded headers. */
origin: string;
/** Exact mounted MCP path, including deployment base. */
path: string;
/** Optional local or required production machine credential. */
token?: string;
/** Controller-local or verified machine identity for operation ownership. */
principal: string;
}
/** Writes small constant diagnostics that cannot echo request input or credentials. */
export declare function rejectMcpHttp(response: ServerResponse, status: number, message: string): false;
/** Validates canonical policy once; this server does not trust proxy-derived origins. */
export declare function validateMcpHttpPolicy(policy: McpHttpPolicy): URL;
/** Requires exact Host and browser Origin; native clients without Origin remain allowed. */
export declare function guardMcpHttp(request: IncomingMessage, response: ServerResponse, policy: McpHttpPolicy): boolean;
//# sourceMappingURL=http-guards.d.ts.map