import "./rolldown-runtime-ClRpJifh.mjs"; import { t as MCPToolScope } from "./scope-DAMZk6NH.mjs"; import { a as ToolPolicy } from "./metadata-wIwpLpn-.mjs"; import { Hono } from "hono"; import { McpServer } from "@modelcontextprotocol/server"; import { Server } from "node:http"; //#region src/result.d.ts type MCPContent = { type: 'text'; text: string; } | { type: 'image'; data: string; mimeType: string; }; type MCPResult = { content: MCPContent[]; isError?: boolean; }; declare const MAX_RESULT_BYTES = 900000; declare function resultTooLargeMessage(kind: string, bytes: number, hint: string): string; declare function ok(data: unknown, toolName?: string): MCPResult; declare function fail(e: unknown): MCPResult; //#endregion //#region src/tool/registration.d.ts type RPCSender = (body: Record) => Promise; /** Who sends a session's tool calls: any MCP client, or an ACP or Pi harness chat in the app. */ declare const MCP_AGENT_KINDS: readonly ["mcp", "acp", "harness"]; type MCPAgentKind = (typeof MCP_AGENT_KINDS)[number]; /** The session tool calls come from, so the app can show the client as an agent at work. */ interface MCPAgentSession { id: string; kind: MCPAgentKind; } interface RegisterToolsOptions { policy: ToolPolicy; mcpRoot?: string | null; sendRPC: RPCSender; agentSession?: MCPAgentSession; } declare function registerTools(mcpServer: McpServer, options: RegisterToolsOptions): void; //#endregion //#region src/server.d.ts declare const MCP_VERSION: string; interface ServerOptions { /** TCP port for the HTTP + WebSocket server. Ignored when `withTcp` is false. When set to 0 with `withTcp: true`, binds to an ephemeral port. Defaults to 7600. */ httpPort?: number; /** Path to the Unix domain socket. Auto-resolved if omitted. */ socketPath?: string | null; /** Whether to also listen on TCP (in addition to the socket). API default is `false`; the CLI passes `true` by default (derived from PORT, default 7600). */ withTcp?: boolean; enableEval?: boolean; /** Tool names omitted from every MCP session. */ disabledTools?: Iterable; /** What clients can reach: the whole document (default) or only the user's selection. */ scope?: MCPToolScope; mcpRoot?: string | null; /** Auth token for /mcp and /rpc endpoints. Auto-generated (32-hex) when omitted. Pass null explicitly to disable auth. */ authToken?: string | null; corsOrigin?: string | readonly string[] | null; /** * If set, the server starts a grace-period timer while no app is attached. * The timer closes the server and removes its discovery file unless an app * registers before it expires. A later app disconnect starts a new grace * period, which lets app-spawned servers survive brief reloads while still * cleaning up after renderer or process crashes. Undefined/0 disables the * watchdog — the default, since a bare CLI invocation for manual testing * should not self-terminate just because nobody connected yet. The desktop * app opts in when it spawns the server. */ appAttachTimeoutMs?: number; /** * How long a tool call waits for the app to register before it fails with * APP_NOT_CONNECTED. Defaults to 10 s so a stdio bridge started slightly * before the desktop app still succeeds; tests shorten it. */ appWaitTimeoutMs?: number; } interface ServerHandle { /** The Hono app (routes) */ app: Hono; /** The primary Node.js HTTP server (socket listener if present, otherwise TCP) */ server: Server; /** Resolved socket path (null if not listening on socket) */ socketPath: string | null; /** TCP port the server is listening on (0 if TCP is disabled) */ httpPort: number; /** Shut down the server: close listeners, remove socket and discovery files */ close: () => Promise; } declare function startServer(options?: ServerOptions): Promise; //#endregion export { type MCPAgentKind, type MCPAgentSession, type MCPContent, type MCPResult, MCP_AGENT_KINDS, MCP_VERSION, type RPCSender, type RegisterToolsOptions, ServerHandle, ServerOptions, fail, ok, registerTools, startServer }; //# sourceMappingURL=server.d.mts.map