/** * `/api/v1/mcp-inspect` — the MCP inspector bridge (DES-MCP-INSPECTOR-001 §3). * * - `POST /mcp-inspect/sessions {target}` (HUMAN-only): connect and run the handshake. `201` with * the session (its state may be `failed`, with the server's stderr in the log). `409 * secret_missing` for a registry server whose secret resolves to nothing (never connected * unauthenticated); `429` past {@link MAX_SESSIONS}. * - `POST /mcp-inspect/sessions/:id/rpc {method, params?}` (HUMAN-only): one allowed request, its * answer (`504` after 60 s; a late answer still lands in the log). * - `GET /mcp-inspect/sessions/:id/log?after=&wait=` (operator, set explicitly: a GET is otherwise * observer): a long poll of the log ring. * - `DELETE /mcp-inspect/sessions/:id` (HUMAN-only): close it. Restart = delete, then start again. * * A stdio command runs as the daemon's user with the SDK's safe inherited env plus exactly the env * the operator typed (and, for a registry server, its ONE secret variable). Human-only is the * editors' rule: under `auth=off` every same-uid caller is the local human (DES-EDITOR §6.4). */ import type { FastifyInstance } from 'fastify'; import type { McpUpstreamConfig } from '../mcp/probe.js'; import { type McpCallTarget } from '../mcp/registry.js'; import { InspectSessions, type OpenedTransport } from './session.js'; /** What the bridge needs of crew's MCP registry: a server's config and its secret, at connect. */ export interface InspectRegistry { inspectTarget(name: string): Promise; callSecret(config: McpUpstreamConfig): Promise<{ secret: string | null; missing: boolean; }>; /** The broker's resolution of one tool (data connectors G1: a write tool is callable only once a human granted it). */ resolveCall(server: string, tool: string): Promise | null>; } /** A resolved connection: what to open, and what to scrub. */ export interface ConnectSpec { kind: 'stdio' | 'streamable-http' | 'sse'; command?: string; args?: string[]; env?: Record; cwd?: string; url?: string; headers?: Record; } export type TransportOpener = (spec: ConnectSpec) => OpenedTransport; /** The real opener: the SDK's transports. */ export declare const openTransport: TransportOpener; export interface InspectRoutesDeps { /** Absent: no MCP registry on this daemon, so `{server}` targets answer 404. */ registry?: InspectRegistry; open?: TransportOpener; sessions?: InspectSessions; /** Tests only: the per-call deadline (default 60 s). */ callTimeoutMs?: number; log?: (msg: string) => void; } export declare function registerMcpInspectRoutes(app: FastifyInstance, deps: InspectRoutesDeps): InspectSessions; //# sourceMappingURL=routes.d.ts.map