Skip to main content

API Gateway Deployment Guide

Complete guide for deploying OpenAPI-compliant APIs to production API Gateways.

Table of Contents

  1. Prerequisites
  2. Kong API Gateway
  3. AWS API Gateway
  4. Google Cloud API Gateway
  5. Azure API Management
  6. 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:validate endpoint
  • Kong calls /api/v1/api-keys/validate to exchange API key for JWT
Kong Plugin Config:

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 Keys
Option B: JWT (Firebase Auth)

Azure 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

Legend: ✅ Full Support | ⚠️ Partial | ❌ Not Supported

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

  1. Announce deprecation - 6 months notice
  2. Mark as deprecated - Add deprecated: true to OpenAPI
  3. Update /api/version - Add to deprecated_versions with sunset date
  4. Return headers - Sunset: Sat, 01 Jun 2026 00:00:00 GMT
  5. 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 in server_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: Set JWT_SECRET_KEY environment variable

Issue: GDPR Operations Fail

Cause: In-memory storage in production Solution: Set GDPR_STORAGE_BACKEND=postgres

Issue: Rate Limiting Not Working

Cause: Redis not configured Solution: Set REDIS_URL and configure SlowAPI

Performance Tuning

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
Generated: 2025-11-02 Version: 2.8.0