coding_alt_supergateway

coding_alt_supergateway

by coding-alt
A gateway tool that converts stdio-based MCP servers to SSE for remote access.

SuperGateway MCP Server for SSE Integration

Overview

SuperGateway is a powerful gateway tool that converts standard input/output (stdio) into Server-Sent Events (SSE). It allows you to run stdio-based MCP (Model Context Protocol) servers and access them remotely via SSE. This project is particularly useful for AI gateway implementations, enabling seamless communication between clients and MCP servers.

Key Features

  • Converts stdio-based MCP servers into SSE services
  • Supports multiple client connections simultaneously
  • Automatically identifies and forwards JSON-formatted output
  • CORS support
  • Health check endpoint support
  • Configurable log levels

System Requirements

  • Java 17 or higher
  • Maven 3.6 or higher

Building and Running

  1. Build the project:

shell cd src/java mvn clean package

  1. Run the application:

shell java -jar target/supergateway-1.0.0.jar [options]

Command-Line Options

  • --version: Display the version number
  • --stdio: Command to run the MCP server
  • --sse: SSE URL connection address
  • --port: (stdio→SSE) Server listening port [default: 8000]
  • --baseUrl: (stdio→SSE) Base URL for SSE clients
  • --ssePath: (stdio→SSE) SSE subscription path [default: "/sse"]
  • --messagePath: (stdio→SSE) SSE message path [default: "/message"]
  • --logLevel: Set the log level: "info" or "none" [default: "info"]
  • --cors: Enable CORS [default: false]
  • --healthEndpoint: Add health check endpoints, separated by commas
  • --help: Display help information

Usage Example

java -jar target/supergateway-1.0.0.jar \
  --stdio "java -jar your-mcp-server.jar" \
  --port 8000 \
  --baseUrl http://localhost:8000 \
  --ssePath /sse \
  --messagePath /message

API Endpoints

1. SSE Connection

  • URL: GET /sse
  • Description: Establishes an SSE connection to receive process output
  • Response: The server returns an SSE event containing the message sending endpoint

2. Send Message

  • URL: POST /message?sessionId=<session_id>
  • Content-Type: application/json
  • Description: Sends a JSON-formatted message to the process
  • Response:
  • 200: Message sent successfully
  • 400: Invalid JSON message
  • 503: Session does not exist or process is not ready

3. Health Check

  • URL: GET /health (if health check endpoints are configured)
  • Description: Checks if the service is running normally
  • Response: Returns "ok"

Important Notes

  1. Process output must be in JSON format to be forwarded to SSE clients
  2. Each SSE client automatically receives a unique sessionId
  3. All messages must be in valid JSON format
  4. When sending messages, the correct sessionId obtained from the SSE connection must be used
  5. The MCP server must support communication via standard input/output

About

SuperGateway is designed to run MCP stdio servers over SSE and SSE over stdio, serving as an AI gateway for efficient communication.

Resources

Stars

1 star

Watchers

1 watching

Forks

0 forks

Languages

Features & Capabilities

Categories
mcp_server model_context_protocol java sse api_integration gateway

Implementation Details

Stats

0 Views
1 GitHub Stars

Repository Info

coding-alt Organization

Similar MCP Servers

continuedev_continue by continuedev
25049
21423
9300