1.1.9 • Published 4 months ago

@agent-infra/mcp-client v1.1.9

Weekly downloads
-
License
-
Repository
github
Last release
4 months ago

@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:

1.1.9

4 months ago

1.1.8

4 months ago

1.1.7

5 months ago

1.1.6

5 months ago

1.1.6-beta.10

5 months ago

1.1.6-beta.9

5 months ago

1.1.6-beta.8

5 months ago

1.1.6-beta.7

5 months ago

1.1.6-beta.6

5 months ago

1.1.6-beta.5

5 months ago

1.1.6-beta.4

5 months ago

1.1.6-beta.3

5 months ago

1.1.6-beta.0

5 months ago

1.1.6-beta.2

5 months ago

1.1.6-beta.1

5 months ago

1.1.5

5 months ago

1.1.4

5 months ago

1.1.3

5 months ago

1.1.2

5 months ago

1.1.1

5 months ago

1.1.1-beta.3

5 months ago

1.1.1-beta.2

5 months ago

1.1.1-beta.1

5 months ago

1.1.1-beta.0

5 months ago

1.1.0

5 months ago

1.0.1-beta.15

5 months ago

1.0.1-beta.14

5 months ago

1.0.1-beta.13

5 months ago

1.0.1-beta.12

5 months ago

1.0.1-beta.11

5 months ago

1.0.1-beta.10

5 months ago

1.0.1-beta.9

5 months ago

1.0.1-beta.8

5 months ago

1.0.1-beta.7

5 months ago

0.5.1

6 months ago

0.5.0

6 months ago

0.4.3

6 months ago

0.4.2

7 months ago