@@ -13,7 +13,7 @@ This app will work with an OpenAPI compliant endpoints and specification. The s
1313- 💬 ** Custom Prompts** : Load domain-specific prompt templates
1414- ⚙️ ** Configurable Mapping** : Override default tool/resource classification and function descriptions
1515- 🔐 ** Authentication Support** : Bearer, API Key, and Basic auth
16- - 🚀 ** Multiple Deployment Modes** : stdio for IDEs, HTTP for standalone deployment
16+ - 🚀 ** Multiple Deployment Modes** : stdio for IDEs, MCP Streaming HTTP for web deployment
1717- 📋 ** Multi-Spec Support** : Load multiple OpenAPI specifications
1818
1919## Current Limitation
5252mcp-openapi-server
5353```
5454
55- ** For Standalone Deployment (HTTP mode):**
55+ ** For Standalone Deployment (MCP Streaming HTTP mode):**
5656``` bash
5757mcp-openapi-server --http --port 4000
5858```
@@ -84,20 +84,32 @@ mcp-openapi-server --http --base-url https://api.example.com --specs ./specs --p
8484- ✅ Direct MCP client connections
8585- ✅ Microservices with MCP protocol
8686
87- ** When to use HTTP Mode (` --http ` flag):**
87+ ** When to use MCP Streaming HTTP Mode (` --http ` flag):**
8888- ✅ Web application integration
8989- ✅ Development and testing with HTTP clients
9090- ✅ Health checks and monitoring endpoints
9191- ✅ Docker deployments with port mapping
9292- ✅ Load balancing and reverse proxy setups
93+ - ✅ Session-based MCP client connections
94+ - 🚧 Future Server-Sent Events (SSE) streaming support
95+
96+ ** When to use HTTPS Mode (` --https ` flag):**
97+ - ✅ Production deployments requiring encryption
98+ - ✅ Secure MCP client connections over TLS
99+ - ✅ Compliance with security policies
100+ - ✅ Public-facing MCP server deployments
101+ - ✅ Integration with enterprise security infrastructure
93102
94103** Quick Mode Selection:**
95104``` bash
96105# For IDEs and MCP clients (recommended)
97106mcp-openapi-server
98107
99- # For web APIs and testing
108+ # For web APIs and MCP streaming HTTP
100109mcp-openapi-server --http
110+
111+ # For secure production deployments
112+ mcp-openapi-server --https --key-file ./certs/server.key --cert-file ./certs/server.crt
101113```
102114
103115## Development Mode
@@ -525,10 +537,13 @@ The server automatically limits JSON request body sizes to prevent denial-of-ser
525537# Use default 2MB limit
526538mcp-openapi-server --http
527539
528- # Set custom limit
540+ # Set custom request limit
529541mcp-openapi-server --http --max-request-size 5mb
530542
531- # Other valid formats
543+ # Set custom response limit (for large backend API responses)
544+ mcp-openapi-server --http --max-response-size-mb 100
545+
546+ # Other valid request size formats
532547mcp-openapi-server --max-request-size 1024kb
533548mcp-openapi-server --max-request-size 512kb
534549```
@@ -681,22 +696,97 @@ Options:
681696 --base-url <url> Base URL for backend APIs (overrides config file)
682697 --max-tool-name-length <number> Maximum length for generated tool names (default: "48")
683698 --max-request-size <size> Maximum size for JSON request bodies (default: "2mb")
699+ --max-response-size-mb <number> Maximum size for backend API responses in MB (default: "50")
684700 --http Run in HTTP server mode instead of stdio (default: false)
701+ --https Enable HTTPS mode (requires certificate files)
702+ --https-port <number> Port for HTTPS server mode (default: "4443")
703+ --key-file <path> Path to private key file for HTTPS
704+ --cert-file <path> Path to certificate file for HTTPS
705+ --pfx-file <path> Path to PFX/PKCS12 file for HTTPS (alternative to key/cert)
706+ --passphrase <passphrase> Passphrase for encrypted private key
685707 -v, --verbose Enable verbose logging (default: true)
686708 -h, --help Display help for command
687709```
688710
689711** Mode Selection:**
690712- ** Default (no ` --http ` flag):** Stdio mode - ideal for IDE integration (Cursor, Claude Desktop)
691713- ** With ` --http ` flag:** HTTP mode - ideal for web integration, testing, and standalone deployment
714+ - ** With ` --https ` flag:** HTTPS mode - secure web integration with TLS encryption
715+
716+ ## MCP Streaming HTTP Protocol
717+
718+ When running with ` --http ` , the server implements the ** MCP Streaming HTTP protocol** with session management:
719+
720+ ### Protocol Features
721+ - ✅ ** Session Management** : Each client gets a unique session ID via ` Mcp-Session-Id ` header
722+ - ✅ ** JSON-RPC 2.0** : Standard MCP message format over HTTP
723+ - ✅ ** Stateful Connections** : Sessions maintain client context and authentication
724+ - ✅ ** Session Cleanup** : Automatic cleanup of expired sessions (30 minutes)
725+ - 🚧 ** Server-Sent Events** : Placeholder for future streaming implementation
726+
727+ ### HTTP Endpoints
728+
729+ The server exposes ** exactly 3 endpoints** when running in HTTP/HTTPS mode:
692730
693- ## HTTP Endpoints (HTTP Mode)
731+ | Method | Endpoint | Purpose | Status |
732+ | --------| ----------| ---------| --------|
733+ | ` POST ` | ` /mcp ` | ** MCP JSON-RPC endpoint** - All MCP protocol communication | ✅ Active |
734+ | ` GET ` | ` /mcp ` | ** SSE streaming placeholder** - Future server-to-client streaming | 🚧 Placeholder |
735+ | ` GET ` | ` /health ` | ** Health check** - Server status and session count | ✅ Active |
736+ | ` GET ` | ` /info ` | ** Server information** - Specs, tools, resources, prompts | ✅ Active |
694737
695- When running with ` --http ` , the server exposes:
738+ ** Important Notes** :
739+ - ✅ All MCP operations (tools, resources, prompts) go through the ** single** ` POST /mcp ` endpoint using JSON-RPC 2.0 messages
740+ - ❌ ** No separate REST endpoints** - The server follows MCP Streaming HTTP protocol specification
741+ - ✅ Health and info endpoints remain separate for monitoring and DevOps purposes
696742
697- - ` POST /mcp ` - MCP JSON-RPC endpoint
698- - ` GET /health ` - Health check and stats
699- - ` GET /info ` - Detailed server information
743+ ### MCP Protocol Flow
744+
745+ 1 . ** Initialize Session** : Client sends ` initialize ` method to ` POST /mcp `
746+ 2 . ** Session Created** : Server responds with ` Mcp-Session-Id ` header
747+ 3 . ** Subsequent Requests** : Client includes session ID in all future requests
748+ 4 . ** Session Validation** : Server validates session for each request
749+
750+ ### Endpoint Usage Examples
751+
752+ ** MCP Protocol Communication:**
753+ ``` bash
754+ # Initialize session
755+ curl -X POST http://localhost:4000/mcp \
756+ -H " Content-Type: application/json" \
757+ -d ' {
758+ "jsonrpc": "2.0",
759+ "method": "initialize",
760+ "params": {
761+ "protocolVersion": "2024-11-05",
762+ "clientInfo": {"name": "my-client", "version": "1.0.0"}
763+ },
764+ "id": 1
765+ }'
766+ # Response includes: Mcp-Session-Id header
767+
768+ # List tools (requires session ID)
769+ curl -X POST http://localhost:4000/mcp \
770+ -H " Content-Type: application/json" \
771+ -H " Mcp-Session-Id: your-session-id" \
772+ -d ' {
773+ "jsonrpc": "2.0",
774+ "method": "tools/list",
775+ "id": 2
776+ }'
777+ ```
778+
779+ ** Health Check:**
780+ ``` bash
781+ curl http://localhost:4000/health
782+ # Returns: {"status": "ok", "sessions": 2, "tools": 5, ...}
783+ ```
784+
785+ ** Server Information:**
786+ ``` bash
787+ curl http://localhost:4000/info
788+ # Returns: {"specs": [...], "tools": [...], "resources": [...]}
789+ ```
700790
701791### Health Check Response
702792``` json
@@ -706,10 +796,106 @@ When running with `--http`, the server exposes:
706796 "tools" : 12 ,
707797 "resources" : 3 ,
708798 "prompts" : 2 ,
709- "version" : " 1.0.0"
799+ "sessions" : 3 ,
800+ "version" : " 1.0.0" ,
801+ "protocol" : " MCP Streaming HTTP (SSE placeholder)"
710802}
711803```
712804
805+ ## HTTPS Configuration
806+
807+ The server supports secure HTTPS connections with TLS encryption for production deployments:
808+
809+ ### HTTPS Setup Options
810+
811+ ** Option 1: Separate Key and Certificate Files**
812+ ``` bash
813+ # Generate or obtain SSL certificate files
814+ # Then run with separate key and cert files
815+ mcp-openapi-server --https \
816+ --key-file ./certs/private.key \
817+ --cert-file ./certs/certificate.crt \
818+ --https-port 4443
819+ ```
820+
821+ ** Option 2: PFX/PKCS12 File**
822+ ``` bash
823+ # Use a single PFX file (common in Windows environments)
824+ mcp-openapi-server --https \
825+ --pfx-file ./certs/server.pfx \
826+ --passphrase mypassword \
827+ --https-port 4443
828+ ```
829+
830+ ### HTTPS Examples
831+
832+ ** Basic HTTPS with Banking Example:**
833+ ``` bash
834+ # HTTPS mode with banking examples
835+ mcp-openapi-server --https \
836+ --key-file ./certs/server.key \
837+ --cert-file ./certs/server.crt \
838+ --specs ./examples/specs \
839+ --config ./examples/mcp-config.json
840+ ```
841+
842+ ** HTTPS with Custom Configuration:**
843+ ``` bash
844+ # Production HTTPS setup
845+ mcp-openapi-server --https \
846+ --pfx-file ./production/certs/api-server.pfx \
847+ --passphrase $CERT_PASSPHRASE \
848+ --https-port 443 \
849+ --base-url https://api.production.com \
850+ --specs ./production/specs
851+ ```
852+
853+ ### HTTPS Output
854+ When HTTPS is enabled, you'll see:
855+ ```
856+ 🔒 MCP OpenAPI HTTPS Server running on port 4443
857+ 📊 Health check: https://localhost:4443/health
858+ ℹ️ Server info: https://localhost:4443/info
859+ 📋 Loaded 3 specs, 4 tools, 5 resources, 2 prompts
860+ ```
861+
862+ ### Certificate Requirements
863+
864+ ** For ` --key-file ` and ` --cert-file ` :**
865+ - Private key file (` .key ` , ` .pem ` )
866+ - Certificate file (` .crt ` , ` .cer ` , ` .pem ` )
867+ - Both files must be readable by the server process
868+
869+ ** For ` --pfx-file ` :**
870+ - Single PKCS #12 file (` .pfx ` , ` .p12 ` ) containing both key and certificate
871+ - Optional passphrase for encrypted PFX files
872+
873+ ### HTTPS + MCP Streaming Protocol
874+
875+ HTTPS mode provides:
876+ - ✅ ** Encrypted MCP sessions** - All JSON-RPC 2.0 messages encrypted with TLS
877+ - ✅ ** Secure session management** - ` Mcp-Session-Id ` headers protected
878+ - ✅ ** TLS certificate validation** - Standard HTTPS security
879+ - ✅ ** Future secure SSE** - Ready for encrypted Server-Sent Events
880+ - ✅ ** Production-ready** - Suitable for production MCP server deployments
881+
882+ ### Troubleshooting HTTPS
883+
884+ ** Certificate file not found:**
885+ ```
886+ ⚠️ Private key file not found: ./certs/private.key
887+ ```
888+ - Verify file paths are correct and files exist
889+ - Check file permissions are readable
890+
891+ ** Invalid certificate:**
892+ ```
893+ ⚠️ Error reading HTTPS certificate files: Invalid certificate format
894+ ```
895+ - Verify certificate files are valid PEM or PFX format
896+ - Check certificate and key match
897+ - Ensure passphrase is correct for encrypted files
898+
713899## Examples
714900
715901The ` examples/ ` directory contains a complete banking API example:
@@ -885,6 +1071,39 @@ The tests validate:
8851071
8861072MIT License - see [LICENSE](LICENSE) file for details.
8871073
1074+ # # 🚧 Current Limitations
1075+
1076+ # ## Large Payload Handling
1077+ - **Memory Limit**: Responses larger than 50MB (configurable via `maxResponseSizeMB`) will be rejected to prevent memory issues
1078+ - **No Streaming**: Server-Sent Events (SSE) streaming is not yet implemented, so large responses must be handled by:
1079+ - Increasing the `maxResponseSizeMB` limit (not recommended for very large payloads)
1080+ - Implementing pagination at the backend API level
1081+ - Waiting for SSE streaming implementation (future enhancement)
1082+
1083+ **Configuration Options:**
1084+ ` ` ` bash
1085+ # CLI option
1086+ --max-response-size-mb 100
1087+
1088+ # Config file option
1089+ {
1090+ "maxResponseSizeMB": 100
1091+ }
1092+ ` ` `
1093+
1094+ # ## Single Backend Architecture
1095+ - **Single Base URL**: Only one backend API base URL is supported per server instance
1096+ - **Multi-Backend Workaround**: For multiple backend services, use an API Gateway or reverse proxy to provide a unified endpoint
1097+ - **Recommended Architecture**:
1098+ ```
1099+ MCP Client → mcp-openapi → API Gateway → Multiple Backend APIs
1100+ ```
1101+
1102+ ### MCP Protocol Features
1103+ - **SSE Streaming**: Server-Sent Events endpoint (`GET /mcp`) is a placeholder - not yet implemented
1104+ - **Session Persistence**: Sessions are in-memory only (lost on server restart)
1105+ - **Real-time Updates**: No push notifications or real-time data streaming
1106+
8881107## Support
8891108
8901109- 🐛 [Report Issues](https://github.com/yourusername/mcp-openapi-server/issues)
0 commit comments