@xynehq/jaf
Version:
Juspay Agent Framework - A purely functional agent framework with immutable state and composable tools
54 lines • 1.89 kB
TypeScript
import { Tool } from '../core/types.js';
export interface MCPClient {
listTools(): Promise<Array<{
name: string;
description?: string;
inputSchema?: any;
}>>;
callTool(name: string, args: unknown): Promise<string>;
close(): Promise<void>;
}
/**
* Create an MCP client using the STDIO transport.
* Suitable for local MCP servers started as subprocesses (e.g., npx/uvx/python/node).
*/
export declare function makeMCPClient(command: string, args?: string[]): Promise<MCPClient>;
/**
* Create an MCP client using the Streamable HTTP transport (SSE).
*
* This connects to a remote MCP server that exposes the single MCP endpoint
* supporting POST and GET with Server-Sent Events per the 2025-06-18 spec.
*
* Example:
* const mcp = await makeMCPClientSSE('https://example.com/mcp', {
* headers: { Authorization: `Bearer ${token}` }
* })
*/
export declare function makeMCPClientSSE(url: string, opts?: {
headers?: Record<string, string>;
}): Promise<MCPClient>;
/**
* Create an MCP client using the Streamable HTTP transport.
*
* This connects to a remote MCP server that implements the Streamable HTTP transport
* specification using HTTP POST for sending messages and HTTP GET with Server-Sent Events
* for receiving messages.
*
* Example:
* const mcp = await makeMCPClientHTTP('https://example.com/mcp', {
* headers: { Authorization: `Bearer ${token}` },
* sessionId: 'my-session-123'
* })
*/
export declare function makeMCPClientHTTP(url: string, opts?: {
headers?: Record<string, string>;
sessionId?: string;
fetch?: typeof fetch;
requestInit?: RequestInit;
}): Promise<MCPClient>;
export declare function mcpToolToJAFTool<Ctx>(mcpClient: MCPClient, mcpToolDef: {
name: string;
description?: string;
inputSchema?: any;
}): Tool<any, Ctx>;
//# sourceMappingURL=mcp.d.ts.map