connectToServer(workingDirectory: string,client: Client,serverEndpoint: McpServerEndpoint,options?: { signal?: AbortSignal; },): Promise<Transport>
Connects to an MCP server using the appropriate transport based on endpoint configuration
workingDirectory: string
The working directory to use for the MCP server (e.g. for CLI servers)
client: Client
The MCP client instance
serverEndpoint: McpServerEndpoint
The server endpoint configuration (either CLI or remote)
optional
options: { signal?: AbortSignal; }
Promise<Transport>
Promise that resolves to the transport when connected