What is McpHub?

McpHub is a single Rust binary that sits between your AI editor (Cursor, Claude Desktop, Windsurf) and all your MCP servers. Instead of loading 20+ servers with 200+ tool definitions into every prompt (~20,000 tokens), the editor sees only 2 tools: discover and execute. Token savings: ~99%.

McpHub runs as a persistent daemon. Your editor connects via SSE URL instead of spawning a process. If Cursor crashes or restarts, McpHub stays alive and reconnects instantly. No manual refresh, no lost state.

Install

From source

git clone https://github.com/Soflution1/McpHub.git
cd McpHub
./install.sh

The install script builds the release binary (~1MB), installs to ~/.local/bin/McpHub, codesigns for macOS, and generates the tool cache.

Pre-built binaries

Download from GitHub Releases for macOS (ARM/Intel), Linux (amd64/arm64), and Windows.

Setup (SSE mode, recommended)

# 1. Generate tool cache (one-time, ~60s)
McpHub generate

# 2. Install as auto-start daemon
McpHub install

# 3. Configure your editor

Cursor (~/.cursor/mcp.json):

{
  "mcpServers": {
    "McpHub": {
      "url": "http://127.0.0.1:24680/sse",
      "headers": {
        "Authorization": "Bearer <your-token>"
      }
    }
  }
}

Your auth token is auto-generated on first run and stored in ~/.McpHub/auth-token. All SSE and API endpoints require it.

Setup (stdio mode)

If you prefer the editor to manage the process lifecycle:

{
  "mcpServers": {
    "McpHub": {
      "command": "/Users/you/.local/bin/McpHub"
    }
  }
}

In this mode, McpHub also starts the HTTP server on :24680 in the background.

How It Works

Cursor (sees only 2 tools: discover + execute)
    ↓ SSE (http://127.0.0.1:24680/sse)
McpHub daemon (BM25 search, auth, connection pool)
    ↓ stdio (pooled connections)
Your MCP servers (spawned on demand, killed when idle)

Discover mode (default)

  1. LLM calls discover("send email")
  2. McpHub searches across all tools using BM25 ranking
  3. Returns matching tools with full schemas
  4. LLM calls execute("resend", "send-email", {to: "...", ...})
  5. McpHub routes to the right server, calls the tool, returns result

Server names are resolved case-insensitively.

Passthrough mode

All tools exposed directly with server__tool prefix. Full visibility, higher token cost. Set "mode": "passthrough" in settings.

Dashboard

Open http://127.0.0.1:24680 or run McpHub dashboard.

Features:

  • Add/edit/enable/disable servers with syntax-highlighted JSON
  • Real-time metrics: calls per server, latency, error rates, uptime
  • Live log streaming with server and level filters
  • Rebuild cache in one click
  • Token savings counter

Transport Modes

Mode Command Editor config Survives editor crash
SSE (recommended) McpHub serve or McpHub install "url": "http://127.0.0.1:24680/sse" Yes
stdio McpHub (default) "command": "/path/to/McpHub" No

SSE uses TCP keepalive (15s probe, 5s interval, 3 retries), a session reaper for stale connections, and non-blocking sends to prevent slow clients from blocking the server.

CLI

McpHub                  # Start proxy (stdio + HTTP server on :24680)
McpHub serve            # Start HTTP-only server (SSE daemon)
McpHub install          # Register auto-start at login
McpHub uninstall        # Remove auto-start
McpHub generate         # Rebuild tool cache
McpHub dashboard        # Open web dashboard
McpHub status           # Show detected servers and cache info
McpHub search "git"     # Test BM25 search
McpHub doctor           # Full diagnostic (binary, config, cache, ports, daemon)
McpHub logs             # Tail daemon logs (--server, --level filters)
McpHub add              # Interactive wizard to add a server
McpHub benchmark        # Measure start time, ping latency, tool count, RAM
McpHub export           # Export config as encrypted bundle for sharing
McpHub import <file>    # Import config bundle
McpHub update           # Self-update from GitHub Releases
McpHub version          # Show version

Security

McpHub generates a unique auth token on first run, stored in ~/.McpHub/auth-token. All HTTP endpoints (SSE, API, dashboard) require Authorization: Bearer <token>. CORS preflight is handled automatically.

If a server crashes during a tools/call, McpHub auto-restarts it and retries the call once before returning an error.

Connection Pooling

McpHub can maintain multiple instances of a server for parallel request handling. Configure per server:

{
  "servers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "ghp_xxx" },
      "pool_size": 3
    }
  }
}

Requests are routed round-robin across pool instances. Default pool size is 1.

Protocol Support

McpHub implements the full MCP protocol as a proxy:

  • Tools: tools/list, tools/call (aggregated from all servers)
  • Resources: resources/list, resources/read (aggregated)
  • Prompts: prompts/list, prompts/get (aggregated)
  • Cancellation: notifications/cancelled forwarded to child servers
  • Logging: notifications/message captured and forwarded
  • Version negotiation: Adapts to each server's supported protocol version

Configuration

Config lives in ~/.McpHub/config.json:

{
  "servers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_TOKEN": "ghp_xxx" }
    }
  },
  "settings": {
    "mode": "discover",
    "idleTimeout": 300,
    "health": {
      "checkInterval": 30,
      "autoRestart": true,
      "notifications": true
    }
  }
}

Health monitoring

McpHub pings running servers periodically. If one crashes, you get a native OS notification and the server is auto-restarted with exponential backoff (up to 3 attempts).

Hot reload

Edit config.json while the daemon is running. McpHub detects changes, diffs the config, stops removed servers, and starts new ones without a restart.

Performance

Metric Value
Binary size ~1 MB
Startup <5 ms
BM25 search (460 tools) <0.01 ms
Context token savings ~99%
RAM usage ~5 MB
SSE keepalive overhead ~40 bytes/15s
Runtime dependencies None

Cross-platform auto-start

McpHub install detects your OS and creates the appropriate auto-start entry:

OS Method Location
macOS LaunchAgent ~/Library/LaunchAgents/com.soflution.mcphub.plist
Linux systemd user service ~/.config/systemd/user/mcphub.service
Windows Registry Run key HKCU\Software\Microsoft\Windows\CurrentVersion\Run

Pre-built binaries available for macOS ARM, macOS Intel, Linux amd64, Linux arm64, and Windows x64.

Uninstall

McpHub uninstall
rm ~/.local/bin/McpHub
rm -rf ~/.McpHub

License

MIT - SOFLUTION LTD