import { IncomingMessage, ServerResponse, Server } from 'node:http'; import { a as McpServerConfig } from './index-DJcrl-Jt.js'; /** * Node.js adapter for MCP server * * Creates a standalone HTTP server for local development and testing. * * @example * ```typescript * import { createNodeServer } from 'docusaurus-plugin-mcp-server/adapters/node'; * * const server = createNodeServer({ * docsPath: './build/mcp/docs.json', * indexPath: './build/mcp/search-index.json', * name: 'my-docs', * }); * * server.listen(3456, () => { * console.log('MCP server running at http://localhost:3456'); * }); * ``` */ /** * Options for the Node.js MCP server. * * Accepts the same config as {@link McpDocsServer} — either file paths * (`docsPath`/`indexPath`, the usual local-dev case) or pre-loaded * `docs`/`searchIndexData` — plus a CORS override. */ type NodeServerOptions = McpServerConfig & { /** * CORS origin to allow. Defaults to '*' (all origins). * Set to a specific origin or false to disable CORS headers. */ corsOrigin?: string | false; }; /** * Create a Node.js request handler for the MCP server. * * This returns a handler function compatible with `http.createServer()`. * For a complete server, use `createNodeServer()` instead. */ declare function createNodeHandler(options: NodeServerOptions): (req: IncomingMessage, res: ServerResponse) => Promise; /** * Create a complete Node.js HTTP server for the MCP server. * * This is the simplest way to run an MCP server locally for development. */ declare function createNodeServer(options: NodeServerOptions): Server; export { type NodeServerOptions, createNodeHandler, createNodeServer };