This repository demonstrates how to use Kong Gateway with the Model Context Protocol (MCP) to expose APIs and services as AI-accessible tools. It showcases two main patterns for integrating MCP with Kong Gateway.
The Model Context Protocol (MCP) is an open standard that enables AI applications to securely connect to external data sources and tools. This repository provides practical examples of using Kong Gateway's ai-mcp-proxy plugin to:
- Convert REST APIs to MCP tools - Transform existing HTTP APIs into MCP-compatible tools that AI agents can discover and use
- Proxy MCP registries - Connect to MCP server registries for dynamic tool discovery
- Build AI agents - Create intelligent agents that leverage MCP tools through Kong Gateway
kong-mcp-gateway-examples/
├── mcp-proxy/ # MCP proxy pattern examples
│ ├── kong-config/ # Kong Gateway configuration
│ └── openapi.yaml # Chuck Norris API OpenAPI specification
├── mcp-registry/ # MCP registry integration examples
│ ├── kong-config/ # Kong Gateway configuration
│ └── volcano-agent/ # AI agent using Volcano SDK
│ ├── src/ # TypeScript source files
│ │ ├── agent.ts # CLI implementation
│ │ └── server.ts # Web UI server
│ ├── public/ # Web UI frontend (dark theme)
│ └── package.json
└── example/ # Basic Kong AI Gateway usage
- Docker and Docker Compose
- Node.js 18+ (for the Volcano agent)
- Python 3.8+ (for the basic example)
- OpenAI API key
Set your OpenAI API key:
export OPENAI_API_KEY="your-api-key-here"Demonstrates how to expose REST APIs as MCP tools using Kong Gateway's ai-mcp-proxy plugin in conversion-listener mode.
Use Cases:
- Convert existing REST APIs to MCP tools
- Expose third-party APIs (like Chuck Norris API) to AI agents
- Proxy remote MCP servers
Key Features:
- Automatic REST-to-MCP conversion
- Tool discovery and invocation
- Request/response logging
- Passthrough mode for existing MCP servers
See mcp-proxy/README.md for detailed setup and usage.
Shows how to integrate with MCP server registries for dynamic tool discovery and includes a Volcano SDK-based AI agent.
Use Cases:
- Connect to MCP server registries
- Dynamic tool discovery
- Build AI agents that search and use MCP tools
- Secure registry access with authentication
Components:
- Kong configuration for registry access
- Volcano Agent - TypeScript AI agent using the Volcano SDK
- CLI Mode: Command-line interface for quick scripting
- Web UI Mode: Dark-themed web interface with Kong 2026 branding (neon lime green)
- Integration with Konnect for secure credential management
See mcp-registry/README.md for detailed setup and usage.
Simple Python example demonstrating Kong AI Gateway usage with OpenAI client.
See example/README.md for setup instructions.
The ai-mcp-proxy plugin is the core component that enables MCP integration. It supports two modes:
Converts REST API endpoints into MCP tools by defining tool schemas in the Kong configuration.
plugins:
- name: ai-mcp-proxy
config:
mode: conversion-listener
tools:
- description: Retrieve a random joke
method: GET
path: /api/jokes/randomProxies requests to existing MCP servers without modification.
plugins:
- name: ai-mcp-proxy
config:
mode: passthrough-listenerAI Agent (OpenAI/Anthropic)
↓
Kong Gateway (ai-mcp-proxy plugin)
↓
├── REST APIs (converted to MCP tools)
├── MCP Servers (proxied)
└── MCP Registries (for tool discovery)
Contributions are welcome! Please feel free to submit issues or pull requests.
This project is provided as-is for demonstration purposes.
For questions or issues:
- Kong Gateway: Kong Community
- MCP Protocol: MCP GitHub