/** * MCP Server Implementation * Register tools against the orchestrator executor and manage transports. * * @see {@link ../../docs/adr/005-mcp-integration.md ADR-005: MCP Protocol Integration} */ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; import type { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { type Logger } from '../lib/logger'; import type { Tool } from '../types/tool'; import { type ExecuteRequest, type ChainHintsMode } from '../app/orchestrator-types'; import type { Result } from '../types'; /** * Server options */ export interface ServerOptions { logger?: Logger; transport?: 'stdio'; name?: string; version?: string; outputFormat?: OutputFormat; chainHintsMode?: ChainHintsMode; } /** * MCP Server interface */ export interface MCPServer { start(): Promise; stop(): Promise; getServer(): Server; getTools(): Array<{ name: string; description: string; }>; } /** * Output format options for tool results * * @property JSON - Full structured JSON output (for APIs and programmatic access) * @property TEXT - Concise summary text (for logs and quick display) * @property MARKDOWN - Summary with collapsible JSON details (for documentation) * @property NATURAL_LANGUAGE - Rich narrative with sections (for user interfaces) */ export declare const OUTPUTFORMAT: { readonly MARKDOWN: "markdown"; readonly JSON: "json"; readonly TEXT: "text"; readonly NATURAL_LANGUAGE: "natural-language"; }; export type OutputFormat = (typeof OUTPUTFORMAT)[keyof typeof OUTPUTFORMAT]; export interface RegisterOptions { outputFormat: OutputFormat; chainHintsMode?: ChainHintsMode; server: McpServer; tools: readonly TTool[]; logger: Logger; transport: string; execute: ToolExecutor; } type ToolExecutor = (request: ExecuteRequest) => Promise>; /** * Create an MCP server that delegates execution to the orchestrator * @param tools - Array of MCP tools to register with the server * @param options - Server configuration options * @param execute - Tool executor function that handles tool execution requests * @returns MCPServer interface for managing the server lifecycle */ export declare function createMCPServer(tools: Array, options: ServerOptions | undefined, execute: ToolExecutor): MCPServer; /** * Register tools against an MCP server instance, delegating to the orchestrator executor. * Each tool is registered with its name, description, and input schema. Tool execution is * delegated to the orchestrator's execute function. * @param options - Registration options including server, tools, and executor */ export declare function registerToolsWithServer(options: RegisterOptions): void; /** * Format tool output based on requested format * * @param output - The tool result to format (typically includes a summary field) * @param format - Output format (JSON, TEXT, MARKDOWN, or NATURAL_LANGUAGE) * @param chainHintsMode - Whether to include "Next Steps" sections in natural language output (default: 'enabled') * @returns Formatted string representation of the output * * @description * Transforms tool results into user-friendly formats: * - JSON: Full structured data (default, for APIs) * - TEXT: Summary field only (for logs/console) * - MARKDOWN: Summary + collapsible JSON (for documentation) * - NATURAL_LANGUAGE: Rich narrative (for user interfaces) * * All tool results include a `summary` field for human-readable display. * The NATURAL_LANGUAGE format uses type detection to provide tool-specific * rich narratives with sections, formatting, and next steps. */ export declare function formatOutput(output: unknown, format: OutputFormat, chainHintsMode?: ChainHintsMode): string; export {}; //# sourceMappingURL=mcp-server.d.ts.map