import { M as McpServerDataConfig } from './index-DJcrl-Jt.js'; /** * Web-standard fetch handler for the MCP server * * Creates a handler with the standard `(request: Request) => Promise` * signature, so it runs on any web-standard runtime — Cloudflare Workers, * Netlify (modern web-standard functions), Deno, Bun, and others. Because these * runtimes can't access the filesystem, this adapter requires pre-loaded docs * and search index data. * * Uses the MCP SDK's WebStandardStreamableHTTPServerTransport for proper * protocol handling with Web Standard Request/Response. * * @example * // Cloudflare Workers — src/worker.js * import { createWebRequestHandler } from 'docusaurus-plugin-mcp-server/adapters'; * import docs from '../build/mcp/docs.json'; * import searchIndex from '../build/mcp/search-index.json'; * * export default { * fetch: createWebRequestHandler({ * docs, * searchIndexData: searchIndex, * name: 'my-docs', * baseUrl: 'https://docs.example.com', * }), * }; */ /** * Config for the web-standard request handler */ interface WebRequestAdapterConfig extends McpServerDataConfig { /** CORS origin to allow. Defaults to '*' (all origins). */ corsOrigin?: string; } /** * Create a web-standard `(request: Request) => Promise` handler for * the MCP server, suitable for any web-standard runtime (Cloudflare Workers, * modern Netlify functions, Deno, Bun, etc). * * Uses the MCP SDK's WebStandardStreamableHTTPServerTransport for * proper protocol handling. */ declare function createWebRequestHandler(config: WebRequestAdapterConfig): (request: Request) => Promise; export { type WebRequestAdapterConfig, createWebRequestHandler };