AI Platform

MCP

Model Context Protocol client.

1 min readDocumentationEdit this page

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.

Help improve the documentation

AxilJS is open source and documentation improvements are welcome.

AxilJS DocumentationMIT License · Built by SyntaxilitY