#!/usr/bin/env node import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; import { type IncomingMessage, type Server as HttpServer, type ServerResponse } from "http"; import { z } from "zod"; import type { RegisteredTool } from "@modelcontextprotocol/sdk/server/mcp.js"; import { ToolsetManager } from "./toolsets.js"; import type { ToolContext } from "./tool-context.js"; export declare const server: McpServer; export declare const legacyTools: Map; export declare const O_Build: { error: z.ZodOptional; success: z.ZodBoolean; duration_seconds: z.ZodOptional; errors: z.ZodOptional>; warnings_count: z.ZodOptional; output_path: z.ZodOptional; warnings: z.ZodOptional>; tail: z.ZodOptional>; auto_reconfigured: z.ZodOptional; board_rev: z.ZodOptional>; build_dir: z.ZodOptional>; }; export declare function setTraceBrowserOpener(fn: (url: string) => boolean): void; export declare const policy: import("./policy/policy.js").Policy; export declare const toolContext: ToolContext; export declare const toolsetManager: ToolsetManager; /** Never 0.0.0.0. There is no configuration knob for this on purpose. */ export declare const HTTP_BIND_HOST = "127.0.0.1"; /** Host headers the transport accepts — the loopback names of our own port. */ export declare function httpAllowedHosts(port: number): string[]; /** * The bearer token for `--http`. Taken from CROSSPAD_MCP_TOKEN; generated and * printed on stderr when absent, because a server that silently ran without one * is exactly the state this is here to prevent. */ export declare function resolveHttpToken(env?: NodeJS.ProcessEnv): { token: string; generated: boolean; }; export declare function bearerMatches(header: string | string[] | undefined, token: string): boolean; /** * The /mcp listener. No CORS headers anywhere: a browser page on another origin * must not be able to reach this, and silence is how that is said. */ export declare function createMcpHttpServer(token: string, handle: (req: IncomingMessage, res: ServerResponse) => Promise): HttpServer; export declare function startHttpServer(port: number, token: string, handle: (req: IncomingMessage, res: ServerResponse) => Promise): Promise; /** * End the process when the client's end of the pipe closes. * * A stdio MCP server has exactly one client, and when that client goes there is * nobody left to answer — but nothing was making it exit, so a client that came * and went left a server running, and each of those holds a crosspad-hil daemon * open on the board. Sixteen of both were found alive from one evening of * testing. */ export declare function exitWhenStdinEnds(stream: NodeJS.ReadableStream, onEnd: () => void): () => void;