/** * Server factory (Fase 3 Bloque 2). Builds the McpServer, registers the ~47 * read-only data tools (with `readOnlyHint` and retained handles, RF-3206) and the * write-path setup tools, and wires the relaxed startup gate (RF-3202) + dynamic * read-only enablement after provisioning (RF-3202b). * * Extracted from index.ts so it can be unit-tested without a stdio transport: * tests inspect `readOnlyHandles[].enabled` and invoke `setupTools[].handler`. */ import { McpServer, type RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js"; import { SealMetricsClient } from "./client.js"; import { type ToolDef } from "./tools/index.js"; import { type SetupContext, type SetupToolDef } from "./tools/setup.js"; export interface BuildServerOptions { /** Read-only api_key. Omit to start in setup-only mode (RF-3202). */ apiKey?: string; baseUrl: string; provisionKey: string; version: string; /** Project root if known (editors); undefined in Desktop chat. */ cwd?: string; installSource?: string; pollDefaults?: { intervalMs?: number; timeoutMs?: number; }; now?: () => number; sleep?: (ms: number) => Promise; /** * Transport gate for the remote (Streamable HTTP) entrypoint: * - `omitSetupTools` (VAL-RMT11): the write-path/setup tools are not * registered — remote connections are read-only. * - `excludeReadOnlyTools` (RF-RMT25): tools whose API endpoints require * scopes a modern api_key cannot carry are not listed remotely. * Both default to the local stdio behavior (everything registered). */ omitSetupTools?: boolean; excludeReadOnlyTools?: ReadonlySet; /** * Additional read-only tools registered with the same pipeline as ALL_TOOLS * (B6: the remote entrypoint appends the ChatGPT-compat `search`/`fetch`). */ extraReadOnlyTools?: ToolDef[]; /** * Public URL of the server icon (MCP spec 2025-11 `icons` metadata). Clients * that support it render the logo instead of name initials. */ iconUrl?: string; /** * Site injected into every read-only tool call that doesn't pass one. The * remote transport sets it to the OAuth grant's site (one site per * connection, Decision 6) so the model never needs list_sites to start. */ defaultSiteId?: string; } export interface BuiltServer { server: McpServer; client: SealMetricsClient; readOnlyHandles: RegisteredTool[]; setupTools: SetupToolDef[]; setupContext: SetupContext; enableReadOnlyTools: () => void; } export declare function buildServer(opts: BuildServerOptions): BuiltServer; //# sourceMappingURL=server.d.ts.map