OmniMCP Router

OmniMCP Router

A universal MCP gateway that aggregates multiple MCP servers into a single endpoint, providing features like hot-reload, auto-healing, and a hook system for request/response mutation.

Category
访问服务器

README

<div align="center">

OmniMCP Router

The Universal MCP Gateway — One Entry Point to Rule All Your AI Tools

Python 3.10+ MCP Protocol License: MIT Tests Code style: black

Plug any MCP server. Claude sees them all as one.

Features • Quick Start • Configuration • Tests • Client Setup • Contributing

</div>


The Problem

You have 10 MCP servers: GitHub, Reddit, Notion, Stripe, a custom scraper…
Your Claude Desktop config is a mess. Each client can only talk to one server at a time.
Every crash brings everything down. There's no observability. No resilience.

OmniMCP fixes all of that.


Features

Feature Description
Zero Hard-Coded Tools Dynamically discovers tools from every sub-server at startup
Async Non-Blocking Routing Parallel requests routed concurrently via anyio — no bottleneck
Auto-Healing Exponential backoff reconnection when a sub-server crashes
Hot-Reload Detects mcp_router_config.json changes live — no restart needed
Hook System Mutate, intercept, and validate requests/responses in middleware pipelines
Performance Monitoring Real-time profiling with PERF_WARNING for tools exceeding 5s
Isolated Lifecycle Each sub-server has its own AsyncExitStack — one crash ≠ global failure
Safe Namespacing Tools exposed as {server}__{tool}, sanitized to MCP spec ([a-zA-Z0-9_-]{1,64})
Persistent Logging All logs written to mcp_router.log + stderr (captured by Claude)
JSON Schema Validation Strict input validation before forwarding any tool call
Response Truncation Hook Auto-truncates responses >50k chars to protect context windows
Windows + Linux Signal handling for both platforms

Quick Start

# 1. Clone the repo
git clone https://github.com/Simonc44/OmniMCP.git
cd OmniMCP

# 2. Install dependencies (Python 3.10+ required)
pip install -r requirements.txt

# 3. Edit your config
notepad mcp_router_config.json   # Windows
# or: nano mcp_router_config.json

# 4. Run it
python router.py --config mcp_router_config.json

That's it. OmniMCP starts, connects to all your sub-servers, and exposes a single unified MCP stdio interface.


Project Structure

OmniMCP/
├── router.py                  #  Core gateway — routing, healing, hot-reload, hooks
├── mock_server.py             #  Lightweight mock MCP server for testing
├── run_integration_test.py    #  Full integration test suite (async, healing, hot-reload)
├── mcp_router_config.json     #   Production config — your real MCP servers go here
├── test_config.json           #  Test config — uses mock_server.py instances
├── requirements.txt           #  Dependencies: mcp, pydantic, jsonschema, anyio
├── docs/                      #  Architecture diagrams and assets
├── .github/
│   ├── workflows/ci.yml       #  GitHub Actions CI pipeline
│   └── ISSUE_TEMPLATE/        #  Bug report & feature request templates
├── CHANGELOG.md               #  Version history
├── CONTRIBUTING.md            #  Contribution guide
└── LICENSE                    #   MIT License

Configuration

The config file follows the exact same syntax as claude_desktop_config.json — so you can copy-paste your existing Claude Desktop config directly.

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github"],
      "env": { "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_xxxx" }
    },
    "reddit": {
      "command": "python",
      "args": ["C:/path/to/reddit/server.py"],
      "env": {
        "REDDIT_CLIENT_ID": "your_client_id",
        "REDDIT_CLIENT_SECRET": "your_secret",
        "REDDIT_USER_AGENT": "OmniMCP/1.0"
      }
    },
    "trend-mining": {
      "command": "python",
      "args": ["-m", "trend_mining.server"],
      "env": { "PLAYWRIGHT_HEADLESS": "true" }
    }
  }
}

Tools are exposed as {server_name}__{tool_name} — e.g. github__create_issue, reddit__search_posts.

Hot-Reload

OmniMCP watches your config file every 2 seconds. Add, remove, or modify a server — it reconnects live and sends notifications/tools/list_changed to your client. No restart needed.


Tests

The integration test suite validates the full feature set end-to-end:

python run_integration_test.py
# Test What it validates
1 Aggregation All tools from all sub-servers are discovered and exposed
2 Async Parallelism Two 2s calls finish in ~2s total, not 4s
3 Perf Monitoring A 6s call triggers PERF_WARNING in logs
4 Auto-Healing Server crash → automatic reconnect → tool works again
5 Hot-Reload Config change → list_changed notification → updated tool list

Client Setup

Claude Desktop

Replace your entire claude_desktop_config.json with just OmniMCP:

{
  "mcpServers": {
    "omni-mcp": {
      "command": "python",
      "args": [
        "C:/path/to/OmniMCP/router.py",
        "--config",
        "C:/path/to/OmniMCP/mcp_router_config.json"
      ]
    }
  }
}

Cursor

In Cursor MCP settings, add a stdio server:

  • Name: OmniMCP
  • Command: python C:/path/to/OmniMCP/router.py --config C:/path/to/OmniMCP/mcp_router_config.json

Hook System

OmniMCP ships with a middleware pipeline for request/response mutation:

# Register a custom request hook (e.g. inject auth)
@gateway.hook_system.register_request_hook
async def inject_auth(server_name: str, tool_name: str, arguments: dict) -> dict:
    if server_name == "my-api":
        arguments["api_key"] = os.environ["MY_SECRET_KEY"]
    return arguments

# Register a custom response hook (e.g. redact PII)
@gateway.hook_system.register_response_hook
async def redact_pii(server_name, tool_name, result):
    # process result.content here
    return result

Built-in hooks:

  • Response Truncation — auto-truncates responses >50,000 chars with a clear notice

Resilience Architecture

┌──────────────────────────────────────────────────────┐
│              Claude Desktop / Cursor                  │
└──────────────────────┬───────────────────────────────┘
                       │ stdio (single MCP connection)
┌──────────────────────▼───────────────────────────────┐
│                  OmniMCP Router                       │
│  ┌─────────────────────────────────────────────────┐ │
│  │  Hook System │  Schema Validator  │   Profiler   │ │
│  └─────────────────────────────────────────────────┘ │
│  ┌──────────────┐ ┌──────────────┐ ┌────────────┐   │
│  │SubServer A   │ │SubServer B   │ │SubServer C │   │
│  │ connected  │ │ reconnecting│ │ connected│   │
│  │Auto-Healing  │ │Backoff: 4s   │ │            │   │
│  └──────────────┘ └──────────────┘ └────────────┘   │
└──────────────────────────────────────────────────────┘

If Sub-Server B crashes:

  • Its tools are hidden from the tool list
  • A reconnect loop starts with exponential backoff (1s → 2s → 4s → 8s → 16s)
  • On success: tools reappear, client gets notifications/tools/list_changed
  • After 5 failed attempts: marked failed, loop stops
  • Sub-Servers A and C are completely unaffected

Contributing

PRs are welcome! See CONTRIBUTING.md for guidelines.

  1. Fork the repo
  2. Create your branch: git checkout -b feat/my-feature
  3. Run tests: python run_integration_test.py
  4. Open a PR against main

Changelog

See CHANGELOG.md.


License

MIT — see LICENSE.


<div align="center">

Made for the MCP ecosystem If this saved you hours, drop a star

</div>

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选