mux
One MCP to rule them all.
A lightweight gateway that routes your AI to any MCP server on demand. 4 tools. Zero re-auth. Everything else spawned when needed.
The Problem
Your AI drowns in 50+ tools
it doesn't need right now.
Every MCP server dumps its full schema into your AI's working memory.
15 idle processes consuming resources for tools you call once a day.
OAuth sessions die on disable. Browser popup every time you re-enable.
The Solution
4 tools. Always.
Everything else, on demand.
Architecture
One gateway. Every server.
Features
Built for the real world.
Lazy Spawn
Servers start on first call. Zero overhead until needed.
Idle Reaper
Kills unused connections after 5 min. RAM reclaimed.
OAuth Cached
Tokens persist. Auth once, use forever.
Schema Cache
Tools remembered after disconnect. Instant reconnect.
Auto Keywords
Intent routing from real tool discovery.
Hot Reload
Edit registry, no restart. Live in 2 seconds.
Metrics
Context savings, response times, auth efficiency.
Any Client
Kiro, Cursor, Claude Desktop. Any stdio MCP.
MCP Tools
4 tools. That's the entire surface.
Regardless of how many downstream servers exist, your AI only sees these 4 tools in its context.
[
{ "name": "gitlab", "status": "active", "tools": 8 },
{ "name": "jira", "status": "idle", "keywords": ["ticket","sprint"] },
{ "name": "elastic", "status": "idle", "tools": ["search_documents","get_index"] }
]CLI Reference
Full control from your terminal.
mux-cli setupmux-cli add <name>mux-cli remove <name>mux-cli auth [--all]mux-cli healthmux-cli listmux-cli statusmux-cli metricsmux-cli keywords [name]mux-cli updateAuthentication
Auth once. Cached forever.
Smart detection — only triggers OAuth when the server actually supports it. Live countdown timer. Instant resolution.
Tool call arrives for HTTP server
Try connecting without auth — works for API-key servers instantly
If 401 → probe OAuth discovery endpoint on server
OAuth found → browser auth with live countdown timer
Token cached. Resolves immediately when auth completes.
env: { "TOKEN": "${VAR}" }From shell environmentheaders: { "X-Key": "${KEY}" }Injected into HTTPServer has OAuth discoveryBrowser → authorize → cachedServer returns 401, no discoveryFail fast with clear errorConfiguration
One JSON file. Hot-reloaded.
{
"servers": {
"gitlab": {
"transport": "stdio",
"command": "npx",
"args": ["-y", "@zereight/mcp-gitlab"],
"env": { "GITLAB_TOKEN": "${GITLAB_TOKEN}" },
"keywords": ["merge request", "pipeline"],
"idleTimeoutMs": 300000
}
}
}MUX_LOG_LEVELMUX_LOG_TO_FILEMUX_REGISTRY_PATHMUX_TOKEN_STORE_PATHMUX_DEFAULT_IDLE_TIMEOUTConnection Lifecycle
Spawn. Use. Kill. Repeat.
Registered, not running
Connected, handling calls
Idle timeout, disconnected
Connections killed after 5 min of inactivity. Configurable per server.
Edit ~/.mux/servers.json — changes apply in 2 seconds, no restart.
On SIGTERM: disconnect all, kill children, exit clean.
Install
Get started in seconds.
One command installs globally. Then run mux-cli from anywhere.
npm install -g mux-mcp-gatewaymux-cliMux imports your existing servers, patches your AI client config, and runs a health check. Your AI now sees 4 tools instead of 50+.
Comparison
Before vs After.
Tech Stack
Under the hood.
Node.js 20+TypeScript 5.7@modelcontextprotocol/sdk 1.12.1tsup (ESM)stdio (to AI client)stdio + StreamableHTTPJSON file (chmod 600)Authorization Code + PKCESupported Clients
Works with everything.
~/.kiro/settings/mcp.json~/.kiro/settings/mcp.json~/.cursor/mcp.json~/Library/.../config.jsonCustom