Add HTTP/SSE Server Support and Unified Docker Image #12
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds HTTP/SSE transport support to the MCP server and consolidates Docker image builds into a unified multi-mode image. The server now supports both local stdio clients (Claude Desktop) and remote HTTP/SSE clients (web applications, APIs, distributed systems).
Why HTTP/SSE Server?
Problem: stdio Transport Limitations
The existing MCP server uses stdio transport (JSON-RPC over stdin/stdout), which works well for local clients but has significant limitations:
stdio transport challenges:
Solution: HTTP/SSE Transport
The HTTP/SSE server enables remote MCP use cases:
Architecture
HTTP/SSE Proxy Design
The implementation uses a proxy architecture to maintain code reuse:
Benefits:
mcp-server) remains transport-agnosticKey Components
mcp-server - Existing stdio MCP server (unchanged)
mcp-http-proxy (new) - HTTP/SSE transport layer
mcp-serverprocess per sessionentrypoint.sh - Mode selector
MCP_TRANSPORT_MODE=stdio→ Direct mcp-server executionMCP_TRANSPORT_MODE=http→ Proxy wrapper with HTTP serverChanges Made
1. New Files
mcp-http-proxy.go- HTTP/SSE server implementation (~600 lines)/sse,/message,/healthentrypoint.sh- Transport mode selectorMCP_TRANSPORT_MODEenvironment variabledocs/HTTP_SERVER.md- Comprehensive server documentation (~400 lines)docs/QUICK_REFERENCE.md- Quick command reference (~200 lines)2. Unified Dockerfile
Before: Basic stdio-only image
After: Unified image supporting both stdio and HTTP modes
Structure:
Features:
3. Documentation Updates
README.md:
Building and Running
Build
Simple build:
docker build -t incidentio-mcp:latest .Multi-architecture build:
docker buildx build \ --platform linux/amd64,linux/arm64 \ --tag your-registry/incidentio-mcp:v1.0.0 \ --push \ .Run - HTTP Server Mode (Default)
Basic:
docker run --rm -p 8080:8080 \ -e INCIDENT_IO_API_KEY="your-api-key" \ incidentio-mcp:latestHTTP endpoints:
GET /sse?session=<id>- Establish SSE stream for receiving messagesPOST /message?session=<id>- Send JSON-RPC messagesGET /health- Health check endpointRun - stdio Mode
For Claude Desktop:
docker run --rm -i \ -e MCP_TRANSPORT_MODE=stdio \ -e INCIDENT_IO_API_KEY="your-api-key" \ incidentio-mcp:latestEnvironment Variables
MCP_TRANSPORT_MODEstdio,http,ssehttpMCP_HTTP_PORT1-655358080INCIDENT_IO_API_KEYMCP_DEBUG0,10INCIDENT_IO_DEBUG0,10Testing
stdio Mode Verification
Expected output:
{"jsonrpc":"2.0","result":{"capabilities":{"tools":{"listChanged":false}},"protocolVersion":"2024-11-05","serverInfo":{"name":"incidentio-mcp-server","version":"1.0.0"}},"id":1}HTTP Mode Verification
Security Considerations
Non-Root User
incidentio:1001-u 1001:1001flag for securityAPI Key Management