@@ -697,6 +697,13 @@ Options:
697697 --max-tool-name-length <number> Maximum length for generated tool names (default: "48")
698698 --max-request-size <size> Maximum size for JSON request bodies (default: "2mb")
699699 --max-response-size-mb <number> Maximum size for backend API responses in MB (default: "50")
700+ --https-client-ca <path> Path to CA certificate file for HTTPS backend APIs
701+ --https-client-cert <path> Path to client certificate file for HTTPS backend APIs
702+ --https-client-key <path> Path to client private key file for HTTPS backend APIs
703+ --https-client-pfx <path> Path to client PFX/PKCS12 file for HTTPS backend APIs
704+ --https-client-passphrase <pass> Passphrase for client private key
705+ --https-client-reject-unauthorized Reject self-signed certificates (default: true)
706+ --https-client-timeout <ms> HTTPS request timeout in milliseconds (default: "30000")
700707 --http Run in HTTP server mode instead of stdio (default: false)
701708 --https Enable HTTPS mode (requires certificate files)
702709 --https-port <number> Port for HTTPS server mode (default: "4443")
@@ -802,84 +809,86 @@ curl http://localhost:4000/info
802809}
803810```
804811
805- ## HTTPS Configuration
812+ ## 🔒 MCP Server HTTPS Configuration
806813
807- The server supports secure HTTPS connections with TLS encryption for production deployments :
814+ Configure the MCP OpenAPI server to serve MCP clients over secure HTTPS connections with TLS encryption:
808815
809- ### HTTPS Setup Options
816+ ### MCP Server HTTPS Setup Options
810817
811818** Option 1: Separate Key and Certificate Files**
812819``` bash
813- # Generate or obtain SSL certificate files
814- # Then run with separate key and cert files
820+ # Generate or obtain SSL certificate files for the MCP server
815821mcp-openapi-server --https \
816- --key-file ./certs/private .key \
817- --cert-file ./certs/certificate .crt \
822+ --key-file ./certs/mcp-server .key \
823+ --cert-file ./certs/mcp-server .crt \
818824 --https-port 4443
819825```
820826
821827** Option 2: PFX/PKCS12 File**
822828``` bash
823- # Use a single PFX file (common in Windows environments)
829+ # Use a single PFX file for the MCP server (common in Windows environments)
824830mcp-openapi-server --https \
825- --pfx-file ./certs/server.pfx \
831+ --pfx-file ./certs/mcp- server.pfx \
826832 --passphrase mypassword \
827833 --https-port 4443
828834```
829835
830- ### HTTPS Examples
836+ ### MCP Server HTTPS Examples
831837
832- ** Basic HTTPS with Banking Example :**
838+ ** Development HTTPS Setup :**
833839``` bash
834- # HTTPS mode with banking examples
840+ # Development HTTPS mode for secure MCP client connections
835841mcp-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
842+ --key-file ./certs/dev-server.key \
843+ --cert-file ./certs/dev-server.crt \
844+ --https-port 4443 \
845+ --specs ./specs \
846+ --config ./mcp-config.json
840847```
841848
842- ** HTTPS with Custom Configuration :**
849+ ** Production HTTPS Setup :**
843850``` bash
844- # Production HTTPS setup
851+ # Production HTTPS setup for serving MCP clients securely
845852mcp-openapi-server --https \
846- --pfx-file ./production/certs/api -server.pfx \
847- --passphrase $CERT_PASSPHRASE \
853+ --pfx-file ./production/certs/mcp -server.pfx \
854+ --passphrase $MCP_SERVER_CERT_PASSPHRASE \
848855 --https-port 443 \
849- --base-url https://api. production.com \
850- --specs ./production/specs
856+ --specs ./ production/specs \
857+ --config ./production/mcp-config.json
851858```
852859
853- ### HTTPS Output
854- When HTTPS is enabled, you'll see:
860+ ### MCP Server HTTPS Output
861+ When MCP server HTTPS is enabled, you'll see:
855862```
856863🔒 MCP OpenAPI HTTPS Server running on port 4443
857864📊 Health check: https://localhost:4443/health
858865ℹ️ Server info: https://localhost:4443/info
859866📋 Loaded 3 specs, 4 tools, 5 resources, 2 prompts
860867```
861868
862- ### Certificate Requirements
869+ ### MCP Server Certificate Requirements
863870
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
871+ ** For MCP Server ` --key-file ` and ` --cert-file ` :**
872+ - Private key file (` .key ` , ` .pem ` ) for the MCP server
873+ - Certificate file (` .crt ` , ` .cer ` , ` .pem ` ) for the MCP server
874+ - Both files must be readable by the MCP server process
875+ - Certificate must be valid for the domain/IP where MCP clients will connect
868876
869- ** For ` --pfx-file ` :**
870- - Single PKCS #12 file (` .pfx ` , ` .p12 ` ) containing both key and certificate
877+ ** For MCP Server ` --pfx-file ` :**
878+ - Single PKCS #12 file (` .pfx ` , ` .p12 ` ) containing both key and certificate for the MCP server
871879- Optional passphrase for encrypted PFX files
880+ - Certificate must be valid for the domain/IP where MCP clients will connect
872881
873- ### HTTPS + MCP Streaming Protocol
882+ ### MCP Server HTTPS + MCP Streaming Protocol
874883
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
884+ MCP Server HTTPS mode provides:
885+ - ✅ ** Encrypted MCP client connections ** - All JSON-RPC 2.0 messages from clients encrypted with TLS
886+ - ✅ ** Secure session management** - ` Mcp-Session-Id ` headers protected in transit
887+ - ✅ ** TLS certificate validation** - Standard HTTPS security for MCP clients
888+ - ✅ ** Future secure SSE** - Ready for encrypted Server-Sent Events to clients
889+ - ✅ ** Production-ready** - Suitable for production MCP server deployments serving multiple clients
881890
882- ### Troubleshooting HTTPS
891+ ### Troubleshooting MCP Server HTTPS
883892
884893** Certificate file not found:**
885894```
@@ -1071,6 +1080,105 @@ The tests validate:
10711080
10721081MIT License - see [LICENSE](LICENSE) file for details.
10731082
1083+ # # 🔗 Backend API HTTPS Client Configuration
1084+
1085+ Configure the MCP OpenAPI server to connect securely to backend APIs over HTTPS with custom certificates and validation options.
1086+
1087+ # ## Backend API HTTPS Configuration Options
1088+
1089+ Add `httpsClient` configuration to your `mcp-config.json` for secure backend API connections :
1090+
1091+ ` ` ` json
1092+ {
1093+ "baseUrl": "https://secure-backend-api.example.com",
1094+ "httpsClient": {
1095+ "rejectUnauthorized": true,
1096+ "timeout": 30000,
1097+ "keepAlive": true,
1098+ "certFile": "./certs/backend-client.crt",
1099+ "keyFile": "./certs/backend-client.key",
1100+ "caFile": "./certs/backend-ca.crt",
1101+ "passphrase": "optional-key-passphrase"
1102+ }
1103+ }
1104+ ` ` `
1105+
1106+ # ## Backend API HTTPS CLI Options
1107+
1108+ ` ` ` bash
1109+ # Basic backend API HTTPS client options
1110+ mcp-openapi-server --base-url https://secure-backend-api.com \
1111+ --https-client-reject-unauthorized \
1112+ --https-client-timeout 30000
1113+
1114+ # Backend API client certificate authentication
1115+ mcp-openapi-server --base-url https://secure-backend-api.com \
1116+ --https-client-cert ./certs/backend-client.crt \
1117+ --https-client-key ./certs/backend-client.key
1118+
1119+ # Custom CA certificate for backend API
1120+ mcp-openapi-server --base-url https://secure-backend-api.com \
1121+ --https-client-ca ./certs/backend-ca.crt
1122+
1123+ # PFX/PKCS12 certificate for backend API
1124+ mcp-openapi-server --base-url https://secure-backend-api.com \
1125+ --https-client-pfx ./certs/backend-client.p12 \
1126+ --https-client-passphrase mypassword
1127+ ` ` `
1128+
1129+ # ## Backend API HTTPS Configuration Reference
1130+
1131+ | Option | Type | Default | Description |
1132+ |--------|------|---------|-------------|
1133+ | `rejectUnauthorized` | boolean | `true` | Reject self-signed certificates from backend APIs |
1134+ | `timeout` | number | `30000` | Request timeout for backend API calls in milliseconds |
1135+ | `keepAlive` | boolean | `true` | Use HTTP keep-alive for backend API connections |
1136+ | `certFile` | string | - | Path to client certificate file for backend API authentication |
1137+ | `keyFile` | string | - | Path to client private key file for backend API authentication |
1138+ | `pfxFile` | string | - | Path to PFX/PKCS12 file for backend API authentication (alternative to cert/key) |
1139+ | `caFile` | string | - | Path to custom CA certificate for backend API validation |
1140+ | `passphrase` | string | - | Passphrase for encrypted private key used with backend APIs |
1141+
1142+ # ## Backend API Certificate Types Supported
1143+
1144+ 1. **Separate Certificate and Key Files for Backend API**
1145+ ` ` ` json
1146+ {
1147+ "certFile": "./certs/backend-client.crt",
1148+ "keyFile": "./certs/backend-client.key"
1149+ }
1150+ ` ` `
1151+
1152+ 2. **PFX/PKCS12 Bundle for Backend API**
1153+ ` ` ` json
1154+ {
1155+ "pfxFile": "./certs/backend-client.p12",
1156+ "passphrase": "optional"
1157+ }
1158+ ` ` `
1159+
1160+ 3. **Custom CA Certificate for Backend API**
1161+ ` ` ` json
1162+ {
1163+ "caFile": "./certs/backend-ca.crt"
1164+ }
1165+ ` ` `
1166+
1167+ # ## Backend API HTTPS Validation Rules
1168+
1169+ - If `certFile` is provided for backend API authentication, `keyFile` is required
1170+ - If `keyFile` is provided for backend API authentication, `certFile` is required
1171+ - Cannot specify both `cert/key` files and `pfxFile` simultaneously for backend API authentication
1172+ - Encrypted certificate files require `passphrase` for backend API connections
1173+ - All certificate files must exist and be readable by the MCP server
1174+ - Timeout must be between 1000ms and 300000ms for backend API requests
1175+
1176+ # ## Backend API HTTPS Default Behavior
1177+
1178+ - **No HTTPS config**: Uses standard HTTP client with default Node.js settings for backend API connections
1179+ - **Partial config**: Validates configuration and fails startup if incomplete backend API HTTPS configuration
1180+ - **Complete config**: Enables HTTPS client with custom certificates and settings for secure backend API connections
1181+
10741182# # 🚧 Current Limitations
10751183
10761184# ## Large Payload Handling
0 commit comments