import type { ToolDefinition } from '../types/messages.js'; import { type JsonRpcMessage, type McpTransport } from './protocol.js'; /** Options for an MCP server. */ export interface McpServerOptions { /** Server name reported to clients. Defaults to `nexus-ai-pro`. */ name?: string; /** Server version reported to clients. Defaults to `1.x`. */ version?: string; /** Tools the server exposes. */ tools?: ToolDefinition[]; /** Resources the server exposes, read by URI. */ resources?: Array<{ uri: string; name?: string; description?: string; mimeType?: string; read(): Promise | unknown; }>; } /** * Exposes tools over MCP, so other assistants can call them. * * The other direction of the same bridge: the client borrows an ecosystem's tools, the server lends * this application's. A tool written once with `tool()` can serve an agent here and an editor * elsewhere. */ export declare class McpServer { private readonly options; private readonly tools; private transport; constructor(options?: McpServerOptions); /** Adds a tool. Returns the server, for chaining. */ register(tool: ToolDefinition): this; /** Starts serving requests over a transport. */ connect(transport: McpTransport): Promise; /** Closes the transport. */ close(): Promise; /** Handles one message. Exposed so a host can drive the server without a transport. */ handle(message: JsonRpcMessage): Promise; private dispatch; } /** * Serves MCP over this process's stdin and stdout. * * The transport an editor or desktop assistant launches: it runs the process and speaks JSON-RPC to * it, so nothing may be written to stdout except protocol messages. */ export declare function createStdioServerTransport(streams?: { input?: NodeJS.ReadableStream; output?: { write(chunk: string): void; }; }): McpTransport;