import type { AgentSpec } from '@contractspec/lib.contracts-spec/agent'; import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { ContractSpecAgent } from '../agent/contract-spec-agent'; /** * Generate an MCP server that exposes a ContractSpec agent as a tool. * * This allows other AI agents (e.g., Claude Desktop, Cursor) to use * your ContractSpec agents as tools, enabling agent-to-agent composition. * * @param agent - The ContractSpec agent to expose * @param spec - The agent specification * @returns MCP Server instance * * @example * ```typescript * const server = agentToMcpServer(myAgent, myAgentSpec); * * // Run via stdio transport * const transport = new StdioServerTransport(); * await server.connect(transport); * ``` */ export declare function agentToMcpServer(agent: ContractSpecAgent, spec: AgentSpec): McpServer; /** * Configuration for running an agent as an MCP server. */ export interface AgentMcpServerConfig { /** The agent to expose */ agent: ContractSpecAgent; /** The agent specification */ spec: AgentSpec; /** Optional server name override */ name?: string; /** Optional version override */ version?: string; /** Auth validation function for incoming MCP requests. */ validateAuth?: (headers: Record) => Promise | boolean; /** Required auth methods for clients connecting to this MCP server. */ requiredAuthMethods?: ('api-key' | 'bearer' | 'oauth2')[]; } /** * Create an MCP server from configuration. */ export declare function createAgentMcpServer(config: AgentMcpServerConfig): McpServer;