IM

itsharex/mcp-gateway

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

0 stars 8 forks 质量 61 趋势 0GPL-3.0

基于Python的MCP网关

概览

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for more details. MCP Gateway is an application built with Python. It acts as a that connects to and aggregates capabilities from multiple backend MCP servers (whether they communicate via Stdio or SSE protocols). Ultimately, it exposes these aggregated capabilities to upstream MCP clients through a unified endpoint (/sse). 1. MCP clients only need to connect to the single address of the MCP Gateway to access the functionalities of all backend services, eliminating the need to configure each backend server individually. 2. Aggregates MCP tools with diverse capabilities from various sources, providing a foundation for building more powerful, customized agents focused on specific task domains. This project comes with four backend MCP Server tools that can be used directly and enabled in config.

README

以下为原文 README 节选,完整内容请查看原文。

MCP Gateway

English | 简体中文

License

This project is licensed under the GNU General Public License v3.0 - see the LICENSE file for more details.

Project Overview

MCP Gateway is an application built with Python. It acts as a central gateway that connects to and aggregates capabilities from multiple backend MCP servers (whether they communicate via Stdio or SSE protocols). Ultimately, it exposes these aggregated capabilities to upstream MCP clients through a unified SSE endpoint (/sse).

Core Advantages:

  1. Simplified Client Configuration: MCP clients only need to connect to the single address of the MCP Gateway to access the functionalities of all backend services, eliminating the need to configure each backend server individually.
  2. Capability Aggregation & Orchestration: Aggregates MCP tools with diverse capabilities from various sources, providing a foundation for building more powerful, customized agents focused on specific task domains.

Project File Structure

.
├── config.json                     # Core configuration file: Defines the backend MCP servers to connect to and manage.
├── main.py                         # Program entry point: Parses command-line arguments, sets up logging, and starts the web server.
├── bridge_app.py                   # Starlette application core: Handles forwarding of MCP requests and SSE connection management.
├── client_manager.py               # Client manager: Responsible for establishing and maintaining connection sessions with backend MCP servers.
├── capability_registry.py          # Capability registry: Dynamically discovers, registers, and manages capabilities provided by all backend MCP servers.
├── config_loader.py                # Configuration loader: Responsible for loading and strictly validating the format and content of the `config.json` file.
├── errors.py                       # Custom exceptions: Defines project-specific error types, such as configuration errors and backend server errors.
├── rich_handler.py                 # Rich logging handler: Provides beautified, structured console log output.
├── servers/                        # Contains built-in/example backend MCP server scripts.
│   ├── bash_server.py              # <-- Built-in Bash command execution tool (Linux/macOS/WSL)
│   ├── cmd_server.py               # <-- Built-in Windows CMD command execution tool (Windows Only)
│   ├── powershell_server.py        # <-- Built-in Windows PowerShell command execution tool (Windows Only)
│   └── wmi_server.py               # <-- Built-in Windows WMI query tool (Windows Only)
└── logs/                           # Log directory: Stores runtime log files (created automatically).

Built-in MCP Servers

This project comes with four backend MCP Server tools that can be used directly and enabled in config.json without additional configuration:

在 GitHub 查看完整 README

安装

npx @playwright/mcp@latest
新手?先看 mcpskill.org 教程 →