import { LoadContext, Plugin } from '@docusaurus/types'; import { b as McpServerPluginOptions, a as McpServerConfig, F as FlexSearchConfig, C as ContentIndexer, S as SearchProvider } from './index-DJcrl-Jt.js'; export { D as DEFAULT_PLUGIN_OPTIONS, c as DocHeading, d as DocsFetchParams, e as DocsSearchParams, f as McpManifest, M as McpServerDataConfig, g as McpServerFileConfig, P as ProcessedDoc, h as ProviderContext, i as SearchOptions, j as SearchProviderInitData, k as SearchResult } from './index-DJcrl-Jt.js'; import { IncomingMessage, ServerResponse } from 'node:http'; import { z } from 'zod'; /** * Docusaurus plugin that generates MCP server artifacts during build */ declare function mcpServerPlugin(context: LoadContext, options: McpServerPluginOptions): Plugin; /** * MCP Server for documentation * * This class provides the MCP server implementation that can be used * with any HTTP framework (Express, Vercel, Cloudflare Workers, etc.) * * Supports two modes: * - File-based: Load docs and search index from filesystem (Node.js) * - Pre-loaded: Accept docs and search index data directly (Workers) * * Uses the official MCP SDK for proper protocol handling. */ declare class McpDocsServer { private config; private searchProvider; private initialized; private initPromise; private initError; constructor(config: McpServerConfig); /** * Create a fresh McpServer instance with tools registered. * Each request gets its own server to avoid concurrency issues * with the SDK's transport reassignment. */ private createMcpServer; /** * Register all MCP tools using definitions from tool files */ private registerTools; /** * Get a document by URL using the search provider */ private getDocument; /** * Load docs and search index using the configured search provider * * For file-based config: reads from disk * For data config: uses pre-loaded data directly * * Uses promise-based locking to prevent concurrent initialization. * Caches initialization errors so repeated calls fail fast. */ initialize(): Promise; private _doInitialize; /** * Handle an HTTP request using the MCP SDK's transport * * This method is designed for serverless environments (Vercel, Netlify). * Creates a fresh McpServer per request to avoid concurrency issues. * * @param req - Node.js IncomingMessage or compatible request object * @param res - Node.js ServerResponse or compatible response object * @param parsedBody - Optional pre-parsed request body */ handleHttpRequest(req: IncomingMessage, res: ServerResponse, parsedBody?: unknown): Promise; /** * Handle a Web Standard Request (Cloudflare Workers, Deno, Bun) * * This method is designed for Web Standard environments that use * the Fetch API Request/Response pattern. * Creates a fresh McpServer per request to avoid concurrency issues. * * @param request - Web Standard Request object * @returns Web Standard Response object */ handleWebRequest(request: Request): Promise; /** * Get server status information * * Useful for health checks and debugging */ getStatus(): Promise<{ name: string; version: string; initialized: boolean; docCount: number; baseUrl?: string; searchProvider?: string; }>; } type ServerUrlBase = 'origin' | 'site'; interface ResolveServerUrlInput { siteUrl: string; baseUrl: string; outputDir: string; server: { url?: string; urlBase?: ServerUrlBase; }; } /** * Resolve the public MCP endpoint URL for the install button and globalData. * * - `server.url` — use an explicit endpoint when MCP is hosted elsewhere. * - `server.urlBase: 'origin'` (default) — `{siteUrl}/{outputDir}`. * - `server.urlBase: 'site'` — under the Docusaurus base path, e.g. `{siteUrl}{baseUrl}{outputDir}`. */ declare function resolveServerUrl(input: ResolveServerUrlInput): string; /** * Options forwarded to the built-in 'flexsearch' indexer/provider. * Ignored for custom specifiers. */ interface BuiltinIndexerOptions { flexsearch?: FlexSearchConfig; } /** * Load an indexer by name or module path. * * @param specifier - Either 'flexsearch' for the built-in indexer, or a module path * (relative path like './my-indexer.js' or npm package like '@myorg/indexer') * @param builtinOptions - Options passed to the built-in indexer constructor (ignored for custom specifiers) * @returns Instantiated ContentIndexer * * @example * ```typescript * // Built-in with overrides * const indexer = await loadIndexer('flexsearch', { flexsearch: { tokenize: 'strict' } }); * * // Custom relative path * const indexer = await loadIndexer('./src/providers/algolia-indexer.js'); * ``` */ declare function loadIndexer(specifier: string, builtinOptions?: BuiltinIndexerOptions): Promise; /** * Load a search provider by name, module path, or instance. * * @param specifier - 'flexsearch' for the built-in provider, a module path to * dynamically import, or a {@link SearchProvider} instance. * Pass an instance when running in a bundled environment * where dynamic `import()` of arbitrary specifiers is not * available (e.g. Cloudflare Workers). * @param builtinOptions - Options passed to the built-in provider constructor (ignored otherwise) * @returns Instantiated SearchProvider * * @example * ```typescript * // Built-in with overrides * const provider = await loadSearchProvider('flexsearch', { flexsearch: { tokenize: 'strict' } }); * * // Pre-instantiated (Workers / bundled environments) * const provider = await loadSearchProvider(new MyProvider()); * ``` */ declare function loadSearchProvider(specifier: string | SearchProvider, builtinOptions?: BuiltinIndexerOptions): Promise; /** * Tool definition for docs_search */ declare const docsSearchTool: { name: string; description: string; inputSchema: { query: z.ZodString; limit: z.ZodDefault>; }; }; /** * Tool definition for docs_fetch */ declare const docsFetchTool: { name: string; description: string; inputSchema: { url: z.ZodString; }; }; export { type BuiltinIndexerOptions, ContentIndexer, FlexSearchConfig, McpDocsServer, McpServerConfig, McpServerPluginOptions, type ResolveServerUrlInput, SearchProvider, type ServerUrlBase, mcpServerPlugin as default, docsFetchTool, docsSearchTool, loadIndexer, loadSearchProvider, mcpServerPlugin, resolveServerUrl };