pocketsmith-mcp
Version:
MCP server for managing budgets via PocketSmith API
24 lines (23 loc) • 1.52 kB
TypeScript
/**
* @fileoverview Factory for creating MCP client transports.
* This module provides a centralized function (`getClientTransport`) to instantiate
* the appropriate client transport (Stdio or HTTP) based on server configuration.
* It uses specific transport creation functions from other modules within this directory.
* @module src/mcp-client/transports/transportFactory
*/
import type { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import type { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { RequestContext } from "../../utils/index.js";
/**
* Retrieves the server configuration and creates the appropriate client transport
* (either `StdioClientTransport` or `StreamableHTTPClientTransport` from the `@modelcontextprotocol/sdk`)
* based on the `transportType` specified in the server's configuration.
* This function acts as a factory for client transport instances.
*
* @param serverName - The name of the MCP server, as defined in the `mcp-config.json` file.
* @param parentContext - Optional parent request context for logging and tracing.
* @returns A configured transport instance.
* @throws {McpError} If the server configuration is missing or invalid, if an unsupported
* transport type is specified, or if transport creation fails.
*/
export declare function getClientTransport(serverName: string, parentContext?: RequestContext | null): StdioClientTransport | StreamableHTTPClientTransport;