import { type LocalStore } from "../local-files/store.js"; import { type McpErrorResult, type McpToolResult } from "./handlers.js"; import { NotificationDispatcher, type NotificationSink } from "./notifications.js"; import { SessionRegistry, type SessionRegistryOptions } from "./sessions.js"; import { type McpToolDescriptor } from "./tools.js"; import { type H2aRunDelegation, type H2aRunExecutor } from "./agent-launch.js"; export interface CreateMcpServerOptions { /** Filesystem root for the backing local-files store. */ root: string; /** Workspace boundary captured when the local MCP server starts. */ workspaceRoot?: string; /** Test seam for the canonical h2a run subprocess bridge. */ runExecutor?: H2aRunExecutor; /** Trusted context of this MCP sidecar, read only when a launch occurs. */ delegationContext?: () => H2aRunDelegation | undefined; /** * Optional pre-built store. If omitted, the server creates one with * `createLocalStore({ root })`. Useful for tests that want to share state * with the CLI. */ store?: LocalStore; /** * Optional SessionRegistry overrides. Disabled `autoHeartbeat` is the * sane default for in-process tests; the stdio transport enables it. */ sessions?: SessionRegistryOptions; /** * Optional NotificationDispatcher overrides. The stdio transport installs * the sink; tests can drive `dispatcher.tick()` manually. */ notifications?: { intervalMs?: number; sink?: NotificationSink; }; } export interface McpServer { listTools(): McpToolDescriptor[]; callTool(name: string, args: Record | undefined): McpToolResult | McpErrorResult | McpTransportResult; /** Per-server SessionRegistry, exposed for transport-layer shutdown hooks. */ readonly sessions: SessionRegistry; /** Per-server NotificationDispatcher (DEC-052). */ readonly notifications: NotificationDispatcher; } /** A tool result already formatted for the MCP transport (used by Track reads). */ export interface McpTransportResult { [key: string]: unknown; content: Array<{ type: "text"; text: string; }>; isError?: boolean; } export declare function isMcpTransportResult(value: unknown): value is McpTransportResult; /** * Build an in-process MCP server backed by the local-files runtime. * * This is intentionally NOT a JSON-RPC / stdio transport. It exposes a * minimal `{ listTools, callTool }` surface so the same dispatch can be * unit-tested today and wrapped in a real MCP transport in a later slice. */ export declare function createMcpServer(options: CreateMcpServerOptions): McpServer; //# sourceMappingURL=server.d.ts.map