Supergateway
通过SSE运行MCP标准输入输出服务器,以及通过标准输入输出运行SSE。AI网关。
Supergateway 允许您通过 SSE (服务器发送事件) 或 WebSockets (WS) 运行基于 MCP stdio 的服务器,方便远程访问和调试。
安装
无需安装,直接通过 npx
运行:
npx -y supergateway --stdio "uvx mcp-server-git"
基本用法
stdio → SSE 模式(将本地 MCP 暴露为 SSE)
npx -y supergateway --stdio "npx -y @modelcontextprotocol/server-filesystem ./my-folder" --port 8000
访问点:
- 订阅事件:
GET http://localhost:8000/sse
- 发送消息:
POST http://localhost:8000/message
SSE → stdio 模式(连接远程 SSE 服务器)
npx -y supergateway --sse "https://mcp-server-example.supermachine.app"
stdio → WS 模式(将本地 MCP 暴露为 WebSocket)
npx -y supergateway --stdio "命令" --outputTransport ws --port 8000
访问点:
- WebSocket 端点:
ws://localhost:8000/message
常用选项
--stdio "command"
: 在 stdio 上运行的 MCP 服务器命令--sse "url"
: 要连接的 SSE URL--port 8000
: 监听端口(默认: 8000)--outputTransport stdio|sse|ws
: 输出传输方式--cors
: 启用 CORS--logLevel info|none
: 控制日志级别
使用 Docker
docker run -it --rm -p 8000:8000 supercorp/supergateway --stdio "npx -y @modelcontextprotocol/server-filesystem /" --port 8000
与 Claude Desktop 集成
在 Claude Desktop 配置中添加:
{
"mcpServers": {
"supergatewayExample": {
"command": "npx",
"args": [
"-y",
"supergateway",
"--sse",
"https://mcp-server-example.supermachine.app"
]
}
}
}
高级使用:公开共享(使用 ngrok)
# 终端 1
npx -y supergateway --port 8000 --stdio "npx -y @modelcontextprotocol/server-filesystem ."
# 终端 2
ngrok http 8000
由 Supermachine、Superinterface 和 Supercorp 支持。详细文档和源码:GitHub