import { t as McpFetchHandler } from "../mcp-resource-server-C4RxIuQl.mjs"; import { a as McpCorsOptions, c as McpHttpSecurityOptions, d as corsAllowedOrigin, f as hardenMcpFetch, g as resolveMcpHttpSecurity, h as mcpHttpSecurityRejection, i as MCP_DEFAULT_MAX_BODY_BYTES, l as McpHttpSecurityPolicy, m as limitMcpRequestBody, n as MCP_CORS_EXPOSED_HEADERS, o as McpHardenHooks, p as isMcpHttpSecurityPolicy, r as MCP_CORS_METHODS, s as McpHardenedServer, t as MCP_CORS_ALLOWED_HEADERS, u as applyMcpCorsHeaders } from "../mcp-http-security-BXpPP1E-.mjs"; import { NodeMcpRequestHandler } from "@modelcontextprotocol/node"; import { HostHeaderValidationResult, McpHandlerRequestOptions, OriginValidationResult, hostHeaderValidationResponse, localhostAllowedHostnames, localhostAllowedOrigins, originValidationResponse, validateHostHeader, validateOriginHeader } from "@modelcontextprotocol/server"; //#region src/security/mcp-request-validation.d.ts interface McpRequestValidationOptions { /** Hostnames only; do not include ports or schemes. */ readonly allowedHostnames: readonly string[]; /** Origin hostnames only. A missing Origin header is accepted by the official validator. */ readonly allowedOriginHostnames: readonly string[]; /** CORS handling for admitted origins; defaults to on (origin validation is always on here). */ readonly cors?: McpCorsOptions | boolean; /** Request-body byte cap; defaults to 1 MiB, matching the runtime. `false` disables it. */ readonly maxBodyBytes?: number | false; } /** * Explicit Host and Origin validation ahead of an MCP fetch handler. This * facade owns the full pre-dispatch posture — host/origin validation, the body * cap, and CORS decoration — so composing it never silently drops the runtime's * default protections for the requests it admits. */ declare class McpValidatedServer implements McpFetchHandler { #private; readonly notify: McpFetchHandler["notify"]; readonly bus: McpFetchHandler["bus"]; constructor(handler: McpFetchHandler, options: McpRequestValidationOptions); get policy(): McpHttpSecurityPolicy; fetch(request: Request, options?: McpHandlerRequestOptions): Promise; close(): Promise; } //#endregion //#region src/security/mcp-node-body-limit.d.ts type McpNodeBodyLimit = number | McpHttpSecurityPolicy | undefined; /** * Caps the raw Node request body before the SDK's `toWebRequest` buffers it * unbounded. Skips requests the platform already parsed and bodyless methods. * On overflow it answers `413` (with CORS headers when a policy is supplied) * and never invokes the wrapped handler; on success the buffered bytes are * replayed through the request's own async iterator so `req.auth` and other * platform decorations survive. * * Stream errors during the read (e.g. a peer aborting mid-upload) are captured * and re-thrown from the replay iterator, so the wrapped SDK adapter keeps * ownership of them through its own `try/catch → onerror → 500` path rather * than rejecting the returned promise (which would be an unhandled rejection * on fire-and-forget mounts). */ declare function withMcpNodeBodyLimit(handler: NodeMcpRequestHandler, limit: McpNodeBodyLimit, hooks?: McpHardenHooks): NodeMcpRequestHandler; //#endregion export { type HostHeaderValidationResult, MCP_CORS_ALLOWED_HEADERS, MCP_CORS_EXPOSED_HEADERS, MCP_CORS_METHODS, MCP_DEFAULT_MAX_BODY_BYTES, type McpCorsOptions, type McpHardenHooks, McpHardenedServer, type McpHttpSecurityOptions, type McpHttpSecurityPolicy, type McpNodeBodyLimit, type McpRequestValidationOptions, McpValidatedServer, type OriginValidationResult, applyMcpCorsHeaders, corsAllowedOrigin, hardenMcpFetch, hostHeaderValidationResponse, isMcpHttpSecurityPolicy, limitMcpRequestBody, localhostAllowedHostnames, localhostAllowedOrigins, mcpHttpSecurityRejection, originValidationResponse, resolveMcpHttpSecurity, validateHostHeader, validateOriginHeader, withMcpNodeBodyLimit }; //# sourceMappingURL=index.d.mts.map