pocketsmith-mcp
Version:
MCP server for managing budgets via PocketSmith API
27 lines (26 loc) • 1.5 kB
TypeScript
/**
* @fileoverview Provides functions for creating and configuring MCP StreamableHTTPClientTransport.
* This module is responsible for instantiating and setting up the StreamableHTTPClientTransport
* from the @modelcontextprotocol/sdk, used for communicating with MCP servers over HTTP.
* @module src/mcp-client/transports/httpClientTransport
*/
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import { RequestContext } from "../../utils/index.js";
/**
* Configuration options specifically required for creating a `StreamableHTTPClientTransport`.
* This primarily includes the base URL of the MCP server.
*/
export interface HttpTransportConfig {
baseUrl: string;
}
/**
* Creates and configures a `StreamableHTTPClientTransport` instance (from the `@modelcontextprotocol/sdk`)
* for communicating with an MCP server over HTTP.
*
* @param transportConfig - Configuration containing the base URL for the HTTP server.
* @param parentContext - Optional parent request context for logging and tracing.
* @returns A configured `StreamableHTTPClientTransport` instance, ready to be connected.
* @throws {McpError} If the provided `transportConfig` is invalid (e.g., missing or malformed baseUrl)
* or if the transport fails to initialize for other reasons.
*/
export declare function createHttpClientTransport(transportConfig: HttpTransportConfig, parentContext?: RequestContext | null): StreamableHTTPClientTransport;