APISIX Model Context Protocol (APISIX-MCP)
APISIX-MCP is a Model Context Protocol (MCP) server that exposes APISIX operations as tools to MCP-compatible AI clients and agents. After you configure the server, the client or agent can discover and call these tools to inspect or manage APISIX resources and send test requests through the gateway.
APISIX-MCP connects to the Admin API for resource operations. Its gateway request tool sends traffic through the APISIX proxy instead.
APISIX-MCP is not bundled with APISIX. Its source is hosted in the API7 GitHub organization, and its package is available on npm.
For a comparison of APISIX-MCP with the other APISIX management options, see Management Options.
Install and Configure APISIX-MCP
Run APISIX-MCP from npm or build it from source, then add the server to your AI client's MCP configuration.
From npm
Add the following MCP server configuration to your AI client. Update the APISIX server address, ports, API prefix, and authentication key for your environment:
{
"mcpServers": {
"apisix-mcp": {
"command": "npx",
"args": ["-y", "apisix-mcp"],
"env": {
"APISIX_SERVER_HOST": "http://127.0.0.1",
"APISIX_SERVER_PORT": "9080",
"APISIX_ADMIN_API_PORT": "9180",
"APISIX_ADMIN_API_PREFIX": "/apisix/admin",
"APISIX_ADMIN_KEY": "edd1c9f034335f136f87ad84b625c8f1"
}
}
}
}
From Source
To install from source code, first clone the apisix-mcp repository:
git clone https://github.com/api7/apisix-mcp.git
cd apisix-mcp
Install the dependencies and build the project:
pnpm install
pnpm build
Add the following MCP server configuration to your AI client. Replace the executable path and update the APISIX connection settings for your environment:
{
"mcpServers": {
"apisix-mcp": {
"command": "node",
"args": [
"/absolute/path/to/apisix-mcp/dist/index.js"
],
"env": {
"APISIX_SERVER_HOST": "http://127.0.0.1",
"APISIX_SERVER_PORT": "9080",
"APISIX_ADMIN_API_PORT": "9180",
"APISIX_ADMIN_API_PREFIX": "/apisix/admin",
"APISIX_ADMIN_KEY": "edd1c9f034335f136f87ad84b625c8f1"
}
}
}
}
The APISIX_SERVER_HOST, APISIX_SERVER_PORT, APISIX_ADMIN_API_PORT, APISIX_ADMIN_API_PREFIX, and APISIX_ADMIN_KEY above are configured to their default values. If your APISIX installation uses these default values, you can optionally omit the env configurations.
After you save the configuration, the AI client should start APISIX-MCP and make its tools available.
Available MCP Tools
APISIX-MCP exposes APISIX operations as MCP tools. An AI client or agent can select and invoke these tools in response to your instructions. The tools advertised by the running server through the MCP tools/list request are authoritative.
Common Tools
get_resource: Retrieve resources by type, such as routes, services, and upstreams.delete_resource: Delete resources by ID.send_request_to_gateway: Send requests to the gateway.
API Resource Tools
create_route/update_route: Manage routes.create_service/update_service: Manage services.create_upstream/update_upstream: Manage upstreams.create_or_update_proto: Manage protobuf definitions.create_or_update_stream_route: Manage stream routes.
Plugin Tools
get_all_plugin_names: Get all available plugin names.get_plugin_schema: Retrieve plugin schemas by plugin name or type.create_plugin_config/update_plugin_config: Manage plugin configurations.create_global_rule/update_global_rule: Manage global plugins.get_plugin_metadata/create_or_update_plugin_metadata/delete_plugin_metadata: Manage plugin metadata.
Consumer and Security Tools
get_secret_by_id/create_secret/update_secret/delete_secret: Manage secrets.create_or_update_consumer: Manage consumers.get_credential/create_or_update_credential/delete_credential: Manage consumer credentials.create_consumer_group/update_consumer_group: Manage consumer groups.create_ssl/update_ssl: Manage SSL certificates.
Example
To create a route, enter the following prompt in your AI client:
Create a route named httpbin-get-route with route URI /get for accessing https://httpbin.org upstream, rate limiting the requests to 2 requests every 30 seconds. Print the route details after configuration.
The AI client can invoke create_route and report the resulting route configuration. The response wording depends on the client.
You can also send a request to the route from your AI client for verification:
Send a request to this route.
The AI client can invoke send_request_to_gateway and report the response status, body, and headers returned through the gateway.
For more examples, see Configure Routes.