UNPKG

@h1deya/langchain-mcp-tools

Version:
19 lines (18 loc) 1.03 kB
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import { McpToolsLogger, UrlBasedConfig } from "./langchain-mcp-tools.js"; /** * Creates an HTTP transport with automatic fallback from Streamable HTTP to SSE. * Follows the MCP specification recommendation to test with direct POST InitializeRequest first, * then fall back to SSE if a 4xx error is encountered. * * See: https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#backwards-compatibility * * @param url - The URL to connect to * @param config - URL-based server configuration * @param logger - Logger instance for recording connection attempts * @param serverName - Server name for logging context * @returns A promise that resolves to a configured Transport * * @internal This function is meant to be used internally by convertSingleMcpToLangchainTools */ export declare function createHttpTransportWithFallback(url: URL, config: UrlBasedConfig, logger: McpToolsLogger, serverName: string): Promise<Transport>;