๐Ÿšจ Shai-Hulud Strikes Again:834 Packages Compromised.Technical Analysis โ†’
Socket
Book a DemoInstallSign in
Socket

@agent-infra/mcp-client

Package Overview
Dependencies
Maintainers
6
Versions
73
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@agent-infra/mcp-client

An MCP Client to run servers for Electron apps, support same-process approaching

latest
Source
npmnpm
Version
1.2.28
Version published
Weekly downloads
25K
369.05%
Maintainers
6
Weekly downloads
ย 
Created
Source

@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.
  • ๐Ÿ” Filtering Support: Filter tools and prompts using glob patterns with allow/block lists.

โšก 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();
await mcpClient.listPrompts();
const result = await mcpClient.callTool({
  client: 'FileSystem-sse',
  name: 'list_directory',
  arguments: {
    path: '~/your_computer'
  },
});

๐Ÿ” Filtering Tools and Prompts

You can filter tools and prompts using glob patterns with allow and block lists:

const mcpClient = new MCPClient([
  {
    type: 'builtin',
    name: 'FileSystem',
    description: 'filesystem tool',
    mcpServer: createFileSystemServer({
      allowedDirectories: [omegaDir],
    }),
    // Filter configuration
    filters: {
      tools: {
        allow: ['list_*', 'read_*'], // Only allow tools starting with 'list_' or 'read_'
        block: ['delete_*']          // Block any tools starting with 'delete_'
      },
      prompts: {
        allow: ['safe_*'],           // Only allow prompts starting with 'safe_'
        block: ['admin_*']           // Block prompts starting with 'admin_'
      }
    }
  }
]);

// List all tools (filtered)
const tools = await mcpClient.listTools();

// List all prompts (filtered)  
const prompts = await mcpClient.listPrompts();

// List tools from specific server
const serverTools = await mcpClient.listTools('FileSystem');

Filter Rules:

  • Allow patterns: If specified, only items matching these patterns are included
  • Block patterns: Items matching these patterns are excluded
  • Pattern syntax: Uses minimatch glob patterns (*, **, ?, [...], etc.)
  • Processing order: Allow filter is applied first, then block filter

๐Ÿ™ Credits

Thanks to:

FAQs

Package last updated on 12 Dec 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts