MCP Server Gateway

MCP Server Gateway

site icon
2024.12.08 102
JavaScript协议转换网关服务开发效率
MCP Server Gateway 是一个网关服务,用于桥接基于 stdio 的 Model Context Protocol (MCP) 实现与基于 HTTP/SSE 的 MCP 服务器之间的通信。它解决了 Claude Desktop 目前仅支持基于 stdio 的 MCP 服务器的协议兼容性问题。
View on GitHub

Overview

基本能力

产品定位

MCP Server Gateway 是一个协议转换网关,旨在解决 Claude Desktop 与 HTTP/SSE MCP 服务器之间的协议兼容性问题。

核心功能

  1. 接受来自 Claude Desktop 的 stdio 输入
  2. 将请求转换为 HTTP/SSE 格式并转发给 MCP 服务器
  3. 将 SSE 响应转换回 stdio 格式返回给 Claude Desktop

适用场景

  • 当 Claude Desktop 需要与仅支持 HTTP/SSE 的 MCP 服务器通信时
  • 在需要桥接不同协议实现的 MCP 服务时

工具列表

  • @mcphub/gateway: 网关服务本身,提供协议转换功能

常见问题解答

  1. 找不到网关路径: 使用 npm list -g @mcphub/gateway 查找
  2. Node.js 安装问题: 检查 node --versionnpm --version
  3. 权限问题: 可能需要使用 sudo 进行安装

使用教程

使用依赖

  • Node.js 环境

安装教程

npm install -g @mcphub/gateway

配置步骤

  1. 查找网关路径:
npm root -g
  1. 配置 Claude Desktop:
{
  "mcpServers": {
    "server-name": {
      "command": "node",
      "args": ["path/to/mcphub-gateway.js"]
    }
  }
}
  1. 设置 MCP 服务器 URL:
export MCP_SERVER_URL=https://your-mcp-server.com/api/mcp

调试方式

  1. 检查网关安装:
npm list -g @mcphub/gateway
  1. 验证 Node.js 安装:
node --version
npm --version
  1. 解决 Homebrew 链接问题:
brew doctor
brew link node

许可证

该项目遵循 Apache-2.0 开源许可条款,请参阅 Apache-2.0 了解完整条款。