使用说明
香港MCP服务器
通过管理员API管理Kong网关的MCP服务器。
特性
- 完成服务、路由、上游和目标的CRUD操作
- 简化了常见插件的配置(速率限制、CORS、身份验证等)
- 多环境支持(本地/dev/stage/prod)
- 基于Docker,易于分发
- 不需要Python/venv设置
通过Docker安装(推荐)
塑造形象:
./setup.sh
# or manually:
docker build -t kong-mcp-server .
重要: 不要试图直接运行容器。它仅在Kiro CLI通过stdio调用时有效。
Kiro CLI中的配置
添加 ~/.kiro/settings/mcp_config.json:
{
"mcpServers": {
"kong": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--network=host",
"-e", "KONG_ADMIN_URL=http://localhost:8001",
"kong-mcp-server"
]
}
}
}
或者使用Docker Compose:
docker compose up -d
并在Kiro中配置:
{
"mcpServers": {
"kong": {
"command": "docker",
"args": ["exec", "-i", "kong-mcp-server", "python", "kong_mcp_server.py"]
}
}
}
分配给团队
选项1:Docker Hub
docker tag kong-mcp-server your-username/kong-mcp-server:latest
docker push your-username/kong-mcp-server:latest
团队使用:
{
"mcpServers": {
"kong": {
"command": "docker",
"args": ["run", "--rm", "-i", "--network=host", "your-username/kong-mcp-server"]
}
}
}
选项2:私人注册
docker tag kong-mcp-server registry.company.com/kong-mcp-server:latest
docker push registry.company.com/kong-mcp-server:latest
选项3:焦油文件
docker save kong-mcp-server > kong-mcp-server.tar
# Distribute the file
# Team loads:
docker load < kong-mcp-server.tar
环境变量
KONG_ADMIN_URL-香港管理员API URL(默认值:http://localhost:8001)KONG_ENV-环境标识符(本地/dev/stage/prod)(默认值:local)
复制 .env.example 到 .env 并根据需要进行调整。
可用工具
服务(完整CRUD)
kong_list_services-列出所有服务kong_get_service-获取特定服务的详细信息kong_create_service-创建新服务kong_update_service-更新现有服务kong_delete_service-删除服务
路线(完成CRUD)
kong_list_routes-列出所有路线kong_get_route-获取特定路线的详细信息kong_create_route-为服务创建路由kong_update_route-更新现有路线kong_delete_route-删除路线
上游和目标
kong_list_upstreams-列出上游kong_get_upstream-获取特定上游的详细信息kong_create_upstream-通过负载平衡创建上游kong_delete_upstream-删除上游kong_list_targets-列出上游目标kong_add_target-将目标添加到上游kong_delete_target-从上游删除目标
通用插件
kong_list_plugins-列出已启用的插件kong_delete_plugin-删除插件
特定插件(简化配置)
kong_enable_rate_limiting-速率限制(每秒/分钟/小时/天)kong_enable_cors-CORS(起源、方法、标头、凭据)kong_enable_key_auth-API密钥验证kong_enable_jwt-JWT身份验证kong_enable_ip_restriction-IP限制(允许/拒绝)kong_enable_request_transformer-请求转换(标头、查询字符串)
使用示例
在Kiro CLI中:
服务和路线:
Create a service called "api-backend" pointing to http://api.example.com
Create a route /v1/users with GET and POST methods for the api-backend service
Update the api-backend service to point to http://new-api.example.com
上游和负载平衡:
Create an upstream "backend-pool" with round-robin algorithm and add targets 10.0.1.10:8080 and 10.0.1.11:8080
List all targets of the backend-pool upstream
插件:
Enable rate limiting of 100 requests per minute on the api-backend service
Enable CORS allowing origins https://app.example.com and https://admin.example.com
Enable API key authentication on the /v1/users route
Enable IP restriction allowing only 10.0.0.0/8 and 192.168.1.0/24
免责声明
本项目按“原样”提供,不提供任何明示或暗示的保证。作者和贡献者不对因使用本软件而产生的任何损害或问题负责。使用风险自负。
这是一个非官方的社区项目,不隶属于或认可香港股份有限公司。
许可证
麻省理工学院