mcp-mux
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-muxrun the tests in this project and show me any failures"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-mux
A stdio-to-stdio MCP multiplexer that presents itself to Claude Code as a single MCP server while sharing backend server processes across sessions via a background broker.
Problem
Claude Code spawns every configured stdio MCP server as a child process per session. With 9 servers and 12 concurrent sessions, that's 108+ long-lived Node processes.
mcp-mux reduces this to N shim processes + 9 shared servers, regardless of session count.
Claude Code Session A Claude Code Session B
│ │
stdin/stdout stdin/stdout
│ │
┌────▼─────┐ ┌─────▼────┐
│ Shim A │ │ Shim B │
│ (stdio) │ │ (stdio) │
└────┬─────┘ └─────┬────┘
│ local socket │
└──────────────┬─────────────────────┘
│
┌────────▼────────┐
│ Broker │
│ (background) │
└───┬────┬────┬───┘
│ │ │
┌─────▼┐ ┌▼────▼──┐ ┌────────┐
│Server│ │Server │ │ etc... │
│ A │ │ B │ │ │
│stdio │ │stdio │ │ stdio │
└──────┘ └────────┘ └────────┘Related MCP server: mcp-gateway
How it works
Shim — Lightweight stdio process spawned by Claude Code (one per session). Speaks MCP over stdin/stdout to Claude Code, connects to the broker over a local socket.
Broker — Long-lived background process managing all backend MCP servers. Auto-started by the first shim, auto-exits after 5 minutes of inactivity.
The shim aggregates tools from all backend servers into a single namespace, routes tools/call requests to the correct backend, and handles request ID remapping so multiple sessions can share servers without conflicts.
Install
# Install from GitHub
npm install -g github:jasonwarta/mcp-mux
# Or use npx directly from GitHub (no install)
npx github:jasonwarta/mcp-muxSetup
1. Create .mcp-mux.json in your project root
{
"servers": {
"pare-git": {
"command": "npx",
"args": ["-y", "@paretools/git"]
},
"pare-test": {
"command": "npx",
"args": ["-y", "@paretools/test"]
},
"playwright": {
"command": "npx",
"args": ["@playwright/mcp@latest"],
"mode": "per-session",
"lazy": true
}
}
}2. Point Claude Code at the mux
In your .mcp.json:
{
"mcpServers": {
"mcp-mux": {
"type": "stdio",
"command": "npx",
"args": ["github:jasonwarta/mcp-mux"]
}
}
}Or if you cloned the repo locally:
{
"mcpServers": {
"mcp-mux": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mcp-mux/src/shim.mjs"]
}
}
}That's it. The shim auto-starts the broker on first use. No daemon management required.
Configuration
Server options
Field | Type | Default | Description |
| string | required | Executable to spawn |
| string[] |
| Arguments to the command |
| object |
| Additional environment variables |
| string | project root | Working directory for the server |
|
|
| Shared: one process for all sessions. Per-session: one per shim (for stateful servers like Playwright) |
| boolean |
| If true, don't spawn until first |
| integer |
| Max consecutive restart attempts before marking as failed |
| integer |
| Initial backoff (doubles each failure, capped at 30s) |
Global options
Field | Type | Default | Description |
| integer |
| Broker shuts down after this many ms with no connected shims |
| integer |
| Timeout for individual tool call requests |
Server modes
Shared (default) — One server process handles all sessions. Good for stateless tools (git, test runners, linters). The backend servers must accept explicit path/cwd parameters per request rather than relying on process.cwd().
Per-session — One server process per Claude Code session. Required for stateful servers that maintain session context (e.g., Playwright browser sessions, code-graph indexes). The process is spawned on first tool call and killed when the session disconnects.
Lazy — The server is probed for capabilities at broker startup (so its tools appear in the tool list), then the process is killed. A real instance is spawned on the first tools/call. Works with both shared and per-session modes. Good for heavy, rarely-used servers.
Tool naming
Tools are namespaced to avoid collisions. A tool named status from server pare-git appears in Claude Code as:
mcp__mcp-mux__pare-git__statusThe format is mcp__<mcp-server-name>__<backend-server>__<tool>.
CLI
The shim doubles as a CLI for broker management:
# Check broker status (server states, connected shims, uptime)
npx github:jasonwarta/mcp-mux status
# Stop the broker
npx github:jasonwarta/mcp-mux stop
# Restart the broker
npx github:jasonwarta/mcp-mux restartIf installed globally or cloned locally, replace npx github:jasonwarta/mcp-mux with mcp-mux or node src/shim.mjs.
All commands accept --config <path> to specify an alternate config file.
How request routing works
Claude Code sends
tools/callwith a namespaced tool nameShim looks up the routing table to find the backend server
Shim remaps the tool name back to the original and forwards to the broker
Broker remaps the request ID to a unique internal ID (so multiple shims can share a server without ID collisions)
Backend server processes the request and responds
Broker remaps the ID back and routes the response to the correct shim
Shim returns the response to Claude Code on stdout
Crash recovery
Backend servers that crash are automatically restarted with exponential backoff
After
maxRestartsconsecutive failures, the server is marked as failedIn-flight requests to a crashed server get an error response (not a hang)
If the broker itself crashes, the next shim connection auto-starts a new one
Socket paths
The broker listens on a local socket derived from the config file path:
Linux/macOS:
$XDG_RUNTIME_DIR/mcp-mux-<hash>.sock(or/tmp/)Windows:
\\.\pipe\mcp-mux-<hash>
Where <hash> is the first 8 chars of SHA-256 of the absolute config path. Different projects get different sockets.
Requirements
Node.js >= 20
Any stdio MCP server as a backend
Zero npm dependencies. Uses only Node.js built-in modules.
License
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Agent-native collaboration network: orchestrate a team of long-running agents from any MCP client.
MCP server for progressive tool usage at any scale (see https://klavis.ai)
MCP server exposing the Backtest360 engine API as tools for AI agents.
Search, vet & assemble MCP servers from your agent: verified tools, risk labels, and trust scores.
Related MCP Servers
AlicenseNot gradedqualityCmaintenanceConsolidates multiple upstream MCP servers behind a single STDIO interface, exposing search_tools and run_tool to avoid context bloat.55 npm15MIT- FlicenseNot gradedqualityDmaintenanceAggregates multiple child MCP servers into a single MCP server endpoint, enabling clients to use various tools (e.g., filesystem, Brave Search) through one interface.25 npm-
- FlicenseNot gradedqualityCmaintenanceAggregates multiple MCP servers into a single standard MCP interface for agents like Claude Code, with automatic tool prefixing and hot-reload.2-
- AlicenseNot gradedqualityBmaintenanceAggregates multiple MCP sub-servers into a single unified entry point, supporting stdio and Streamable HTTP protocols, with a web-based management interface for configuration, routing, and tool management.17 npmMIT