Connect Akto with Kong
Monitor and secure all incoming requests and outgoing responses from your AI agents and MCP (Model Context Protocol) servers running on Kong API Gateway. The akto-mcp-endpoint-shield plugin works for any agentic workload behind Kong — whether that's an MCP server handling tool calls, an AI agent API, an LLM-backed service, or any HTTP-based AI workload. It captures traffic flowing through Kong and sends it to Akto's guardrail service for real-time security analysis, visibility, and compliance monitoring.

Prerequisites
Before you begin, make sure you have:
Kong Gateway 2.0 or later already running with your AI agent or MCP server registered as a Kong service/route
Access to Kong's Admin API (default:
http://localhost:8001)A server or Kubernetes cluster to host the Akto guardrail backend
Your Akto API Token (go to Akto Argus → Connectors → Setup Guardrail card and copy your token)
Step 1: Install the Plugin in Kong
Download the Plugin Files
Clone the Akto Kong integration repository:
Inside the plugin/ directory you will find two files:
handler.lua— plugin logicschema.lua— configuration schema
You only need these two files. Nothing else from the repository is required for the plugin itself.
Copy the Plugin Files into Kong
Create the plugin directory inside Kong and copy both files into it:
Using Docker? Mount the plugin directory as a volume instead:
Register the Plugin with Kong
Add akto-mcp-endpoint-shield to Kong's plugins list. How you do this depends on how Kong is configured:
Via kong.conf:
Via environment variable:
If you are using Docker Compose, set this as an environment variable on the Kong service.
Restart Kong
Or if using Docker:
Step 2: Enable the Plugin on Your Service or Route
You can attach the plugin to a specific service, a specific route, or globally across all traffic.
Enable on a specific service (recommended — scopes monitoring to your AI agent or MCP service only):
Enable on a specific route:
Enable globally (monitors all traffic through Kong):
Replace <AKTO_GUARDRAIL_URL> with your guardrail service URL:
If Akto provided you a URL (e.g.,
https://17*******0-guardrails.akto.io), use that directly.Otherwise, complete Step 3 to self-host the backend and use the URL you get from there.
Configuration Parameters
service_url
Yes
Base URL of your deployed Akto guardrail backend (e.g., http://10.0.1.4:8080)
mode
Yes
async — non-blocking, logs traffic in background. blocked — validates request and response before serving, can return 403.
timeout
No
Request timeout in milliseconds. Default: 30000. Recommended minimum: 15000.
You can also configure the plugin via Kong Manager UI: go to Plugins → New Plugin → search for akto-mcp-endpoint-shield.
Step 3: Deploy the Akto Guardrail Backend
If you already have the Akto guardrail backend deployed (or have been given a service_url by your team), skip this step and use that URL directly in Step 2.
The guardrail backend is a set of services that receive traffic from the Kong plugin, run security checks, and ingest data for analysis. You can deploy it using Docker Compose (any Linux VM) or Helm (Kubernetes).
Option A: Docker Compose — Any Linux VM
This is the fastest way to get started. You need a Linux server with at least 4 vCPUs and 8 GB RAM.
The deployment files are available at:
https://github.com/akto-api-security/infra/tree/feature/quick-setup/guardrail-service-e2e-setup
Clone the Setup Repository
Set Up Environment Files
Navigate into the docker-compose folder, then copy each template and fill in your Akto API token:
Open each .env file you just created and replace every <YOUR_AKTO_API_TOKEN> with your token from the Akto dashboard (Settings → API Tokens).
Never publish .env files in the public — they contain your API token.
Start the Services
This starts the following services:
zoo1
2181
ZooKeeper (Kafka coordination)
kafka1
9092
Kafka message broker
akto-api-security-runtime
—
Processes API traffic from Kafka
guardrails-service
9090
Async guardrails (Kafka-based)
guardrails-service-http
9091
Internal sync guardrails (called by data-ingestion-service)
data-ingestion-service
8080
Receives traffic, runs guardrails, and ingests data — this is the Kong plugin endpoint
Verify All Services Are Running
All services should show status Up. If any are restarting, check their logs:
Test the guardrail service endpoint directly:
Update the Kong Plugin with the Service URL
Your guardrail service is now available at http://<YOUR_SERVER_IP>:8080. Update the Kong plugin configuration:
Or if you haven't enabled the plugin yet, use this URL in the Step 2 commands above.
If your Kong instance and guardrail server are on different networks, make sure port 8080 is accessible from the Kong host. If you want HTTPS, place a reverse proxy (nginx, Caddy) or load balancer in front of the guardrail service.
Option B: Kubernetes (Helm Charts)
Use this option if your infrastructure runs on Kubernetes.
Add the Akto Helm Repository
Install the Charts in Order
Deploy the following four charts in the exact order shown. Each chart depends on the previous one.
Chart 1 — Database Abstractor
Sets up the data access layer. After installing, retrieve the service token from your Akto dashboard.
Chart 2 — Data Ingestion + Runtime
Processes and stores the traffic captured by the Kong plugin.
Chart 3 — Threat Backend
Chart 4 — AI Guardrails
Verify All Pods Are Running
You should see pods for all four charts in Running status. If any pod is stuck in CrashLoopBackOff or Pending, check its logs:
Get the Guardrail Service URL
Use the service's CLUSTER-IP (for in-cluster access) or set up an Ingress / LoadBalancer service for external access. Update the Kong plugin config.service_url with this URL.
How the Two Modes Work
async
blocked
When guardrails run
After the response is sent to the client
Before the request reaches your AI agent or MCP server
Impact on latency
None — runs in background
Adds guardrail check latency to every request
Can block requests
No (logs only)
Yes — returns 403 if a request or response is flagged
Best for
Monitoring and visibility
Enforcing security policies
Start with async to monitor traffic without impacting your users. Switch to blocked once you've validated your guardrail rules.
Verify the Integration
After setup, send a test request through Kong (use the port Kong is listening on in your environment):
Check Kong logs to confirm the plugin is active:
In async mode, you should see lines like:
In blocked mode, the log will show each step: request check → upstream call → response check.
Troubleshooting
Plugin not loading after restart
Verify that akto-mcp-endpoint-shield appears in KONG_PLUGINS and that both handler.lua and schema.lua are present in the correct directory. Run kong check to validate the configuration.
[akto] async ingest error: request failed: timeout
The guardrail service is not reachable from Kong within the configured timeout. Check:
The
config.service_urlis correct and reachable from the Kong hostFirewall/NSG rules allow traffic on port
9091(or your configured port)Increase
config.timeout(e.g.,15000ms) if the service is reachable but slow on first connection due to SSL handshake
No [akto] lines in Kong logs
The default Kong log level is warn. Plugin info messages only appear at info level. Set KONG_LOG_LEVEL=info in your Kong environment and restart.
blocked mode returns 500 / unexpected errors
Confirm that kong.router.get_route() returns a valid route object. This happens when the plugin runs on a route that is properly registered via the Kong Admin API.
Get Support
Raise an issue in the Kong Integration GitHub repository
Contact the team via Slack or your assigned support channel
For enterprise support, email the engineering team with your Kong version, plugin version, and relevant log snippets
Last updated