Cover image
Try Now
4 天前

通过SSE和SSE通过STDIO运行MCP STDIO服务器。 AI网关。

3 years

Works with Finder

4

Github Watches

64

Github Forks

830

Github Stars

Supergateway: Run stdio MCP servers over SSE and WS

Supergateway runs MCP stdio-based servers over SSE (Server-Sent Events) or WebSockets (WS) with one command. This is useful for remote access, debugging, or connecting to clients when your MCP server only supports stdio.

Supported by Supermachine (hosted MCPs), Superinterface, and Supercorp.

Installation & Usage

Run Supergateway via npx:

npx -y supergateway --stdio "uvx mcp-server-git"
  • --stdio "command": Command that runs an MCP server over stdio
  • --sse "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app": SSE URL to connect to (SSE→stdio mode)
  • --outputTransport stdio | sse | ws: Output MCP transport (default: sse with --stdio, stdio with --sse)
  • --port 8000: Port to listen on (stdio→SSE or stdio→WS mode, default: 8000)
  • --baseUrl "http://localhost:8000": Base URL for SSE or WS clients (stdio→SSE mode; optional)
  • --ssePath "/sse": Path for SSE subscriptions (stdio→SSE mode, default: /sse)
  • --messagePath "/message": Path for messages (stdio→SSE or stdio→WS mode, default: /message)
  • --header "x-user-id: 123": Add one or more headers (stdio→SSE or SSE→stdio mode; can be used multiple times)
  • --oauth2Bearer "some-access-token": Adds an Authorization header with the provided Bearer token
  • --logLevel info | none: Controls logging level (default: info). Use none to suppress all logs.
  • --cors: Enable CORS (stdio→SSE or stdio→WS mode). Use --cors with no values to allow all origins, or supply one or more allowed origins (e.g. --cors "http://example.com" or --cors "/example\\.com$/" for regex matching).
  • --healthEndpoint /healthz: Register one or more endpoints (stdio→SSE or stdio→WS mode; can be used multiple times) that respond with "ok"

stdio → SSE

Expose an MCP stdio server as an SSE server:

npx -y supergateway \
    --stdio "npx -y @modelcontextprotocol/server-filesystem ./my-folder" \
    --port 8000 --baseUrl http://localhost:8000 \
    --ssePath /sse --messagePath /message
  • Subscribe to events: GET http://localhost:8000/sse
  • Send messages: POST http://localhost:8000/message

SSE → stdio

Connect to a remote SSE server and expose locally via stdio:

npx -y supergateway --sse "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app"

Useful for integrating remote SSE MCP servers into local command-line environments.

You can also pass headers when sending requests. This is useful for authentication:

npx -y supergateway \
    --sse "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app" \
    --oauth2Bearer "some-access-token" \
    --header "X-My-Header: another-header-value"

stdio → WS

Expose an MCP stdio server as a WebSocket server:

npx -y supergateway \
    --stdio "npx -y @modelcontextprotocol/server-filesystem ./my-folder" \
    --port 8000 --outputTransport ws --messagePath /message
  • WebSocket endpoint: ws://localhost:8000/message

Example with MCP Inspector (stdio → SSE mode)

  1. Run Supergateway:
npx -y supergateway --port 8000 \
    --stdio "npx -y @modelcontextprotocol/server-filesystem /Users/MyName/Desktop"
  1. Use MCP Inspector:
npx @modelcontextprotocol/inspector

You can now list tools, resources, or perform MCP actions via Supergateway.

Using with ngrok

Use ngrok to share your local MCP server publicly:

npx -y supergateway --port 8000 \
    --stdio "npx -y @modelcontextprotocol/server-filesystem ."

# In another terminal:
ngrok http 8000

ngrok provides a public URL for remote access.

Running with Docker

A Docker-based workflow avoids local Node.js setup. A ready-to-run Docker image is available here: supercorp/supergateway. Also on GHCR: ghcr.io/supercorp-ai/supergateway

Using the Official Image

docker run -it --rm -p 8000:8000 supercorp/supergateway \
    --stdio "npx -y @modelcontextprotocol/server-filesystem /" \
    --port 8000

Docker pulls the image automatically. The MCP server runs in the container’s root directory (/). You can mount host directories if needed.

Building the Image Yourself

Use provided Dockerfile:

docker build -t supergateway .

docker run -it --rm -p 8000:8000 supergateway \
    --stdio "npx -y @modelcontextprotocol/server-filesystem /" \
    --port 8000

