Start the hub

April 17, 2026 · View on GitHub

SLM MCP Hub

SLM MCP Hub

The World's First MCP Gateway That Learns

One hub process. Every MCP server. Every AI client. Shared across sessions.
Federated tool discovery with memory, learning, and cost intelligence.

PyPI npm AGPL v3 Qualixar


The Problem

Every AI coding session spawns its own MCP server processes. Five Claude Code sessions with 36 MCPs means 180 OS processes eating ~9GB RAM. Each session loads ~150K tokens of tool definitions into the context window. On a 200K-context model, 75% is gone before you type anything.

And every session starts from zero. No shared cache. No cost tracking. No learning. No coordination between sessions.

The Solution

SLM MCP Hub runs all your MCPs in one shared process. Every AI client connects to one HTTP endpoint. The hub federates, caches, tracks costs, and — with SuperLocalMemory — learns from every tool call.

MetricWithout HubWith Hub
Processes (5 sessions, 36 MCPs)18037 (79% reduction)
RAM usage~9 GB~1.9 GB
Session startup~30s (spawn 36 processes)Instant (HTTP connect)
Tool definitions in context400+ tools (~150K tokens)3 meta-tools (~1K tokens)
Config managementPer-IDE, per-sessionOne hub config
Learning across sessionsNoneAutomatic (with SLM plugin)

How It Works

Federated Mode — 3 Tools Instead of 400+

Instead of loading 400+ tool definitions into every session, Claude gets 3 meta-tools:

Meta-ToolWhat It Does
hub__search_toolsSearch all tools by name or description. Returns full input schemas.
hub__call_toolCall any tool on any MCP server. Routes automatically.
hub__list_serversList all connected servers and their tool counts.
You:     "Search GitHub for qualixar repos"
Claude:  hub__search_tools(query="github search")
Hub:     Found: github__search_repositories, github__search_code, ...

Claude:  hub__call_tool(tool="github__search_repositories", arguments={"query": "qualixar"})
Hub:     Routes to GitHub MCP → returns real results

3 tool definitions instead of 400+. That's 150K tokens saved per session.


Quick Start

# Install
pip install slm-mcp-hub

# Initialize and import your MCPs
slm-hub config init
slm-hub setup import ~/.claude.json

# Start the hub
slm-hub start

Connect Claude Code

Add to ~/.claude.json:

{
  "mcpServers": {
    "hub": {
      "type": "http",
      "url": "http://127.0.0.1:52414/mcp"
    }
  }
}

Restart Claude Code. All tools available through hub__search_tools and hub__call_tool.


SLM Plugin — The Gateway That Learns

When SuperLocalMemory is running, the hub automatically connects to it and learns from every tool call. No configuration needed.

SLM MCP Hub v0.1.0 running on http://127.0.0.1:52414/mcp
  MCP servers: 37/37 connected
  Tools: 345
  Plugins: 2 (slm, mesh)         ← Auto-discovered
  SLM: connected (mode=b, 4461 facts)

What the SLM Plugin Does

HookWhat HappensSLM Endpoint
Session startRecalls relevant context from past sessionsPOST /api/v3/recall/trace
Every tool callLogs to SLM's learning pipeline — tool name, duration, success/failurePOST /api/v3/tool-event
Session endPersists session summary for future recallPOST /api/v3/tool-event (session_end type)
Warm-up predictionPredicts which MCPs you'll need based on recent historyLocal ring buffer

How It Works Under the Hood

The SLM plugin communicates with the SLM daemon via its HTTP API at localhost:8765. No Python import of superlocalmemory required — pure HTTP integration. This means:

  • Hub works standalone when SLM is not installed (all hooks are no-ops)
  • Hub auto-discovers SLM daemon on startup
  • Same SLM daemon serves both the hub plugin AND direct Claude Code hooks
  • Every tool call routed through hub__call_tool triggers the learning pipeline

For End Users: SLM Through the Hub

If you use SuperLocalMemory, you can put it inside the hub like any other MCP:

slm-hub setup import ~/.claude.json   # Imports all MCPs including SLM
slm-hub start                          # SLM runs as a hub backend

