SSE (Server-Sent Events) transport allows you to run MCP servers remotely and access them over HTTP. This is ideal for production deployments, remote access, and web-based clients.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/dvlpjrs/guMCP/llms.txt
Use this file to discover all available pages before exploring further.
Overview
When running in SSE mode:- All servers are hosted on a single HTTP endpoint
- Multiple users can connect simultaneously
- Each user gets isolated server instances
- Communication happens over HTTP with Server-Sent Events
- Suitable for remote access and production deployments
Prerequisites
Configure environment variables
Starting the SSE Server
Using the Development Script
The easiest way to start the SSE server is using the provided script:- Loads environment variables from
.env - Sets default host (
0.0.0.0) and port (8000) if not specified - Kills any existing process on the port
- Starts the development server
Manual Start
You can also start the server manually:Server Configuration
Environment Variables
Configure the server using environment variables in your.env file:
Script Behavior
Thestart_sse_dev_server.sh script:
- Loads environment variables from
.envif it exists - Sets defaults if variables are not defined:
GUMCP_HOST=0.0.0.0GUMCP_PORT=8000
- Checks for port conflicts using
lsof - Kills existing processes on the port if needed
- Starts the server with
python src/servers/main.py
Server Architecture
Automatic Server Discovery
The SSE server automatically discovers all available servers from thesrc/servers/ directory. Each server must have:
- A
main.pyfile - A
serverfactory function - A
get_initialization_optionsfunction
Multi-User Sessions
The server supports isolated sessions per user:- Session keys: Identified by
{user_id}:{api_key}or just{user_id} - Server instances: Each session gets its own server instance
- State preservation: Server instances are reused across reconnections
- Automatic cleanup: Transports are cleaned up when connections close
Connecting to the Server
Endpoint Format
Servers are accessible at:http://localhost:8000/simple-tools-server/localhttp://localhost:8000/gsheets/user123:api_key_456
Using the Remote Test Client
guMCP provides a test client for SSE servers:- Connects to the specified SSE endpoint
- Handles Server-Sent Events
- Provides an interactive testing interface
- Useful for development and debugging
Using with Cursor or Other Clients
Configure your MCP client to connect to the SSE endpoint:Available Endpoints
Server Endpoints
For each discovered server:-
SSE Connection:
GET /{server-name}/{session-key}- Establishes SSE connection for the session
- Returns a stream of Server-Sent Events
-
Post Messages:
POST /{server-name}/{session-key}/messages/- Send messages to the server
- Used by clients to communicate with the server
Health Check Endpoints
-
Root:
GET /- Returns server status and list of available servers
- Response:
{"status": "ok", "message": "guMCP server running", "servers": [...]}
-
Health Check:
GET /health_check- Returns health status and available servers
- Response:
{"status": "ok", "servers": [...]}
Metrics Endpoint
- Prometheus Metrics:
GET /metrics(on port 9091)- Exposes Prometheus-compatible metrics
- Includes:
gumcp_active_connections: Active SSE connections per servergumcp_connection_total: Total connections per server
Monitoring
Prometheus Metrics
The server exposes Prometheus metrics on port9091:
- Active connections by server
- Total connections by server
- Standard Prometheus process metrics
Logging
The server provides comprehensive logging:Production Deployment
Using a Process Manager
For production, use a process manager like systemd or supervisor:systemd Example
Create/etc/systemd/system/gumcp.service:
Using Docker
Create aDockerfile:
Reverse Proxy with nginx
For production, use nginx as a reverse proxy:Troubleshooting
Port Already in Use
If the port is already in use:Connection Refused
If clients cannot connect:- Verify the server is running:
curl http://localhost:8000/health_check - Check firewall settings
- Ensure the host is set to
0.0.0.0for external access - Verify the correct port is being used
Session Not Found
If you get “Session not found or expired”:- Ensure you’re using the correct session key format
- Check that the SSE connection is established before posting messages
- Verify the server name is correct
Server Not Loading
If servers are not discovered:- Check that the server directory has a
main.pyfile - Verify the
main.pyexportsserverandget_initialization_options - Check server logs for loading errors
Next Steps
- Local Stdio Deployment - Run servers locally
- Environment Setup - Configure environment variables
- Server Documentation - Learn about available servers