npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-client-router

v1.0.1

Published

A transport interface for aggregating multiple Model Context Protocol clients into a single unified interface

Readme

MCP Client Router

The MCP Client Router is a transport interface for aggregating multiple Model Context Protocol (MCP) clients into a single unified interface. It allows you to seamlessly interact with multiple MCP servers through a single client interface.

Features

  • Route calls to the appropriate MCP client based on prefixed names
  • Aggregate tools, prompts, and resources from multiple clients
  • Prefix/suffix naming convention to route requests to the correct client
  • Implementation of the MCP Transport interface for seamless integration
  • Support for both HTTP and stdio-based MCP servers

Installation

npm install mcp-client-router

Usage

Basic Usage

import { ClientRouter } from "mcp-client-router";
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";

// Create individual clients
const client1 = new Client({ name: "client1", version: "1.0.0" });
const client2 = new Client({ name: "client2", version: "1.0.0" });

// Connect them to their respective transports
await client1.connect(
  new StdioClientTransport({
    command: "node",
    args: ["server1.js"],
  })
);

await client2.connect(
  new StdioClientTransport({
    command: "node",
    args: ["server2.js"],
  })
);

// Create a router with the clients
const router = new ClientRouter([client1, client2]);

// Now you can use the router as a unified client
const allTools = await router.listTools();
// Tools will be prefixed with client names, e.g., "client1__toolName"

// To call a specific tool
const result = await router.callTool({
  name: "client1__toolName",
  arguments: {
    /* args */
  },
});

Creating from Configuration Object

import { fromObject } from "mcp-client-router";

const router = await fromObject({
  mcpServers: {
    client1: {
      command: "node",
      args: ["server1.js"],
    },
    client2: {
      url: "http://localhost:3000/mcp",
    },
  },
});

// Now use the router as a unified client

Connecting to a Server Transport

import { ClientRouter } from "mcp-client-router";
import { HTTPServerTransport } from "@modelcontextprotocol/sdk/server/http.js";

// Create router with clients
const router = new ClientRouter([
  /* clients */
]);

// Connect to an HTTP server transport
const httpTransport = await router.connect(HTTPServerTransport, {
  port: 3000,
  path: "/mcp",
});

// The router now acts as an MCP server

How It Works

The Client Router prefixes the names of tools, prompts, and resources with the client name followed by a double underscore (__). For example:

  • A tool named analyze from client client1 becomes client1__analyze
  • A prompt named greeting from client client2 becomes client2__greeting
  • A resource with URI docs/api.md from client client3 becomes client3__docs/api.md

When you call a prefixed tool/prompt/resource, the Client Router routes the call to the appropriate client.

API Reference

ClientRouter

The main class that implements the MCP Transport interface.

new ClientRouter((clients = []));

Methods

  • start(): Starts processing messages on the transport
  • send(message, options): Sends a JSON-RPC message
  • close(): Closes all client connections
  • connect(transportOrConstructor, options): Connects to a server transport

fromObject(obj, options)

Creates a ClientRouter from a configuration object.

License

ISC