/** * QMD MCP Server - Model Context Protocol server for QMD * * Exposes QMD search and document retrieval as MCP tools and resources. * Documents are accessible via qmd:// URIs. * * Follows MCP spec 2025-06-18 for proper response types. */ /** * Periodically check this MCP process's RSS and exit cleanly when it * crosses a configurable ceiling, so the parent (Claude Code stdio * client, pm2, systemd, etc.) can respawn a fresh process. Contains * the blast radius of memory leaks in the search/expansion path * without requiring a full re-architecture. * * Configuration: * QMD_MCP_RSS_LIMIT_BYTES — ceiling in bytes. Default 0 (disabled). * Set to e.g. `2147483648` (2 GiB) to opt in. * QMD_MCP_RSS_CHECK_INTERVAL_MS — poll interval. Default 60000 (60s). * * Default-off so we can ship the diagnostic + pragma fix safely and * graduate the supervisor on once we have soak data showing no * false positives. Operators can opt in immediately by exporting * `QMD_MCP_RSS_LIMIT_BYTES=2147483648` in their MCP launcher env. */ export type RssSupervisorHandle = { stop: () => void; /** Snapshot the most recent RSS reading (test hook). */ lastRss: () => number; }; export interface RssSupervisorOptions { /** RSS ceiling in bytes. 0 disables. */ limitBytes?: number; /** Polling cadence in ms. Default 60000. */ intervalMs?: number; /** Override RSS reader for tests. */ readRss?: () => number; /** Override exit hook for tests. */ onExceeded?: (rss: number, limit: number) => void; /** Override stderr writer for tests. */ log?: (line: string) => void; } export declare function startRssSupervisor(opts?: RssSupervisorOptions): RssSupervisorHandle | null; export declare function startMcpServer(): Promise; export type HttpServerHandle = { httpServer: import("http").Server; port: number; stop: () => Promise; }; /** * Start MCP server over Streamable HTTP (JSON responses, no SSE). * Binds to localhost only. Returns a handle for shutdown and port discovery. */ export declare function startMcpHttpServer(port: number, options?: { quiet?: boolean; }): Promise;