\[!警告\] ## ⚠️ 此存储库已弃用 此项目不再处于活动维护状态,将以只读方式存档。 不会进行进一步的更新、错误修复或新功能。问题和拉取请求不再受到监控。 如果您正在寻找Konnect MCP支持,请查看 Konnect远程MCP服务器.
______________________________________________________________________
Konnect MCP服务器
注: 此存储库已弃用,很快将以只读方式存档。详见上述通知。
用于与Kong Konnect API交互的模型上下文协议(MCP)服务器,允许AI助手查询和分析Kong Gateway配置、流量和分析。
目录
概述
⚠️ 已弃用: 此项目不再维护。以下信息仅供参考。
该项目提供了一个模型上下文协议(MCP)服务器,使Claude等人工智能助手能够与Kong Konnect的API网关进行交互。它提供了一套工具来查询分析数据、检查配置细节,并通过自然语言对话管理控制平面。
主要特点:
- 使用可自定义过滤器查询API请求分析
- 列出并检查网关服务、路由、消费者和插件
- 管理控制平面和控制平面组
- 与Claude和其他兼容MCP的AI助手集成
项目结构
build/ # Committed compiled JavaScript output used by the release/distribution flow
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
# Run the test suite (also rebuilds compiled output)
npm test
# Rebuild the committed build artifacts after changing src/
npm run build存储库包括以下已提交的文件 build/ 作为其分销模式的一部分。如果在中修改文件 src/,再生 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: Control plane ID
- size: Number of services to return
- offset: Pagination offset token列出路线
列出与控制平面关联的所有路线。
Inputs:
- controlPlaneId: Control plane ID
- size: Number of routes to return
- offset: Pagination offset token列出消费者
列出与控制平面关联的所有消费者。
Inputs:
- controlPlaneId: Control plane ID
- size: Number of consumers to return
- offset: Pagination offset token列出插件
列出与控制平面关联的所有插件。
Inputs:
- controlPlaneId: Control plane ID
- size: Number of plugins to return
- offset: Pagination offset token
- includeRawConfig: Set to true to include raw plugin configuration values (defaults to false)控制平面工具
列出控制平面
列出组织中的所有控制平面。
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: Control plane ID 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桌面版
- 创建或编辑Claude Desktop配置文件:
- MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json - 窗户: %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
- Konnect工具现在可供Claude使用
示例工作流
API流量分析
- 首先,列出所有控制平面:
Please list all control planes in my Kong Konnect organization.- 然后,列出特定控制平面的服务:
List all services for control plane [CONTROL_PLANE_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_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?发展
⚠️ 该项目不再接受捐款。 存储库将以只读方式存档。拉取请求和问题将不会被审查或合并。
历史发展说明:
npm test运行TypeScript构建和存储库测试套件。build/是此存储库中已提交的生成工件,应使用重新生成npm run build更改后src/.
故障排除
注: 不支持此已弃用的项目。以下信息仅供参考。
常见问题
连接错误
- 验证您的API密钥是否有效并具有必要的权限
- 检查是否正确指定了API区域
- 确保您的网络可以连接到Kong Konnect API
身份验证错误
- 在Kong Konnect门户重新生成您的API密钥
- 检查环境变量是否设置正确
未找到数据
- 验证请求中使用的ID是否正确
- 检查指定的控制平面中是否存在资源
- 确保时间范围对分析查询有效
学分
由孔建造。最初灵感来自Stripe 代理工具包.
