import { Client } from '@modelcontextprotocol/sdk/client/index.js'; import type { Transport } from '@modelcontextprotocol/sdk/shared/transport.js'; import { type AtribOptions, type AtribServer } from './middleware.js'; /** Upstream MCP server transport options. */ export type UpstreamTransport = { type: 'stdio'; /** Executable to spawn (e.g. 'node', 'npx', 'python') */ command: string; /** Command-line arguments */ args?: string[]; /** Environment variables for the child process */ env?: Record; } | { type: 'http'; /** Streamable HTTP endpoint URL */ url: string; /** Custom HTTP headers */ headers?: Record; } | { type: 'inMemory'; /** Pre-built in-process Transport (used for testing). */ transport: Transport; }; /** Options for createAtribProxy(). */ export interface AtribProxyOptions { /** * Display name for the proxy McpServer. Surfaces to the host as the * server identifier (e.g. used by Claude Agent SDK to namespace tool names * as `mcp____`). */ name: string; /** Server version reported via the MCP initialize handshake. Defaults to '0.0.0'. */ version?: string; /** Upstream MCP server transport. what the proxy forwards calls to. */ upstream: UpstreamTransport; /** atrib middleware options applied to the in-process side of the proxy. */ atrib: AtribOptions; } /** Result of createAtribProxy(). */ export interface AtribProxy { /** * The wrapped local McpServer. Pass this to your host: * * - Claude Agent SDK: `{ type: 'sdk', name, instance: proxy.server }` * - Cloudflare Agents: register on the agent's MCP surface * - Any other host that accepts an `McpServer` instance * * The host owns connecting the McpServer to its own transport (it will call * `proxy.server.connect(hostTransport)`). The proxy does NOT pre-connect * the McpServer to anything. */ server: AtribServer; /** * Live upstream MCP client. Exposed for advanced control (custom shutdown * coordination, manual ping, etc.). Most callers should never need this. */ upstreamClient: Client; /** * Disconnect the upstream client cleanly. Does NOT close the in-process * McpServer. the host owns that lifecycle. */ close(): Promise; } /** * Create an in-process McpServer that proxies all tool calls to an upstream * MCP server, with `atrib()` middleware applied to the in-process side. * * The proxy connects to the upstream during construction and lists its tools. * The returned McpServer exposes the same tool catalog as the upstream and * forwards every `tools/call` to the upstream client. * * Tool list is captured once at construction; dynamic refresh is V2 (see * DECISIONS D021). For now, restart the proxy if the upstream changes its * tool catalog. */ export declare function createAtribProxy(options: AtribProxyOptions): Promise; //# sourceMappingURL=proxy.d.ts.map