Using with Claude Desktop (SSE → stdio mode)

Claude Desktop can use Supergateway’s SSE→stdio mode.

NPX-based MCP Server Example

{
  "mcpServers": {
    "supermachineExampleNpx": {
      "command": "npx",
      "args": [
        "-y",
        "supergateway",
        "--sse",
        "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app"
      ]
    }
  }
}

Docker-based MCP Server Example

{
  "mcpServers": {
    "supermachineExampleDocker": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "supercorp/supergateway",
        "--sse",
        "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app"
      ]
    }
  }
}

Using with Cursor (SSE → stdio mode)

Cursor can also integrate with Supergateway in SSE→stdio mode. The configuration is similar to Claude Desktop.

NPX-based MCP Server Example for Cursor

{
  "mcpServers": {
    "cursorExampleNpx": {
      "command": "npx",
      "args": [
        "-y",
        "supergateway",
        "--sse",
        "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app"
      ]
    }
  }
}

Docker-based MCP Server Example for Cursor

{
  "mcpServers": {
    "cursorExampleDocker": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "supercorp/supergateway",
        "--sse",
        "https://mcp-server-ab71a6b2-cd55-49d0-adba-562bc85956e3.supermachine.app"
      ]
    }
  }
}

Note: Although the setup supports sending headers via the --header flag, if you need to pass an Authorization header (which typically includes a space, e.g. "Bearer 123"), you must use the --oauth2Bearer flag due to a known Cursor bug with spaces in command-line arguments.

Why MCP?

Model Context Protocol standardizes AI tool interactions. Supergateway converts MCP stdio servers into SSE or WS services, simplifying integration and debugging with web-based or remote clients.

Advanced Configuration

Supergateway emphasizes modularity:

  • Automatically manages JSON-RPC versioning.
  • Retransmits package metadata where possible.
  • stdio→SSE or stdio→WS mode logs via standard output; SSE→stdio mode logs via stderr.

Additional resources

  • Superargs - provide arguments to MCP servers during runtime.

Contributors

Contributing

Issues and PRs welcome. Please open one if you encounter problems or have feature suggestions.

License

MIT License

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • https://zenepic.net
  • Embark on a thrilling diplomatic quest across a galaxy on the brink of war. Navigate complex politics and alien cultures to forge peace and avert catastrophe in this immersive interstellar adventure.

  • https://reddgr.com
  • Delivers concise Python code and interprets non-English comments

  • 林乔安妮
  • A fashion stylist GPT offering outfit suggestions for various scenarios.

  • 田中 楓太
  • A virtual science instructor for engaging and informative lessons.

  • pontusab
  • 光标与风浪冲浪社区,查找规则和MCP

  • av
  • 毫不费力地使用一个命令运行LLM后端,API,前端和服务。

  • GeyserMC
  • 与Minecraft客户端/服务器通信的库。

  • Mintplex-Labs
  • 带有内置抹布,AI代理,无代理构建器,MCP兼容性等的多合一桌面和Docker AI应用程序。

  • 1Panel-dev
  • 🔥1Panel提供了直观的Web接口和MCP服务器,用于在Linux服务器上管理网站,文件,容器,数据库和LLMS。

  • awslabs
  • AWS MCP服务器 - 将AWS最佳实践直接带入您的开发工作流程的专门MCP服务器

  • 1Panel-dev
  • 💬MAXKB是一种现成的AI聊天机器人,它集成了检索功能增强的生成(RAG)管道,支持强大的工作流程并提供高级的MCP工具使用功能。

  • WangRongsheng
  • 🧑‍🚀 llm 资料总结(数据处理、模型训练、模型部署、 o1 模型、mcp 、小语言模型、视觉语言模型)|摘要世界上最好的LLM资源。

  • appcypher
  • 很棒的MCP服务器 - 模型上下文协议服务器的策划列表

  • chongdashu
  • 使用模型上下文协议(MCP),启用Cursor,Windsurf和Claude Desktop等AI助手客户,以通过自然语言控制虚幻引擎。

    Reviews

    3 (1)
    Avatar
    user_VnaXZykD
    2025-04-17

    Supergateway by supercorp-ai is an incredible tool that has significantly streamlined our API management workflow. Its robust features and user-friendly interface make it an indispensable resource for any developer. The seamless integration and comprehensive documentation available at https://github.com/supercorp-ai/supergateway have made implementation a breeze. Highly recommended!