# Apache APISIX MCP for AI Agents MCP

> The Apache APISIX MCP lets your AI agent manage complex cloud-native APIs through natural language. You configure routes, update services, and monitor traffic flow without needing to use cURL or navigating a dashboard. It gives you full control over high-performance microservices architecture directly from your chat client.

## Overview
- **Category:** loved-by-devs
- **Price:** Free
- **Tags:** api-gateway, traffic-management, cloud-native, load-balancing, microservices

## Description

Managing an API gateway usually means jumping between dashboards, running complex CLI commands, and wrestling with massive JSON blocks. This MCP changes that entirely. Instead of learning the intricacies of every configuration parameter, you just tell your AI agent what needs to happen—like 'Route all `/v2/users` traffic through the new load balancer' or 'Increase rate limiting for the mobile client.' It handles the underlying API calls to update everything from routes and services to SSL certificates. You use this MCP via Vinkius, connecting it once to any compatible AI client, giving your agent immediate access to managing your entire microservices infrastructure. The result is that you can orchestrate high-performance traffic management using nothing but plain conversation.

## Tools

### dump_control_discovery
Retrieves a memory dump of all discovered service endpoints configured in the gateway.

### dump_control_plugin_metadatas
Outputs metadata for every plugin currently registered and used by the Control API.

### dump_control_routes
Provides a full list of all existing, configured Routes within the control plane.

### dump_control_services
Outputs details for every Service entity registered across your microservice mesh.

### dump_control_upstreams
Retrieves a dump of all Upstream configurations, showing where traffic is currently being directed.

### get_consumer_group
Fetches the details for one specific Consumer Group using its unique ID.

### get_consumer
Looks up and returns a specific API Consumer record based on their username.

### get_control_healthcheck
Checks the overall health status of all connected upstream nodes for immediate failure detection.

### put_upstream
Creates a brand new Upstream configuration or modifies an existing one with updated node details.

### reload_control_plugins
Triggers a hot reload of all configured plugins, ensuring changes take effect without downtime.

### trigger_control_gc
Forces a full garbage collection cycle in the underlying HTTP Lua VM to free up memory.

### get_control_resource_healthcheck
Checks and reports on the specific health status of any named gateway resource you point it to.

### get_control_schema
Retrieves the JSON schemas for all available resources and plugins, useful for validation.

### get_global_rule
Fetches the full details of a specific Global Rule by its unique identifier.

### get_plugin_config
Retrieves all configuration settings for a specified plugin using its ID.

### get_proto
Fetches the details of a specific Protocol Buffer (Proto) definition by ID.

### get_route
Retrieves all configuration details for a single Route using its unique identifier.

### get_service
Fetches the complete definition of an API Service, including plugins and upstreams.

### get_ssl
Retrieves the details for a specific SSL certificate used by the gateway.

### get_stream_route
Fetches the configuration of a Stream Route, which handles Layer 4 (L4) traffic routing.

### get_upstream
Retrieves all information about a specific Upstream cluster using its unique ID.

### list_consumer_groups
Lists every Consumer Group currently defined in your gateway's configuration.

### list_consumers
Retrieves a list of all API Consumers, showing who has been granted access.

### list_global_rules
Lists every Global Rule in the gateway, allowing you to audit cross-cutting policies.

### list_plugin_configs
Provides a list of all Plugin Configurations currently deployed and active.

### list_protos
Lists every Protocol Buffer (Proto) definition available in the system.

### list_routes
Retrieves a list of all active Routes configured on the API Gateway.

### list_services
Lists every Service entity, providing an overview of your microservice endpoints.

### list_ssls
Provides a list of all SSL certificates currently managed by the gateway.

### list_stream_routes
Lists all Stream Routes, which control basic network layer (L4) traffic routing.

### list_upstreams
Retrieves a list of every Upstream cluster defined, showing potential backend targets.

### put_consumer_group
Create or update an APISIX Consumer Group

### put_consumer
Create or update an APISIX Consumer

### put_global_rule
Create or update an APISIX Global Rule

### put_plugin_config
Create or update an APISIX Plugin Config

### put_proto
Create or update an APISIX Proto

### put_route
Create or update an APISIX Route

### put_service
Create or update an APISIX Service

### put_ssl
Create or update an APISIX SSL certificate

### put_stream_route
Create or update an APISIX Stream Route

### delete_consumer_group
Delete an APISIX Consumer Group

### delete_consumer
Delete an APISIX Consumer

### delete_global_rule
Delete an APISIX Global Rule

### delete_plugin_config
Delete an APISIX Plugin Config

### delete_proto
Delete an APISIX Proto

### delete_route
Delete an APISIX Route

### delete_service
Delete an APISIX Service

### delete_ssl
Delete an APISIX SSL certificate

### delete_stream_route
Delete an APISIX Stream Route

### delete_upstream
Delete an APISIX Upstream

## Prompt Examples

**Prompt:** 
```
List all active API routes that point to the user authentication service.
```

