
MCP Server Gateway

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 服务器之间的协议兼容性问题。
核心功能
- 接受来自 Claude Desktop 的 stdio 输入
- 将请求转换为 HTTP/SSE 格式并转发给 MCP 服务器
- 将 SSE 响应转换回 stdio 格式返回给 Claude Desktop
适用场景
- 当 Claude Desktop 需要与仅支持 HTTP/SSE 的 MCP 服务器通信时
- 在需要桥接不同协议实现的 MCP 服务时
工具列表
@mcphub/gateway
: 网关服务本身,提供协议转换功能
常见问题解答
- 找不到网关路径: 使用
npm list -g @mcphub/gateway
查找 - Node.js 安装问题: 检查
node --version
和npm --version
- 权限问题: 可能需要使用
sudo
进行安装
使用教程
使用依赖
- Node.js 环境
安装教程
npm install -g @mcphub/gateway
配置步骤
- 查找网关路径:
npm root -g
- 配置 Claude Desktop:
{
"mcpServers": {
"server-name": {
"command": "node",
"args": ["path/to/mcphub-gateway.js"]
}
}
}
- 设置 MCP 服务器 URL:
export MCP_SERVER_URL=https://your-mcp-server.com/api/mcp
调试方式
- 检查网关安装:
npm list -g @mcphub/gateway
- 验证 Node.js 安装:
node --version
npm --version
- 解决 Homebrew 链接问题:
brew doctor
brew link node