The SLM plugin replaces the need for separate Claude Code hooks:

  • on_session_start replaces the session_init hook
  • on_tool_call_after replaces the PostToolUse hook
  • on_session_end replaces the Stop hook

Zero manual hook configuration. The hub handles it.


Mesh Plugin — Cross-Session Coordination

When the SLM daemon has mesh enabled, the hub registers as a mesh peer and coordinates across sessions:

FeatureWhat It Does
Peer registrationHub appears on the mesh as an mcp-hub agent type
Tool usage broadcastOther sessions see which tools are being used
Session notificationsMesh peers notified when sessions start/end
Tool list changesMCP connect/disconnect events broadcast to mesh
Distributed lockingPrevent conflicts when multiple sessions access the same resource

The mesh plugin uses the SLM daemon's mesh HTTP API at localhost:8765/mesh/*. Like the SLM plugin, it auto-discovers and is a no-op when mesh is not available.


What Works Today (v0.1.0)

FeatureStatus
Federation — All MCPs behind single endpointWorking
Federated Mode — 3 meta-tools, ~150K token savingsWorking
Transparent Proxy — /mcp/{server}, original tool namesWorking
SLM Plugin — Tool call learning, session recall, summariesWorking
Mesh Plugin — Peer registration, broadcast, distributed locksWorking
Intelligent Caching — SHA-256 content-hash, TTL, LRUWorking
Cost Tracking — Per-tool costs, session budgets, cascade routingWorking
Smart Tool Filtering — Project-type detection, frequency rankingWorking
Multi-Client Auto-Setup — Claude Code, VS Code, Cursor, Windsurf, Codex CLIWorking
Observability — Per-server metrics, request tracing, audit logWorking
Lifecycle Management — Lazy startup, idle shutdown, always-onWorking
Permission Model — Per-session role-based rules (ALLOW/DENY/WARN)Working
Resilience — Auto-restart (launchd/systemd), PID managementWorking
Network Discovery — mDNS/Zeroconf LAN discoveryWorking
Secrets — ~/.claude-secrets.env loading, ${VAR} resolutionWorking
HTTP + stdio + SSE transportWorking

Architecture

                    ┌───────────────────────────────────────────────┐
                    │             SLM MCP Hub                       │
AI Client 1 ──┐    │                                               │    ┌── GitHub (26 tools)
AI Client 2 ──┼────┤  Federation → Cache → Cost → Route ──────────┼────┤── Gemini (37 tools)
AI Client 3 ──┘    │       ↕           ↕         ↕                │    ├── Context7 (2 tools)
                    │   Permissions  Metrics   Learning            │    ├── SLM (32 tools)
                    │       ↕                     ↕                │    ├── SQLite (8 tools)
                    │  ┌─────────┐          ┌──────────┐           │    └── ...37+ more
                    │  │   SLM   │          │   Mesh   │           │
                    │  │ Plugin  │          │  Plugin  │           │
                    │  └────┬────┘          └────┬─────┘           │
                    └───────┼────────────────────┼─────────────────┘
                            │                    │
                            └────────┬───────────┘

                           SLM Daemon (localhost:8765)
                           Memory · Learning · Mesh

Plugin Architecture

Plugins are discovered automatically via Python entry_points on hub startup. Each plugin receives lifecycle hooks:

class HubPlugin(ABC):
    async def on_hub_start(self, hub) -> None: ...
    async def on_hub_stop(self) -> None: ...
    async def on_tool_call_after(self, session_id, server, tool, args, result, duration_ms, success) -> None: ...
    async def on_session_start(self, session_id, client_info) -> None: ...
    async def on_session_end(self, session_id) -> None: ...
    async def on_mcp_connect(self, server_name) -> None: ...
    async def on_mcp_disconnect(self, server_name) -> None: ...

Built-in plugins:

PluginConnectionWhat It Adds
slmHTTP → localhost:8765/api/v3/*Memory, learning, session recall, warm-up predictions
meshHTTP → localhost:8765/mesh/*Peer discovery, broadcast, distributed locks

CLI Reference

slm-hub start [--port PORT] [--config PATH] [--log-level LEVEL]
slm-hub status
slm-hub config show | init | import <file>
slm-hub setup detect | register | unregister | import
slm-hub network discover | info

Configuration

Hub config: ~/.slm-mcp-hub/config.json

Environment overrides: SLM_HUB_PORT, SLM_HUB_HOST, SLM_HUB_LOG_LEVEL, SLM_HUB_CONFIG_DIR, SLM_DAEMON_URL.

Secrets: ~/.claude-secrets.env (shared with Claude Code). All ${VAR} placeholders resolve on startup.


Documentation

GuideWhat You'll Learn
Getting StartedInstall, import, connect, verify — 5 minutes
ArchitectureTwo modes, plugin system, tool call flow
Migration GuideStep-by-step from direct MCPs to hub, rollback
ConfigurationAll settings, API endpoints, CLI reference

Part of the Qualixar Ecosystem

SLM MCP Hub is the tool brain — it manages, routes, and learns from MCP tool calls. It joins the Qualixar suite of AI agent reliability tools:

ProductWhat It DoesInstall
SuperLocalMemoryLocal-first AI agent memory — Fisher-Rao geometry, 5-channel retrieval, zero cloudnpm install superlocalmemory
SLM MeshPeer-to-peer agent communication — real-time messaging, file locking, shared statenpm install slm-mesh
SLM MCP HubIntelligent MCP gateway — federation, caching, cost tracking, learning (this repo)pip install slm-mcp-hub
Qualixar OSUniversal OS for AI agents — 12 topologies, Forge AI, 24-tab dashboardnpx qualixar-os
AgentAssertBehavioral contracts for AI agents — ContractSpec DSL, drift detectionpip install agentassert-abc
AgentAssayToken-efficient agent evaluation — 78-100% cost reduction, 10 adapterspip install agentassay
SkillFortifyAgent skill security analysis — 100% precision, 22 frameworks, 3 citationspip install skillfortify

Together: SuperLocalMemory (memory brain) + SLM Mesh (connected brain) + SLM MCP Hub (tool brain) = complete AI intelligence platform. Each works standalone. Together: unstoppable.


Competitive Landscape

ToolStarsWhat It DoesWhat's Missing
mcp-hub472HTTP federationNo memory, no cost tracking, no learning
Supergateway2,573Stdio-to-SSE bridgeBroadcasts all responses to all clients
mcpmu87Stdio multiplexerPer-client process spawn, no sharing
mcp-proxy249Stdio-to-HTTPNew process per session
SLM MCP Hub-Federation + memory + learning + cost + meshThe only gateway that learns

Author

Varun Pratap Bhardwaj · qualixar.com · superlocalmemory.com · varunpratap.com

7 research papers · 6 open source products · Building the AI Agent Reliability category.

License

AGPL-3.0-or-later. See LICENSE.

Commercial licensing: admin@qualixar.com


⭐ Support This Project

If this project solves a real problem for you, please star the repo — it helps other developers discover Qualixar and signals that the AI agent reliability community is growing. Every star matters.

Star History Chart


Part of the Qualixar AI Agent Reliability Platform

Qualixar is building the open-source infrastructure for AI agent reliability engineering. Seven products, seven peer-reviewed papers, one coherent platform. Each tool solves one reliability pillar:

ProductPurposeInstallPaper
SuperLocalMemoryPersistent memory + learning for AI agentsnpx superlocalmemoryarXiv:2604.04514
Qualixar OSUniversal agent runtime (13 execution topologies)npx qualixar-osarXiv:2604.06392
SLM MeshP2P coordination across AI agent sessionsnpm i slm-mesh
SLM MCP HubFederate 430+ MCP tools through one gatewaypip install slm-mcp-hub
AgentAssayToken-efficient AI agent testingpip install agentassayarXiv:2603.02601
AgentAssertBehavioral contracts + drift detectionpip install agentassert-abcarXiv:2602.22302
SkillFortifyFormal verification for AI agent skillspip install skillfortifyarXiv:2603.00195

Zero cloud dependency. Local-first. EU AI Act compliant.

Start here → qualixar.com · All papers on Qualixar HuggingFace