**Response:** 
```
**Found 3 Routes for Authentication:**

*   `api/auth/v1`: Active, uses SSL cert ID `abc-123`. Matches header `X-Auth-Key`.
*   `internal/auth`: Active, reserved for internal IPs. Uses rate limit of 500/min.
*   `webhooks/user_event`: Active, requires Consumer Group `WEBHOOKS`. Last updated 2 hours ago.
```

**Prompt:** 
```
What is the current health status of all back-end nodes for the inventory API?
```

**Response:** 
```
**Gateway Health Check Status:**

*   **Inventory Upstream:** Healthy. Nodes: `10.0.1.2:8080` (Weight 3), `10.0.1.3:8080` (Weight 3). *Status: OK.*
*   **Payment Upstream:** Warning. Node: `10.0.2.1:8080`. *Status: Degraded*. Last check failed due to timeout.
```

**Prompt:** 
```
I need to increase the rate limit for the 'mobile-client' consumer group.
```

**Response:** 
```
**Consumer Group Rate Limit Update:**

The `mobile-client` Consumer Group was successfully updated. The new limits are:

*   **Rate Limit:** 250 requests per minute (increased from 100/min).
*   **Burst Limit:** 50 requests.
*   **Active Consumers:** 3 (Includes `user-mobile-abc`, etc.).
Please remember to redeploy the gateway for this change to take effect.
```

## Capabilities

### Discovering Gateway Configuration
Retrieve metadata dumps for all configured routes, services, upstreams, and plugins to audit the current state of your gateway.

### Managing API Traffic Paths
List, create, or delete specific routing rules (Routes) that direct client requests to the correct backend service.

### Updating Backend Endpoints
Set up new Upstream configurations for load balancing and managing node health checks across your application cluster.

### Controlling User Access and Limits
List, create, or delete API Consumers and Consumer Groups to manage authentication keys and enforce per-user rate limits.

### Monitoring System Health
Check the operational health status of specific upstream nodes or entire gateway resources in real time.

## Use Cases

### Hotfix Routing for a Broken Service
A payment service endpoint fails unexpectedly. Instead of manually logging into the dashboard, you ask your agent to list all upstreams, identify the failing node, and then trigger `put_upstream` to redirect traffic to a backup cluster immediately.

### Onboarding a New Client Application
A new mobile app requires specific rate limits. You ask your agent to list consumer groups, verify the right group exists, and then use `put_consumer` to create the account and assign appropriate access.

### Auditing Gateway Complexity Before Migration
Before migrating microservices, you need a full map. You prompt your agent to run `dump_control_routes`, `dump_control_services`, and `dump_control_upstreams` to get a comprehensive, structured data dump for documentation.

### Scaling Out a Core API Endpoint
The user service is hitting capacity. You ask your agent to update the upstreams by running `put_upstream`, adding several new node IPs and adjusting the load balancing weight, all in one go.

## Benefits

- Instead of building complex cURL commands, you ask your agent to configure a new route or service. For example, asking the agent to create an endpoint for `/api/v2/orders` handles all the JSON updates automatically.
- You can instantly audit your infrastructure's health. Running `get_control_healthcheck` lets you know if all upstream nodes are up before deploying any code changes.
- Manage user access without touching rate limits or keys. Using tools like `list_consumers` and `put_consumer` allows you to provision new client credentials in minutes via conversation.
- Update complex configurations for services or plugins using natural language prompts, bypassing the need to manually edit raw YAML or JSON files.
- The MCP lets you differentiate between L7 (HTTP) routes and basic network layer (L4) traffic flow by managing both `list_routes` and `list_stream_routes` seamlessly.

## How It Works

The bottom line is that you treat complex API Gateway management like a conversation, not like an engineering task requiring dozens of manual clicks or CLI commands.

1. First, you subscribe to this MCP and provide your APISIX Admin URL along with an API Admin Key.
2. Next, you interact with the system using natural language prompts in your AI client, asking it to perform infrastructure changes or retrievals (e.g., 'Create a new route for payments').
3. Finally, the agent executes the necessary low-level calls, updating resources like routes and upstreams directly on your gateway.

## Frequently Asked Questions

**How can I use the Apache APISIX MCP for AI Agents to manage my API routes?**
You manage your API routes conversationally. Instead of running complex commands, you tell your agent what path needs routing—like 'Send all `/billing` traffic to Cluster B.' The agent handles creating or updating the necessary route definitions automatically.

**Does this MCP help with microservices load balancing?**
Yes. You can manage upstreams and load balancing rules directly through the MCP. You tell your agent which nodes need to be added or removed from a cluster, and it updates the upstream configuration for you.

**What if I need to check if my gateway is running correctly?**
You can use this MCP to run health checks. You simply ask your agent to check the status of any specific resource or all upstreams, giving you an immediate report on which parts are failing.

**Can I change API consumer access rules using the Apache APISIX MCP for AI Agents?**
Absolutely. The MCP lets your agent manage user authentication by listing and creating consumers or even entire consumer groups, allowing you to define who can talk to which services.

**Is this better than using the command line interface (CLI)?**
It's far less cumbersome. The CLI requires perfect syntax and remembering resource IDs. With the MCP, your AI agent understands intent—you just tell it what you want done, regardless of how many parameters are involved.