@agent-infra/mcp-client
TypeScript icon, indicating that this package has built-in type declarations

1.2.18 • Public • Published

@agent-infra/mcp-client

NPM Downloads

✨ A unified MCP Client implemented in TypeScript, supporting four major transports out of the box: In-memory, Stdio, SSE (Server-Sent Events), and Streamable HTTP.

🚀 Features

  • 🟦 Written in TypeScript: Type-safe, modern, and easy to integrate.
  • 🔌 Multi-Transport Support: Out-of-the-box support for four major transports:
    • 🧠 In-memory: For fast, local tool integration.
    • 🖥️ Stdio: Communicate with tools via standard input/output, perfect for process-based tools.
    • 🔄 SSE (Server-Sent Events): Real-time, event-driven communication over HTTP.
    • 🌐 Streamable HTTP: Efficient, stream-based HTTP communication for scalable remote tools.
  • 🛠️ Unified API: Interact with all transports using a single, consistent interface.
  • 🧩 Highly Extensible: Easily add custom transports or tools as needed.

⚡ Quick Start

import { MCPClient } from '@agent-infra/mcp-client';

// type: module project usage
import { createServer as createFileSystemServer } from '@agent-infra/mcp-server-filesystem';
// commonjs project usage
// const { createServer as createFileSystemServer } = await import('@agent-infra/mcp-server-filesystem')

const mcpClient = new MCPClient([
  // In-memory
  {
    type: 'builtin',
    name: 'FileSystem',
    description: 'filesystem tool',
    mcpServer: createFileSystemServer({
      allowedDirectories: [omegaDir],
    }),
  },
  // stdio
  {
    type: 'stdio',
    name: 'FileSystem-Stdio',
    description: 'filesystem tool',
    command: 'npx',
    args: [
      '-y',
      '@agent-infra/mcp-server-filesystem'
    ]
  },
  // sse
  {
    type: 'sse',
    name: 'FileSystem-sse',
    description: 'filesystem tool',
    url: 'http://localhost:8889/sse'
  },
  // streamable-http
  {
    type: 'sse',
    name: 'FileSystem-http',
    description: 'filesystem tool',
    url: 'http://localhost:8889/mcp'
  }
]);


await mcpClient.listTools();
const result = await mcpClient.callTool({
  client: 'FileSystem-sse',
  name: 'list_directory',
  arguments: {
    path: '~/your_computer'
  },
});

🙏 Credits

Thanks to:

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.2.1859latest
1.2.16-beta.01beta

Version History

VersionDownloads (Last 7 Days)Published
1.2.1859
1.2.1717
1.2.160
1.2.16-beta.01
1.2.151
1.2.140
1.2.130
1.2.120
1.2.110
1.2.100
1.2.90
1.2.80
1.2.70
1.2.60
1.2.51
1.2.5-beta.00
1.2.41
1.2.31
1.2.3-beta.20
1.2.3-beta.10
1.2.3-beta.00
1.2.20
1.2.10
1.2.00
1.2.0-beta.00
1.1.10124
1.1.90
1.1.80
1.1.71
1.1.61
1.1.6-beta.101
1.1.6-beta.91
1.1.6-beta.80
1.1.6-beta.70
1.1.6-beta.61
1.1.6-beta.50
1.1.6-beta.40
1.1.6-beta.3182
1.1.6-beta.00
1.1.6-beta.20
1.1.6-beta.10
1.1.50
1.1.40
1.1.30
1.1.20
1.1.10
1.1.1-beta.30
1.1.1-beta.20
1.1.1-beta.10
1.1.1-beta.00
1.1.00
1.0.1-beta.150
1.0.1-beta.140
1.0.1-beta.130
1.0.1-beta.120
1.0.1-beta.110
1.0.1-beta.100
1.0.1-beta.90
1.0.1-beta.80
1.0.1-beta.70
0.5.10
0.5.00
0.4.30
0.4.20

Package Sidebar

Install

npm i @agent-infra/mcp-client

Weekly Downloads

334

Version

1.2.18

License

none

Unpacked Size

49.8 kB

Total Files

6

Last publish

Collaborators

  • ulivz
  • ycjcl868
  • skychx