API Gateway Deployment Guide
Complete guide for deploying OpenAPI-compliant APIs to production API Gateways.Table of Contents
- Prerequisites
- Kong API Gateway
- AWS API Gateway
- Google Cloud API Gateway
- Azure API Management
- Kubernetes Ingress
Prerequisites
OpenAPI Specification
- File:
openapi/v1.json - Version: OpenAPI 3.1.0
- Endpoints: 22
- Schemas: 42
Required Configuration
- JWT secret key
- Keycloak SSO (optional)
- OpenFGA authorization
- PostgreSQL database (for GDPR storage)
- Redis (for rate limiting)
Kong API Gateway
1. Install Kong Gateway
2. Import OpenAPI Specification
3. Configure API Key Plugin
Kong configuration is already integrated:- See
src/mcp_server_langgraph/api/api_keys.py:validateendpoint - Kong calls
/api/v1/api-keys/validateto exchange API key for JWT
4. Enable Rate Limiting
AWS API Gateway
1. Import OpenAPI Spec
2. Configure JWT Authorizer
3. Deploy to Stage
4. Add Usage Plan (Rate Limiting)
Google Cloud API Gateway
1. Create API Config
2. Create Gateway
3. Configure Authentication
Option A: API KeysAzure API Management
1. Import OpenAPI
2. Configure JWT Validation
3. Enable Rate Limiting
Kubernetes Ingress (NGINX/Traefik)
Option 1: NGINX Ingress
Option 2: Traefik Ingress
Environment Configuration
Required Environment Variables
Testing Deployment
1. Health Check
2. OpenAPI Documentation
3. Authentication Test
4. Rate Limiting Test
Monitoring & Observability
Prometheus Metrics
Grafana Dashboard
Traces (OpenTelemetry)
Security Checklist
Before production deployment:- JWT secret is secure (32+ characters, rotated)
- HTTPS/TLS enabled (valid certificates)
- CORS origins restricted (not
*) - Rate limiting configured (per user/IP)
- OpenFGA authorization policies defined
- Database credentials secured (secrets manager)
- API keys hashed with bcrypt
- GDPR storage uses PostgreSQL (not in-memory)
- Audit logging enabled
- Circuit breakers configured
- Health checks responding
- Monitoring alerts configured
API Gateway Features Comparison
| Feature | Kong | AWS | GCP | Azure | NGINX |
|---|---|---|---|---|---|
| OpenAPI Import | ✅ | ✅ | ✅ | ✅ | ⚠️ |
| JWT Validation | ✅ | ✅ | ✅ | ✅ | ✅ |
| Rate Limiting | ✅ | ✅ | ✅ | ✅ | ✅ |
| API Key Management | ✅ | ✅ | ✅ | ✅ | ❌ |
| SCIM Support | ✅ | ⚠️ | ⚠️ | ✅ | ❌ |
| Monitoring | ✅ | ✅ | ✅ | ✅ | ⚠️ |
| Auto-scaling | ✅ | ✅ | ✅ | ✅ | ⚠️ |
Production Deployment Example (Kong + Kubernetes)
Complete Setup
API Versioning Strategy
URL-Based Versioning (Current)
/api/v1/*- Version 1 (current)/api/v2/*- Version 2 (future)
Header-Based Versioning (Optional)
Deprecation Policy
- Announce deprecation - 6 months notice
- Mark as deprecated - Add
deprecated: trueto OpenAPI - Update
/api/version- Add todeprecated_versionswith sunset date - Return headers -
Sunset: Sat, 01 Jun 2026 00:00:00 GMT - Remove version - After sunset date
Breaking Change Prevention
Automated Validation
Breaking Changes (Require Version Bump)
- ❌ Removing endpoints
- ❌ Removing required fields
- ❌ Changing field types
- ❌ Renaming fields
- ❌ Changing authentication methods
Safe Changes (No Version Bump)
- ✅ Adding new endpoints
- ✅ Adding optional fields
- ✅ Adding new response fields
- ✅ Adding query parameters (optional)
- ✅ Expanding enum values
CI/CD Integration
GitHub Actions
Troubleshooting
Issue: 404 on API Endpoints
Cause: Routers not registered Solution: Verify all routers inserver_streamable.py:1262-1271
Issue: OpenAPI Generation Fails
Cause: Pydantic model issues ($ref conflicts)
Solution: See scim/schema.py:68-77 for $ref workaround
Issue: Authentication Fails
Cause: JWT secret not configured Solution: SetJWT_SECRET_KEY environment variable
Issue: GDPR Operations Fail
Cause: In-memory storage in production Solution: SetGDPR_STORAGE_BACKEND=postgres
Issue: Rate Limiting Not Working
Cause: Redis not configured Solution: SetREDIS_URL and configure SlowAPI
Performance Tuning
Recommended Settings
Database Connection Pooling
Support & Resources
- OpenAPI Spec:
openapi/v1.json - MCP Tools Spec:
openapi/mcp-tools.json - API Documentation:
/docs(Swagger UI) - Compliance Report:
docs/api-compliance-report.mdx - SDK Usage:
clients/README.md