PM

ptbsare/mcp-proxy-server

开发工具

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

196 stars 17 forks 质量 67 趋势 0MIT

ptbsare/mcp-proxy-server 是从 https://github.com/ptbsare/mcp-proxy-server. 导入的 MCP 服务器候选服务器

概览

ptbsare/mcp-proxy-server 是从 https://github.com/ptbsare/mcp-proxy-server. 导入的 MCP 服务器候选服务器

概述(AI 翻译)

简体中文

✨ 主要特色亮点

  • ** 🌐 Web UI 管理:** 通过直观的网页界面(可选,需启用)轻松管理所有连接的 MCP 服务器。
  • ** 🔧 细粒化工具控制:** 启用或禁用单个工具,并通过网页界面覆盖名称/描述。
  • ** 🛡️ 灵活端点认证:** 用灵活的认证选项(Authorization: Bearer 或 X-API-Key: )保护基于 HTTP 的端点(/sse、/mcp)。
  • ** 🔄 强健会话处理与并发性**:
  • 改进了SSE会话处理,用于客户端重新连接(依赖服务器发送的endpoint事件),并支持并发连接。
  • 可流式HTTP端点(/mcp)也支持客户端并发交互。
  • ** 🚀 多功能MCP操作(服务器和代理):**
  • 作为代理: 连接并聚合多个不同类型的后端MCP服务器(Stdio、SSE、可流式HTTP)。
  • 作为服务器: 通过自身的可流式 HTTP ([/mcp) 和 SSE (/sse) 端点暴露这些聚合功能。也可以在纯 Stdio 模式下运行。
  • ** ✨ 实时安装输出**:直接在网页界面中监控Stdio服务器安装进度(stdout/stderr)。

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

README

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

MCP Proxy Server

简体中文

✨ Key Features Highlight

  • 🌐 Web UI Management: Easily manage all connected MCP servers through an intuitive web interface (optional, requires enabling).
  • 🔧 Granular Tool Control: Enable or disable individual tools, and override names/descriptions via the Web UI.
  • 🛡️ Flexible Endpoint Authentication: Secure your HTTP-based endpoints (/sse, /mcp) with flexible authentication options (Authorization: Bearer or X-API-Key: ).
  • 🔄 Robust Session Handling & Concurrency:
    • Improved SSE session handling for client reconnections (relying on server-sent endpoint events) and support for concurrent connections.
    • Streamable HTTP endpoint (/mcp) also supports concurrent client interactions.
  • 🚀 Versatile MCP Operations (Server & Proxy):
    • Acts as a Proxy: Connects to and aggregates multiple backend MCP servers of various types (Stdio, SSE, Streamable HTTP).
    • Acts as a Server: Exposes these aggregated capabilities through its own Streamable HTTP (/mcp) and SSE (/sse) endpoints. Can also run in a pure Stdio mode.
  • ✨ Real-time Install Output: Monitor Stdio server installation progress (stdout/stderr) directly in the Web UI.
  • ✨ Web Terminal: Access a command-line terminal within the Admin UI for direct server interaction (optional, use with caution due to security risks).

This server acts as a central hub for Model Context Protocol (MCP) resource servers. It can:

  • Connect to and manage multiple backend MCP servers (Stdio, SSE, and Streamable HTTP types).
  • Expose their combined capabilities (tools, resources) through a single, unified SSE interface, a Streamable HTTP interface, or act as a single Stdio-based MCP server itself.
  • Handle routing of requests to the appropriate backend servers.
  • Aggregate responses if needed (though primarily acts as a proxy).
  • Support multiple simultaneous SSE client connections with optional API key authentication.

Features

Resource & Tool Management via Proxy

  • Discovers and connects to multiple MCP resource servers defined in config/mcp_server.json.
  • Aggregates tools and resources from all connected active servers.
  • Routes tool calls and resource access requests to the correct backend server.
  • Maintains consistent URI schemes.

✨ Optional Web Admin UI (ENABLE_ADMIN_UI=true)

Provides a browser-based interface for managing the proxy server configuration and connected tools. Features include:

  • Server Configuration: View, add, edit, and delete server entries (mcp_server.json). Supports Stdio, SSE, and HTTP server types with relevant options (type, command, args, env, url, apiKey, bearerToken, install config).
  • Tool Configuration: View all tools discovered from active backend servers. Enable or disable specific tools. Override the display name and description for each tool (tool_config.json).
在 GitHub 查看完整 README

安装

docker run -d \
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "unique-server-key1": { "type": "stdio", "name": "My Stdio Server", "active": true, "command": "/path/to/server/executable", "args": ["--port", "1234"], "env": { "API_KEY": "server_specific_key" }, "installDirectory": "/custom_install_path/unique-server-key1", "installCommands": [ "git clone https://github.com/some/repo unique-server-key1", "cd unique-server-key1 && npm install && npm run build" ] }, "another-sse-server": { "type": "sse", "name": "My SSE Server", "active": true, "url": "http://localhost:8080/sse", "apiKey": "sse_server_api_key" }, "http-mcp-server": { "type": "http", "name": "My Streamable HTTP Server", "active": true, "url": "http://localhost:8081/mcp", "bearerToken": "some_secure_token_for_http_server" }, "stdio-default-install": { "type": "stdio", "name": "Stdio Server with Default Install Path", "active": true, "command": "my_other_server", "installCommands": ["echo 'Installing to default location...'"] } } }