Kong Konnect MCP Server
OfficialKong Konnect MCP 服务器
用于与 Kong Konnect API 交互的模型上下文协议 (MCP) 服务器,允许 AI 助手查询和分析 Kong Gateway 配置、流量和分析。
https://github.com/user-attachments/assets/19c2f716-49b5-46c3-9457-65b3784e2111
目录
Related MCP server: Kubectl MCP Tool
概述
该项目提供了一个模型上下文协议 (MCP) 服务器,使 Claude 等 AI 助手能够与 Kong Konnect 的 API 网关进行交互。它提供了一套工具,用于查询分析数据、检查配置详细信息以及通过自然语言对话管理控制平面。
主要特点:
使用可自定义的过滤器查询 API 请求分析
列出并检查网关服务、路由、消费者和插件
管理控制平面和控制平面组
与 Claude 和其他兼容 MCP 的 AI 助手集成
Konnect MCP 是一项正在进行的工作,我们将在每个版本中添加额外的功能和改进。
项目结构
src/
├── index.ts # Main entry point
├── api.ts # Kong API client
├── tools.ts # Tool definitions
├── parameters.ts # Zod schemas for tool parameters
├── prompts.ts # Detailed tool documentation
├── operations/
│ ├── analytics.ts # API request analytics operations
│ ├── configuration.ts # Services, routes, consumers, plugins
│ └── controlPlanes.ts # Control plane management
└── types.ts # Common type definitions安装
先决条件
Node.js 20 或更高版本
具有 API 访问权限的 Kong Konnect 帐户
具有 MCP 功能的客户端(例如 Claude Desktop、Cursor 等...)
设置
# Clone the repository
git clone https://github.com/Kong/mcp-konnect.git
cd mcp-konnect
# Install dependencies
npm install
# Build the project
npm run build配置
设置以下环境变量来配置 MCP 服务器:
# Required: Your Kong Konnect API key
export KONNECT_ACCESS_TOKEN=kpat_api_key_here
# Optional: The API region to use (defaults to US)
# Possible values: US, EU, AU, ME, IN
export KONNECT_REGION=us可用工具
该服务器提供的工具分为三类:
分析工具
查询 API 请求
使用可定制的过滤器查询和分析 Kong API 网关请求。
Inputs:
- timeRange: Time range for data retrieval (15M, 1H, 6H, 12H, 24H, 7D)
- statusCodes: Filter by specific HTTP status codes
- excludeStatusCodes: Exclude specific HTTP status codes
- httpMethods: Filter by HTTP methods
- consumerIds: Filter by consumer IDs
- serviceIds: Filter by service IDs
- routeIds: Filter by route IDs
- maxResults: Maximum number of results to return获取消费者请求
分析特定消费者发出的 API 请求。
Inputs:
- consumerId: ID of the consumer to analyze
- timeRange: Time range for data retrieval
- successOnly: Show only successful (2xx) requests
- failureOnly: Show only failed (non-2xx) requests
- maxResults: Maximum number of results to return配置工具
列表服务
列出与控制平面相关的所有服务。
Inputs:
- controlPlaneId: ID of the control plane
- size: Number of services to return
- offset: Pagination offset token列出路线
列出与控制平面相关的所有路由。
Inputs:
- controlPlaneId: ID of the control plane
- size: Number of routes to return
- offset: Pagination offset token列出消费者
列出与控制平面相关的所有消费者。
Inputs:
- controlPlaneId: ID of the control plane
- size: Number of consumers to return
- offset: Pagination offset token列出插件
列出与控制平面相关的所有插件。
Inputs:
- controlPlaneId: ID of the control plane
- size: Number of plugins to return
- offset: Pagination offset token控制平面工具
列出控制平面
列出您组织中的所有控制平面。
Inputs:
- pageSize: Number of control planes per page
- pageNumber: Page number to retrieve
- filterName: Filter control planes by name
- filterClusterType: Filter by cluster type
- filterCloudGateway: Filter by cloud gateway capability
- labels: Filter by labels
- sort: Sort field and direction获取控制平面
获取有关特定控制平面的详细信息。
Inputs:
- controlPlaneId: ID of the control plane to retrieve列出控制平面组成员身份
列出属于特定组的所有控制平面。
Inputs:
- groupId: Control plane group ID
- pageSize: Number of members to return per page
- pageAfter: Cursor for pagination检查控制平面组成员资格
检查控制平面是否是任何组的成员。
Inputs:
- controlPlaneId: Control plane ID to check与 Claude 一起使用
要将此 MCP 服务器与 Claude for Desktop 一起使用:
创建或编辑 Claude Desktop 配置文件:
MacOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
添加以下配置:
{
"mcpServers": {
"kong-konnect": {
"command": "node",
"args": [
"/absolute/path/to/mcp-konnect/build/index.js"
],
"env": {
"KONNECT_ACCESS_TOKEN": "kpat_api_key_here",
"KONNECT_REGION": "us"
}
}
}
}重启 Claude 桌面版
Kong Konnect 工具现在可供 Claude 使用
示例工作流程
分析 API 流量
首先,列出所有控制平面:
Please list all control planes in my Kong Konnect organization.然后,列出特定控制平面的服务:
List all services for control plane [CONTROL_PLANE_NAME/ID].查询特定服务的 API 请求:
Show me all API requests for service [SERVICE_NAME/ID] in the last hour that had 5xx status codes.
解决消费者问题
列出控制平面的消费者:
List all consumers for control plane [CONTROL_PLANE_NAME/ID].分析特定消费者的请求:
Show me all requests made by consumer [CONSUMER_NAME/ID] in the last 24 hours.检查常见错误或模式:
What are the most common errors experienced by this consumer?
发展
添加新工具
在
parameters.ts中定义参数在
prompts.ts中添加文档在
operations/中的相应文件中创建操作逻辑在
tools.ts中注册该工具在
index.ts中处理工具执行
故障排除
常见问题
连接错误
验证您的 API 密钥是否有效并具有必要的权限
检查 API 区域是否正确指定
确保您的网络可以连接到 Kong Konnect API
身份验证错误
在 Kong Konnect 门户中重新生成您的 API 密钥
检查环境变量是否正确设置
未找到数据
验证请求中使用的 ID 是否正确
检查指定控制平面中是否存在资源
确保时间范围对于分析查询有效
致谢
由 Kong 构建。灵感来自 Stripe 的Agent Toolkit 。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Kong/mcp-konnect'
If you have feedback or need assistance with the MCP directory API, please join our Discord server