MCP Hub

SSE

by ravitemer

502 3.8k downloads Not rated yet MIT

About

A centralized manager for Model Context Protocol (MCP) servers with dynamic server management and monitoring

Details

Transport
SSE
License
MIT

Explore

- Unified MCP Server Endpoint (/mcp):
- Single endpoint for ALL MCP clients to connect to
- Access capabilities from all managed servers through one connection
- Automatic namespacing prevents conflicts between servers
- Real-time capability updates when servers change
- Simplified client configuration - just one endpoint instead of many

- Dynamic Server Management:
- Start, stop, enable/disable servers on demand
- Real-time configuration updates with automatic server reconnection
- Support for local (STDIO) and remote (streamable-http/SSE) MCP servers
- Health monitoring and automatic recovery
- OAuth authentication with PKCE flow
- Header-based token authentication

- Unified REST API:
- Execute tools from any connected server
- Access resources and resource templates
- Real-time status updates via Server-Sent Events (SSE)
- Full CRUD operations for server management

- Real-time Events & Monitoring:
- Live server status and capability updates
- Client connection tracking
- Tool and resource list change notifications
- Structured JSON logging with file output

- Client Connection Management:
- Simple SSE-based client connections via /api/events
- Automatic connection cleanup on disconnect
- Optional auto-shutdown when no clients connected
- Real-time connection state monitoring

- Process Lifecycle Management:
- Graceful startup and shutdown handling
- Proper cleanup of server connections
- Error recovery and reconnection

- Workspace Management:
- Track active MCP Hub instances across different working directories
- Global workspace cache in XDG-compliant state directory
- Real-time workspace updates via SSE events
- API endpoints to list and monitor active workspaces

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name MCP Hub
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

npm install -g mcp-hub

Configure all MCP clients with just one endpoint:

{
"mcpServers" : {
"Hub": {
"url" : "http://localhost:37373/mcp"
}
}
}

The Hub automatically:
- Namespaces capabilities to prevent conflicts (e.g., filesystem__search vs database__search)
- Routes requests to the appropriate server
- Updates capabilities in real-time when servers are added/removed
- Handles authentication and connection management

Start the hub server:

mcp-hub --port 3000 --config path/to/config.json

mcp-hub --port 3000 --config ~/.config/mcphub/global.json --config ./.mcphub/project.json

MCP Hub provides seamless compatibility with VS Code's .vscode/mcp.json configuration format, enabling you to use the same configuration files across both VS Code and MCP Hub.

Both mcpServers and servers keys are supported:

{
  "servers": {
    "github": {
      "url": "https://api.githubcopilot.com/mcp/"
    },
    "perplexity": {
      "command": "npx", 
      "args": ["-y", "server-perplexity-ask"],
      "env": {
        "API_KEY": "${env:PERPLEXITY_API_KEY}"
      }
    }
  }
}

{
"servers": {
"myserver": {
"env": {
"API_KEY": "${input:api-key}"
}
}
}
}


MCP Hub supports loading multiple configuration files that are merged in order. This enables flexible configuration management:

- Global Configuration: System-wide settings (e.g., ~/.config/mcphub/global.json)
- Project Configuration: Project-specific settings (e.g., ./.mcphub/project.json)
- Environment Configuration: Environment-specific overrides

When multiple config files are specified, they are merged with later files overriding earlier ones:

bash

mcp-hub --port 3000 --config ~/.config/mcphub/global.json --config ./.mcphub/project.json


Merge Behavior:
- mcpServers sections are merged (server definitions from later files override earlier ones)
- Other top-level properties are completely replaced by later files
- Missing config files are silently skipped

MCP Hub supports both STDIO servers and remote servers (streamable-http/SSE). The server type is automatically detected from the configuration. All fields support the universal ${} placeholder syntax.

MCP Hub will look for the environment variable MCP_HUB_ENV (a JSON string) in its own process environment. If set, all key-value pairs from this variable will be injected into the environment of every managed MCP server (both stdio and remote). This is useful for passing secrets, tokens, or other shared configuration to all servers without repeating them in each server config.

- Server-specific env fields always override values from MCP_HUB_ENV.
- Example usage:

sh
MCP_HUB_ENV='{"DBUS_SESSION_BUS_ADDRESS":"/run/user/1000/bus","MY_TOKEN":"abc"}' mcp-hub --port 3000 --config path/to/config.json

> coming...

Just add it to your NixOS flake.nix or home-manager:

nix
inputs = {
mcp-hub.url = "github:ravitemer/mcp-hub";
...
}

To integrate mcp-hub to your NixOS/Home Manager configuration, add the following to your environment.systemPackages or home.packages respectively:

nix
inputs.mcp-hub.packages."${system}".default

If you want to use mcphub.nvim without having mcp-hub server in your PATH you can link the server under the hood adding
the mcp-hub nix store path to the cmd command in the plugin config like

Nixvim example:

nix
{ mcphub-nvim, mcp-hub, ... }:
{
extraPlugins = [mcphub-nvim];
extraConfigLua = ''
require("mcphub").setup({
port = 3000,
config = vim.fn.expand("~/mcp-hub/mcp-servers.json"),
cmd = "${mcp-hub}/bin/mcp-hub"
})
'';
}

POST /api/servers/tools
Content-Type: application/json

{
"server_name": "example-server",
"tool": "tool_name",
"arguments": {},
"request_options" : {}
}

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "mcp hub": {
            "Hub": {
                "url": "http://localhost:37373/mcp"
            }
        }
    }
}

McpServers

{
    "Hub": {
        "url": "http://localhost:37373/mcp"
    }
}

npm version
License: MIT
PRs Welcome

MCP Hub acts as a central coordinator for MCP servers and clients, providing two key interfaces:

1. Management Interface (/api/*): Manage multiple MCP servers through a unified REST API and web UI
2. MCP Server Interface (/mcp): Connect ANY MCP client to access ALL server capabilities through a single endpoint

This dual-interface approach means you can manage servers through the Hub's UI while MCP clients (Claude Desktop, Cline, etc.) only need to connect to one endpoint (localhost:37373/mcp) to access all capabilities. Implements MCP 2025-03-26 specification.

Feature Support

| Category | Feature | Support | Notes |
|----------|---------|---------|-------|
| Transport ||||
| | streamable-http | ✅ | Primary transport protocol for remote servers |
| | SSE | ✅ | Fallback transport for remote servers |
| | STDIO | ✅ | For running local servers |
| Authentication ||||
| | OAuth 2.0 | ✅ | With PKCE flow |
| | Headers | ✅ | For API keys/tokens |
| Capabilities ||||
| | Tools | ✅ | List tools |
| | 🔔 Tool List Changed | ✅ | Real-time updates |
| | Resources | ✅ | Full support |
| | 🔔 Resource List Changed | ✅ | Real-time updates |
| | Resource Templates | ✅ | URI templates |
| | Prompts | ✅ | Full support |
| | 🔔 Prompts List Changed | ✅ | Real-time updates |
| | Roots | ❌ | Not supported |
| | Sampling | ❌ | Not supported |
| | Completion | ❌ | Not supported |
| Marketplace ||||
| | Server Discovery | ✅ | Browse available servers |
| | Installation | ✅ | Auto configuration |
| Real-time ||||
| | Status Updates | ✅ | Server & connection state |
| | Capability Updates | ✅ | Automatic refresh |
| | Event Streaming to clients | ✅ | SSE-based |
| | Auto Reconnection | ✅ | With backoff |
| Development ||||
| | Hot Reload | ✅ | Auto restart a MCP server on file changes with dev mode |
| Configuration ||||
| | ${} Syntax | ✅ | Environment variables and command execution across all fields |
| | VS Code Compatibility | ✅ | Support for servers key, ${env:}, ${input:}, predefined variables |
| | JSON5 Support | ✅ | Comments and trailing commas in configuration files |

Simplified Client Configuration

Configure all MCP clients with just one endpoint:

{
"mcpServers" : {
"Hub": {
"url" : "http://localhost:37373/mcp"
}
}
}

The Hub automatically:
- Namespaces capabilities to prevent conflicts (e.g., filesystem__search vs database__search)
- Routes requests to the appropriate server
- Updates capabilities in real-time when servers are added/removed
- Handles authentication and connection management

Key Features

- Unified MCP Server Endpoint (/mcp):
- Single endpoint for ALL MCP clients to connect to
- Access capabilities from all managed servers through one connection
- Automatic namespacing prevents conflicts between servers
- Real-time capability updates when servers change
- Simplified client configuration - just one endpoint instead of many

- Dynamic Server Management:
- Start, stop, enable/disable servers on demand
- Real-time configuration updates with automatic server reconnection
- Support for local (STDIO) and remote (streamable-http/SSE) MCP servers
- Health monitoring and automatic recovery
- OAuth authentication with PKCE flow
- Header-based token authentication

- Unified REST API:
- Execute tools from any connected server
- Access resources and resource templates
- Real-time status updates via Server-Sent Events (SSE)
- Full CRUD operations for server management

- Real-time Events & Monitoring:
- Live server status and capability updates
- Client connection tracking
- Tool and resource list change notifications
- Structured JSON logging with file output

- Client Connection Management:
- Simple SSE-based client connections via /api/events
- Automatic connection cleanup on disconnect
- Optional auto-shutdown when no clients connected
- Real-time connection state monitoring

- Process Lifecycle Management:
- Graceful startup and shutdown handling
- Proper cleanup of server connections
- Error recovery and reconnection

- Workspace Management:
- Track active MCP Hub instances across different working directories
- Global workspace cache in XDG-compliant state directory
- Real-time workspace updates via SSE events
- API endpoints to list and monitor active workspaces

Components

Hub Server
The main management server that: - Maintains connections to multiple MCP servers - Provides unified API access to server capabilities - Handles server lifecycle and health monitoring - Manages SSE client connections and events - Processes configuration updates and server reconnection
MCP Servers
Connected services that: - Provide tools, resources, templates, and prompts - Support two connectivity modes: - Script-based STDIO servers for local operations - Remote servers (streamable-http/SSE) with OAuth support - Implement real-time capability updates - Support automatic status recovery - Maintain consistent interface across transport types

Installation

npm install -g mcp-hub

Basic Usage

Start the hub server:

```bash
mcp-hub --port 3000 --config path/to/config.json

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.

Videos about MCP Hub

Relevant YouTube tutorials, setups, and demos