Supergateway MCP Proxy

3.4.3 · active · verified Wed Apr 22

Supergateway is a command-line utility designed to bridge Model Context Protocol (MCP) stdio-based servers with network transports like Server-Sent Events (SSE), WebSockets (WS), and Streamable HTTP, and vice versa. It enables remote access, debugging, and client connectivity for MCP servers that primarily support stdio. The current stable version is 3.4.3. The project demonstrates a relatively active release cadence, with several minor updates and a significant rollback release (v3.4.0) to address stability issues from v3.3.0. Its key differentiator is providing a flexible gateway for various MCP communication patterns, facilitating integration of local stdio services into web-based or distributed systems. It supports both stateless and stateful operations for Streamable HTTP, and offers configurable concurrency for stdio-to-SSE gateways.

Common errors

Warnings

Install

Imports

Quickstart

Demonstrates how to run Supergateway to expose a local stdio-based Model Context Protocol (MCP) server as an SSE endpoint, allowing remote clients to interact with it via HTTP.

const { exec } = require('child_process');

// This command starts Supergateway, which in turn runs an MCP server
// (here, a filesystem-based one) and exposes its communication
// via SSE endpoints on localhost:8000.
//
// Clients can then subscribe to events via GET /sse and send messages
// via POST /message to interact with the underlying stdio server.
// Replace 'npx -y @modelcontextprotocol/server-filesystem ./my-folder'
// with your actual MCP stdio server command.
const supergatewayCommand = `npx -y supergateway \n    --stdio "npx -y @modelcontextprotocol/server-filesystem ./my-folder" \n    --port 8000 --baseUrl http://localhost:8000 \n    --ssePath /sse --messagePath /message`;

console.log("To start Supergateway, run this in your terminal:");
console.log(supergatewayCommand);

// Example of how you might programmatically run it in a Node.js script
// (though Supergateway is typically run directly in a shell)
// exec(supergatewayCommand, (error, stdout, stderr) => {
//     if (error) {
//         console.error(`exec error: ${error}`);
//         return;
//     }
//     console.log(`stdout: ${stdout}`);
//     console.error(`stderr: ${stderr}`);
// });

console.log("\nOnce running, you can subscribe to events with: GET http://localhost:8000/sse");
console.log("And send messages with: POST http://localhost:8000/message");

view raw JSON →