APISIX Admin MCP Server
Read-only MCP tools for querying APISIX routes, upstreams, services, and plugins across environments, without giving direct access to the admin API.
README
APISIX Admin MCP Server
Read-only MCP tools for querying APISIX routes, upstreams, services, and plugins across the Nila project's environments, without giving Claude Code direct access to the APISIX admin API.
How it works
apisix_service.py— business logic. For each call, it lazily starts (and reuses) akubectl port-forwardto that environment's*-apisix-adminService (port 9180), then makes an authenticated HTTP GET to the admin API.test_route_matchingadditionally port-forwards to the*-apisix-gatewayService (port 80, the data plane) to send one live, idempotent (GET/HEAD/OPTIONS-only) request and observe the real routing/plugin decision — the Admin API has no "would this match" endpoint, so this is the only way to test matching without guessing.get_upstream_healthport-forwards to the apisixDeployment(not a Service — the Control API is bound to127.0.0.1inside the pod, which only a Deployment/pod-based port-forward can reach) to query/v1/healthcheckfor live node status, since the Admin API only exposes the configured health-check policy, not observed health.mcp_apisix.py— wrapsapisix_service.pyfunctions as MCP tools usingFastMCP, served over Streamable HTTP (same pattern asopenwebui_log/middleware/mcp_server.py).
Only read (GET) Admin API operations, plus safe idempotent gateway probes
for route-matching tests, are implemented. Write operations to the Admin API
(create/update/delete route) are intentionally out of scope for this first
pass — see the agile card for the approval-gated write path to add next.
Setup
cd MCP_Server
python3 -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # then fill in APISIX_VIEWER_KEY
Requires:
kubectlconfigured with a context that can reach the target cluster (kubectl config current-context)- RBAC access to
get/port-forward the*-apisix-adminand*-apisix-gatewayServices, and the*-apisixDeployment (used forget_upstream_health's Control API access), in the namespaces listed inapisix_service.ENVIRONMENTS
Run
source .env && ./run.sh
This starts:
mcp_apisix.pyon:8002(the actual MCP server)mcpoon:8000(OpenAPI proxy in front of it, for OpenWebUI/tool-calling clients that expect an OpenAPI tool server)
Don't run this at the same time as openwebui_log/middleware/run.sh without
changing one of the ports — both scripts currently default mcpo to :8000.
Available tools
| Tool | Description |
|---|---|
list_environments() |
List queryable environment names |
list_routes(env) |
List all routes |
get_route(env, route_id) |
Get one route's full config |
list_upstreams(env) |
List all upstreams (LB/health-check config) |
get_upstream(env, upstream_id) |
Get one upstream's full config |
list_services(env) |
List all APISIX services |
list_plugins(env) |
List available/enabled plugins |
get_plugin_config(env, plugin_name) |
Get one plugin's schema/config |
test_route_matching(env, route_id, method="GET", extra_path="") |
Safely test whether a route matches (and which plugins fire) via one live idempotent gateway request — no config changes |
get_upstream_health(env, upstream_id) |
Live health-check status (per-node, from the Control API) for one upstream — found: false means it has no health-check policy configured, not an error |
env is one of: rag-edge-dev, rag-edge-stg, seven-deli-dev,
seven-deli-stg, allchat-edge-stg (see apisix_service.ENVIRONMENTS).
Usage examples
These call the tools through the mcpo OpenAPI proxy (:8000, started by
run.sh) — the same way OpenWebUI or any HTTP tool-calling client would.
From Claude Code / another MCP client, call the equivalent tool directly
instead, e.g. get_route(env="rag-edge-dev", route_id="c524ad0a").
List routes, then inspect one:
curl -s -X POST http://localhost:8000/list_routes \
-H 'content-type: application/json' -d '{"env": "rag-edge-dev"}'
curl -s -X POST http://localhost:8000/get_route \
-H 'content-type: application/json' \
-d '{"env": "rag-edge-dev", "route_id": "c524ad0a"}'
Test whether a route matches, without changing anything — here, an
auth-protected route (route_plugins in the response confirms
openid-connect actually fired, status: 302 shows it redirected to the
IdP login rather than letting the request through):
curl -s -X POST http://localhost:8000/test_route_matching \
-H 'content-type: application/json' \
-d '{"env": "rag-edge-dev", "route_id": "6abcc371", "method": "GET"}'
# -> {"ok": true, "matched": true, "status": 302,
# "headers": {"Location": "https://.../oauth2/authorize?...", ...},
# "route_plugins": ["limit-req", "openid-connect"], ...}
Probing a sub-path of a wildcard route with extra_path, and confirming a
proxy-rewrite route actually reached its upstream (a real 404 from the
backend, not APISIX's own route-not-found page):
curl -s -X POST http://localhost:8000/test_route_matching \
-H 'content-type: application/json' \
-d '{"env": "rag-edge-dev", "route_id": "a5c96322", "extra_path": "/ping"}'
# -> {"ok": true, "matched": true, "status": 404,
# "body_preview": "{\"detail\":\"Not Found\"}", "route_plugins": ["proxy-rewrite"], ...}
Only GET/HEAD/OPTIONS are accepted — anything else is rejected before
any request is sent:
curl -s -X POST http://localhost:8000/test_route_matching \
-H 'content-type: application/json' \
-d '{"env": "rag-edge-dev", "route_id": "6abcc371", "method": "POST"}'
# -> {"ok": false, "error": "method 'POST' not allowed for live route tests, ..."}
Check live upstream health:
curl -s -X POST http://localhost:8000/get_upstream_health \
-H 'content-type: application/json' \
-d '{"env": "rag-edge-dev", "upstream_id": "9dff8669"}'
# -> {"ok": true, "found": false, "nodes": []}
# ("found": false here is correct, not a bug — this upstream has no
# `checks` policy configured at all, confirmed via get_upstream)
Security note
Every environment currently uses APISIX's stock demo admin/viewer keys
(publicly known, from APISIX's own docs). This server only uses the
viewer key and only issues GET requests, but the underlying admin API
itself is not meaningfully protected — rotate the keys in each
environment's config.yaml ConfigMap independent of this tool.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。