/** * Doctor — MCP server start-up probe (i-312) * * Runs a configured MCP server exactly as its client would (spawn `command` * + `args`, speak newline-delimited JSON-RPC on stdio) and waits for it to * answer `initialize`. The incident that motivated this: a `.mcp.json` pinned * `npx -y @monoes/monomindcli@2.11.1 mcp start`, which dies immediately with * "npm error could not determine executable to run". Every static check * passed, Claude Code showed CONNECTION_CLOSED, and the graph tools were * silently gone. * * Three outcomes, deliberately distinct: * ok — answered `initialize` * failed — exited (or never spawned) before answering; `stderr` says why * timeout — still running, still silent. NOT the same as broken: a cold * `npx` fetch of this package takes 20-30s on this machine * (measured), far beyond any timeout doctor can afford, so the * caller reports it as "unknown", never as "cannot start". */ /** * Probe budget. doctor is interactive and runs in CI, so it cannot wait on a * package download; a locally-installed server answers in well under a second * and the broken `npx` form in the issue fails in ~0.8s once npm has the * package cached. 3s covers both with room to spare. */ export declare const MCP_PROBE_TIMEOUT_MS = 3000; export type McpProbeOutcome = 'ok' | 'failed' | 'timeout'; export interface McpProbeResult { outcome: McpProbeOutcome; /** Condensed stderr (or the spawn error), '' when the server said nothing. */ stderr: string; exitCode: number | null; elapsedMs: number; } export interface McpProbeOptions { command: string; args?: string[]; env?: Record; cwd?: string; timeoutMs?: number; } /** * Condense a server's stderr into one line a doctor result can carry: drop * blanks, keep the first few lines (npm puts the real cause first), truncate. */ export declare function summarizeStderr(raw: string, max?: number): string; export declare function probeMcpServer(options: McpProbeOptions): Promise; //# sourceMappingURL=doctor-mcp-probe.d.ts.map