Token导航 LogoToken导航TokenDH.com
Kong Rate Limiter MCP Server logo
运维云端stdio官方级别未说明来源级核验

Kong Rate Limiter MCP Server

MCP Server

一个通过自然语言实现Kong API网关配置管理的MCP服务器,为AI代理提供自动化网关管理能力。

工具数

0

提示词数

0

GitHub Stars

0

资源数

0
API集成PythonClaudeClaude DesktopClaudeClineVS Code

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

IamSupun

提供方

IamSupun

最后核验

2026/5/17 20:23

运行时

Python

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

python -m kong_mcp_server.server

详细介绍

香港速率限制器MCP服务器

![Build Status](https://github.com/ChathuRaaksha/kong-rate-limiter-mcp-server/actions) ![Coverage](https://codecov.io/gh/ChathuRaaksha/kong-rate-limiter-mcp-server) ![Release](https://github.com/ChathuRaaksha/kong-rate-limiter-mcp-server/releases) ![Python](https://www.python.org/downloads/) ![License](https://opensource.org/licenses/Apache-2.0)

A. 模型上下文协议(MCP)服务器 使人工智能代理和LLM能够通过自然语言与Kong API网关进行交互。该服务器弥补了对话式人工智能与Kong强大的API管理能力之间的差距,实现了API网关配置和管理的智能自动化。

🎯 为什么是这个项目?

问题

像Kong这样的现代API网关非常强大,但需要:

  • 深入了解香港的行政API
  • 通过REST API调用或CLI命令进行手动配置
  • 用于服务、路由和插件管理的复杂JSON有效载荷
  • 耗时的故障排除和调试
  • 可以自动化的重复任务

解决方案

此MCP服务器通过以下方式转换Kong管理:

  • 自然语言接口:通过Claude等人工智能代理使用简单的英语配置Kong
  • 智能自动化:让AI助手自动处理复杂的Kong配置
  • 缩短学习曲线:无需记忆Admin API端点或JSON架构
  • 更快的发展:原型和部署API配置只需几秒钟,而不是几小时
  • 错误预防:人工智能辅助验证和最佳实践应用
  • 文档即代码:对话史是活的文献

真实世界用例

1. API快速原型

User: "Create a new service for my user API at https://api.example.com and add a route for /users"
AI Agent: Creates service, configures route, and confirms setup

2. 智能速率限制

User: "Add rate limiting to my payment API - 100 requests per minute per user"
AI Agent: Configures rate limiting plugin with appropriate scope and limits

3. 安全自动化

User: "Set up JWT authentication for all routes in the admin service"
AI Agent: Applies JWT plugin to service with recommended configuration

4. 故障排除

User: "Why is my API returning 502 errors?"
AI Agent: Checks service health, route configuration, and plugin settings

5. 批量操作

User: "Add CORS headers to all my public APIs"
AI Agent: Identifies public services and applies CORS plugin configuration

🌟 主要特点

AI驱动的孔管理

  • 会话界面:通过自然语言对话管理孔
  • 上下文感知操作:AI理解孔的概念和关系
  • 智能默认值:基于最佳实践的智能建议
  • 错误处理:有用的解释和自动恢复建议

全面融入香港

  • 服务管理:创建、读取、更新和删除香港服务
  • 路由配置:香港航线的完整CRUD操作
  • 插件管理:使用范围支持管理所有Kong插件
  • 速率限制:用于速率限制配置的专用工具
  • 身份验证支持:香港CE和EE认证方法

开发者体验

  • FastMCP框架:基于现代高效的MCP SDK构建
  • 苏格兰和南方能源公司运输:实时服务器发送事件通信
  • Docker支持:使用Docker和Docker Compose轻松部署
  • 综合测试:单元和集成测试的高测试覆盖率
  • 大量文档:清晰的指南和示例

🚀 快速开始

先决条件

  • Python 3.10或更高版本
  • Kong Gateway(社区或企业版)
  • Docker(可选,用于容器化部署)
  • MCP客户端(例如,Claude Desktop、Cline for VS Code)

安装

选项1:虚拟环境(建议用于开发)

# Clone the repository
git clone https://github.com/ChathuRaaksha/kong-rate-limiter-mcp-server.git
cd kong-rate-limiter-mcp-server

# Setup and activate virtual environment
./venv.sh

# Run the server
python -m kong_mcp_server.server

# In another terminal, run tests
pytest --cov=kong_mcp_server

选项2:Docker(推荐用于生产环境)

# Pull from Docker Hub
docker pull shibbirmcc/kong-ratelimiter-mcp-server

# Run with host network
docker run --network host \
  -e KONG_ADMIN_URL=http://localhost:8001 \
  shibbirmcc/kong-ratelimiter-mcp-server

选项3:Docker编写

version: '3.8'
services:
  kong-mcp-server:
    image: shibbirmcc/kong-ratelimiter-mcp-server
    ports:
      - "8080:8080"
    environment:
      - KONG_ADMIN_URL=http://kong:8001
      - KONG_TIMEOUT=30.0
    restart: unless-stopped

🔧 配置

环境变量

Kong配置

# Kong Admin API URL (required)
export KONG_ADMIN_URL=http://localhost:8001

# Kong Community Edition Authentication
export KONG_USERNAME=admin
export KONG_PASSWORD=your-password

# Kong Enterprise Edition Authentication (alternative)
export KONG_API_TOKEN=your-api-token

# Additional Options
export KONG_TIMEOUT=30.0              # Request timeout (seconds)
export KONG_VERIFY_SSL=true           # SSL verification

服务器配置

export FASTMCP_PORT=8080              # Server port (default: 8080)
export HOST=127.0.0.1                 # Server host (default: 127.0.0.1)

MCP客户端配置

克劳德桌面

添加到您的Claude Desktop配置中:

{
  "mcpServers": {
    "kong-rate-limiter": {
      "disabled": false,
      "timeout": 60,
      "type": "sse",
      "url": "http://localhost:8080/sse"
    }
  }
}

Cline(VS代码)

添加到您的Cline MCP设置中:

{
  "kong-rate-limiter": {
    "command": "http://localhost:8080/sse",
    "args": [],
    "env": {}
  }
}

📚 可用工具

服务管理

  • kong_get_services -通过过滤检索香港服务
  • kong_create_service -创建新的香港服务
  • kong_update_service -更新现有服务
  • kong_delete_service -删除服务

路线管理

  • kong_get_routes -通过过滤检索香港航线
  • kong_create_route -创建新路线
  • kong_update_route -更新现有路线
  • kong_delete_route -删除路线

插件管理

  • kong_get_plugins -获取所有具有过滤和分页功能的插件
  • kong_get_plugin -按ID获取特定插件
  • kong_get_plugins_by_service -获取服务范围内的插件
  • kong_get_plugins_by_route -获取用于路由的插件范围
  • kong_get_plugins_by_consumer -获取面向消费者的插件

速率限制

  • kong_create_rate_limiting_plugin -创建所有范围(全局、服务、路由、消费者)的速率限制
  • kong_get_rate_limiting_plugins -使用过滤检索限速插件
  • kong_update_rate_limiting_plugin -更新速率限制配置
  • kong_delete_rate_limiting_plugin -删除限速插件

测试

  • hello_world -用于连接验证的基本测试工具

🏗️ 建筑

src/kong_mcp_server/
├── server.py                    # Main MCP server with FastMCP
├── kong_client.py               # Kong Admin API HTTP client
├── tools_config.json            # Tool configuration and metadata
└── tools/                       # Modular tool implementations
    ├── basic.py                 # Basic utility tools
    ├── kong_services.py         # Service management
    ├── kong_routes.py           # Route management
    ├── kong_plugins.py          # Plugin management
    └── kong_rate_limiting.py    # Rate limiting operations

设计原则

  • 模块化:每个工具类别在单独的模块中
  • 可扩展性:通过JSON配置轻松添加新工具
  • 类型安全:完整的类型提示和验证
  • 错误处理:全面的错误消息和恢复
  • 测试:模拟和实时测试的高测试覆盖率

🧪 测试

运行测试

# All tests with coverage
pytest --cov=kong_mcp_server --cov-report=term-missing

# Specific test suite
pytest tests/test_tools_kong_rate_limiting.py -v

# Integration tests (requires Kong instance)
RUN_LIVE_TESTS=true pytest tests/test_kong_integration.py

测试覆盖率

该项目保持了所有模块的高测试覆盖率:

  • 所有工具的单元测试
  • 与Kong的集成测试
  • HTTP客户端身份验证测试
  • 错误处理和边缘情况

🛠️ 发展

添加新工具

  1. 创建工具模块src/kong_mcp_server/tools/
async def my_new_tool(param1: str, param2: int) -> dict:
    """Tool description for AI."""
    # Implementation
    return {"result": "success"}
  1. 添加到tools_config.json
{
  "tools": {
    "my_new_tool": {
      "name": "my_new_tool",
      "description": "Description for AI agent",
      "module": "kong_mcp_server.tools.my_module",
      "function": "my_new_tool",
      "enabled": true
    }
  }
}
  1. 添加测试tests/
  1. 重新启动服务器 -更改将被自动拾取

代码质量

# Linting
flake8 src/ tests/

# Type checking
mypy src/

# Formatting
black src/ tests/
isort src/ tests/

📖 用法示例

示例1:创建服务和路由

# Through AI agent conversation:
"Create a service named 'users-api' pointing to https://api.example.com/users,
then add a route for path /users"

# MCP Server executes:
# 1. kong_create_service with URL and name
# 2. kong_create_route with path and service reference

示例2:配置速率限制

# Through AI agent:
"Add rate limiting to the payments service - allow 100 requests per minute per consumer"

# MCP Server executes:
# kong_create_rate_limiting_plugin with:
# - service_id: 

# - config.minute: 100
# - config.policy: "local"

示例3:配置故障排除

# Through AI agent:
"Show me all plugins on the api-gateway service"

# MCP Server executes:
# kong_get_plugins_by_service with service_id filtering

🐳 Docker部署

使用Docker Hub镜像

# Basic deployment
docker run --network host \
  shibbirmcc/kong-ratelimiter-mcp-server

# With Kong authentication
docker run --network host \
  -e KONG_ADMIN_URL=http://localhost:8001 \
  -e KONG_USERNAME=admin \
  -e KONG_PASSWORD=secret \
  shibbirmcc/kong-ratelimiter-mcp-server

# Custom port
docker run --network host \
  -e FASTMCP_PORT=9000 \
  -e KONG_ADMIN_URL=http://localhost:8001 \
  shibbirmcc/kong-ratelimiter-mcp-server

在当地建设

# Build image
docker build -t kong-mcp-server .

# Run
docker run --network host kong-mcp-server

🔍 MCP检验员测试

# Install MCP Inspector
npm install -g @modelcontextprotocol/inspector

# Start server
python -m kong_mcp_server.server

# Test with inspector (new terminal)
mcp-inspector --transport sse --server-url http://localhost:8080/sse

API测试手册

# Test tools/list endpoint
curl -X POST http://localhost:8080/sse/request \
  -H "Content-Type: application/json" \
  -d '{"jsonrpc": "2.0", "id": "1", "method": "tools/list"}'

# Test tool execution
curl -X POST http://localhost:8080/sse/request \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "id": "2",
    "method": "tools/call",
    "params": {
      "name": "kong_get_services",
      "arguments": {}
    }
  }'

🤝 贡献

欢迎投稿!拜托:

  1. 分叉存储库
  2. 创建要素分支
  3. 通过测试进行更改
  4. 提交拉取请求

📄 许可证

Apache 2.0许可证-请参阅 许可证 详细信息文件

🙏 致谢

📞 支持

______________________________________________________________________

由以下材料制成❤️ API网关和人工智能社区

目录标签

目录标签

API集成PythonClaudeAPI管理本地部署自然语言处理自动化配置AI集成网关服务

支持客户端

Claude DesktopClaudeClineVS Code

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

token

运行时(runtime,运行环境)

Python

工具数量(toolCount,工具数)

0

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdiotoken部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP