/** * MCP Gateway Skill - Bridge MCP servers with SWAIG functions. * * Port of the Python `MCPGatewaySkill`. Connects SignalWire agents to a * Model Context Protocol gateway HTTP service and dynamically registers * SWAIG tools for every MCP tool exposed by the configured services. * * Authentication: Bearer token (via `auth_token`) or HTTP Basic auth * (via `auth_user` + `auth_password`). Supports configurable timeouts, * retry attempts, and SSL verification. */ import { SkillBase } from '../SkillBase.js'; import type { SkillToolDefinition, SkillPromptSection, SkillConfig, ParameterSchemaEntry } from '../SkillBase.js'; /** * Bridge MCP (Model Context Protocol) servers with SWAIG functions. * * When configured, calls a gateway's `/services` endpoint to discover MCP * services, enumerates each service's tools, and registers them as SWAIG * tools prefixed with `tool_prefix` (default `mcp_`). A hidden hangup hook * tool cleans up MCP sessions when the call ends. * * @example * ```ts * agent.addSkill('mcp_gateway', { * gateway_url: 'https://mcp-gateway.example.com', * tool_prefix: 'mcp_', * }); * ``` */ export declare class McpGatewaySkill extends SkillBase { static SKILL_NAME: string; static SKILL_DESCRIPTION: string; static SKILL_VERSION: string; static REQUIRED_PACKAGES: readonly string[]; static REQUIRED_ENV_VARS: readonly string[]; static getParameterSchema(): Record; private gatewayUrl; private authToken; private authUser; private authPassword; private services; private sessionTimeout; private toolPrefix; private retryAttempts; private requestTimeout; private verifySsl; private _discoveredTools; private _ready; /** * Cached undici Agent used when `verify_ssl=false`. Created once in * `setup()` and reused across every `_makeRequest` call to avoid * connection-pool churn (Python reuses `requests.Session` implicitly). */ private _undiciAgent; setup(): Promise; getHints(): string[]; getGlobalData(): Record; /** * @returns Dynamically discovered MCP tools plus an internal hangup-cleanup * tool. If discovery has not completed, returns a single fallback * `mcp_invoke` tool that explains configuration is missing. */ getTools(): SkillToolDefinition[]; /** @returns Prompt section listing configured MCP services. */ protected _getPromptSections(): SkillPromptSection[]; /** Build auth + timeout-bearing fetch request to the gateway. */ private _makeRequest; /** Discover available services and register each MCP tool as a SWAIG tool. */ private _discoverTools; /** Convert an MCP tool definition into a SWAIG-compatible `SkillToolDefinition`. */ private _registerMcpTool; /** Call an MCP tool through the gateway, with retries. */ private _callMcpTool; /** Handle call hangup — clean up any MCP session on the gateway. */ private _hangupHandler; } /** * Factory function for creating McpGatewaySkill instances. * @param config - Optional skill configuration. * @returns A new McpGatewaySkill instance. */ export declare function createSkill(config?: SkillConfig): McpGatewaySkill;