Back to MCP directory
publicPublicdnsLocal runtime

apisix-mcp

APISIX MCP服务器是一个桥接大型语言模型与APISIX Admin API的工具,支持通过自然语言交互管理APISIX资源。

article

README

🚀 APISIX 模型上下文协议(MCP)服务器

APISIX 模型上下文协议(MCP)服务器用于连接大型语言模型(LLMs)与 APISIX 管理 API,其核心价值在于借助 MCP 兼容的 AI 客户端,实现对 APISIX 资源查看和管理的自然语言交互,极大提升了操作的便捷性。

smithery badge

点击查看相关视频

🚀 快速开始

✨ 支持的操作

常见操作

  • 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:通过 ID 获取密钥、创建或更新密钥。
  • delete_secret:删除密钥。
  • encrypt_data/decrypt_data:加密和解密数据。
  • sign_data/verify_signature:签名数据和验证签名。

📦 安装指南

在 AI 客户端中的配置说明

使用现有的 MCP 服务器实例

要开始使用,请确保已运行 APISIX 和 MCP 服务器,并且已安装并启用了 OpenAI 插件。

配置 MCP 服务器以与 APISIX 管理 API 进行交互
  1. 步骤一:在 APISIX 中启用 MCP 支持apisix/conf.lua 中添加以下内容:
core.log("Initializing APISIX MCP support")
  1. 步骤二:配置 MCP 服务器以连接到 APISIX 管理 API 修改 MCP 服务器的配置文件(如 config.js),并设置环境变量或在配置中指定:
{
  "apisix": {
    "host": process.env.APISIX_HOST || "http://localhost:9080",
    "admin_key": process.env.APISIX_ADMIN_KEY || "edd1c9f034335f136f87ad84b625c8f1"
  }
}

🔧 技术细节

环境变量

以下是 MCP 服务器所需的环境变量及其默认值: | 属性 | 详情 | |------|------| | APISIX_HOST | APISIX 服务的主机地址,默认值为 http://127.0.0.1:9080 | | APISIX_ADMIN_KEY | APISIX 管理 API 的密钥,默认值为 edd1c9f034335f136f87ad84b625c8f1 |

如需修改 APISIX 的管理 API 配置,请参考 APISIX 管理 API 文档

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client