Connect#
typescript
import { MCPClient } from '@AxilJS/ai'
const client = new MCPClient({ serverUrl: 'http://localhost:8080' })
await client.connect()Tools#
typescript
const tools = await client.listTools()
const result = await client.callTool('read_file', { path: '/etc/hosts' })Use with agents#
typescript
const mcpTools = await client.asAgentTools()
const agent = new Agent({ provider: ai, tools: [...builtIn, ...mcpTools] })Note
MCP uses JSON-RPC 2.0 over HTTP. Protocol version 2024-11-05.