](https://mseep.ai/app/api7-apisix-mcp)
APISIX模型上下文协议(MCP)服务器
](https://smithery.ai/server/@api7/apisix-mcp)
APISIX模型上下文协议(MCP)服务器用于桥接大型语言模型(LLM)和APISIX管理API。它旨在通过MCP兼容的AI客户端实现基于自然语言的交互,以查看和管理APISIX中的资源。
https://github.com/user-attachments/assets/081e878c-225e-4ff8-a9c5-5813f4784cfe
支持运营
常见操作
get_resource:按类型检索资源(路线、服务、上游等)delete_resource:按ID删除资源send_request_to_gateway:向APISIX网关发送一个或多个请求
API资源运营
create_route/update_route/delete_route:管理路线create_service/update_service/delete_service:管理服务create_upstream/update_upstream/delete_upstream:上游管理create_ssl/update_ssl/delete_ssl:管理SSL证书create_or_update_proto:管理protobuf定义create_or_update_stream_route:管理溪流路线
插件操作
get_all_plugin_names:获取所有可用的插件名称get_plugin_info/get_plugins_by_type/get_plugin_schema:检索插件配置create_plugin_config/update_plugin_config:管理插件配置create_global_rule/update_global_rule:管理插件全局规则get_plugin_metadata/create_or_update_plugin_metadata/delete_plugin_metadata:管理插件元数据
安全配置
get_secret_by_id/create_secret/update_secret:管理机密create_or_update_consumer/delete_consumer:管理消费者get_credential/create_or_update_credential/delete_credential/:管理消费者凭据create_consumer_group/delete_consumer_group:管理消费者群体
AI客户端中的配置
先决条件
遵循APISIX 入门指南 设置和运行APISIX的指南。
通过Smithery安装
通过以下方式自动安装Claude Desktop的APISIX模型上下文协议服务器 史密瑟里:
npx -y @smithery/cli install @api7/apisix-mcp --client claude使用npm
使用以下设置配置您的AI客户端(Cursor、Claude、Copilot等):
{
"mcpServers": {
"apisix-mcp": {
"command": "npx",
"args": [
"-y",
"apisix-mcp"
],
"env": {
"APISIX_SERVER_HOST": "your-apisix-server-host",
"APISIX_SERVER_PORT": "your-apisix-server-port",
"APISIX_ADMIN_API_PORT": "your-apisix-admin-api-port",
"APISIX_ADMIN_API_PREFIX": "your-apisix-admin-api-prefix",
"APISIX_ADMIN_KEY": "your-apisix-api-key"
}
}
}
}使用源代码
首先克隆apisix-mcp存储库:
git clone https://github.com/api7/apisix-mcp.git
cd apisix-mcp安装依赖项并构建项目:
pnpm install
pnpm build使用以下设置配置您的AI客户端(Cursor、Claude、Copilot等):
{
"mcpServers": {
"apisix-mcp": {
"command": "node",
"args": [
"your-apisix-mcp-path/dist/index.js"
],
"env": {
"APISIX_SERVER_HOST": "your-apisix-server-host",
"APISIX_SERVER_PORT": "your-apisix-server-port",
"APISIX_ADMIN_API_PORT": "your-apisix-admin-api-port",
"APISIX_ADMIN_API_PREFIX": "your-apisix-admin-api-prefix",
"APISIX_ADMIN_KEY": "your-apisix-api-key"
}
}
}
}环境变量
| 变量 | 描述 | 默认值 |
|---|---|---|
APISIX_SERVER_HOST | 有权访问您的APISIX服务器的主机 | http://127.0.0.1 |
APISIX_SERVER_PORT | APISIX服务器端口 | 9080 |
APISIX_ADMIN_API_PORT | 管理员API端口 | 9180 |
APISIX_ADMIN_API_PREFIX | 管理员API前缀 | /apisix/admin |
APISIX_ADMIN_KEY | 管理员API身份验证密钥 | edd1c9f034335f136f87ad84b625c8f1 |
要查看或修改APISIX中的管理API配置,请参阅 管理员API 文档。
资源
开放式MCP市场API支持
- 允许AI App/Agent/LLM通过常见的python/typescript API找到此MCP服务器,搜索并探索相关的服务器和工具
*示例:搜索服务器和工具*
import anthropic
import mcp_marketplace as mcpm
result_q = mcpm.search(query="apisix mcp", mode="list", page_id=0, count_per_page=100, config_name="deepnlp") # search server by category choose various endpoint
result_id = mcpm.search(id="api7/apisix-mcp", mode="list", page_id=0, count_per_page=100, config_name="deepnlp") # search server by id choose various endpoint
tools = mcpm.list_tools(id="api7/apisix-mcp", config_name="deepnlp_tool")
# Call Claude to Choose Tools Function Calls
client = anthropic.Anthropic()
response = client.messages.create(model="claude-3-7-sonnet-20250219", max_tokens=1024, tools=tools, messages=[])
