@tanstack/ai-mcp
Version:
Host-side Model Context Protocol client for TanStack AI: discover and run MCP server tools, resources, and prompts in any adapter's chat() loop, with generated end-to-end types.
30 lines (29 loc) • 1.18 kB
TypeScript
import { Transport } from '@modelcontextprotocol/sdk/shared/transport.js';
import { OAuthClientProvider } from '@modelcontextprotocol/sdk/client/auth.js';
export interface HttpTransportConfig {
type: 'http';
url: string;
headers?: Record<string, string>;
fetch?: typeof fetch;
authProvider?: OAuthClientProvider;
}
export interface SseTransportConfig {
type: 'sse';
url: string;
headers?: Record<string, string>;
fetch?: typeof fetch;
authProvider?: OAuthClientProvider;
}
/** stdio is declared here for typing but constructed only via `@tanstack/ai-mcp/stdio`. */
export interface StdioTransportConfig {
type: 'stdio';
command: string;
args?: Array<string>;
env?: Record<string, string>;
cwd?: string;
}
export type TransportConfig = HttpTransportConfig | SseTransportConfig | StdioTransportConfig;
/** Either a built-in config or a ready-made SDK Transport instance (escape hatch). */
export type TransportInput = TransportConfig | Transport;
export declare function isTransportInstance(input: TransportInput): input is Transport;
export declare function resolveTransport(input: TransportInput): Promise<Transport>;