K8s MCP (Kubernetes Management Control Panel)
一个简单的 Kubernetes 集群管理工具,支持两种运行模式:
- HTTP/WebSocket JSON-RPC 模式
- Smithery stdio JSON-RPC 模式
运行模式说明
1. HTTP/WebSocket JSON-RPC 模式 (默认)
在此模式下,服务器监听 HTTP 请求:
# 启动服务器(HTTP 模式)
SMITHERY=false node -r dotenv/config dist/index.js
所有 JSON-RPC 请求都应发送到 /mcp 端点:
# 示例:获取工具列表
curl -X POST http://localhost:3000/mcp
-H "Content-Type: application/json"
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/list"
}'
2. Smithery stdio JSON-RPC 模式
在此模式下,服务器通过标准输入/输出进行通信:
# 启动服务器(Smithery 模式)
SMITHERY=true node -r dotenv/config dist/index.js
JSON-RPC 消息直接通过标准输入/输出传递:
// 示例:初始化请求
{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"capabilities": {
"workspace": {
"workspaceFolders": false,
"configuration": false
}
}
}
}
// 示例:获取工具列表
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/list"
}
支持的 JSON-RPC 方法
initialize- 初始化服务- 返回协议版本 (2024-11-05)
- 返回服务器信息和功能
tools/list或get_tools- 获取可用工具列表- 返回支持的工具列表
get_pod_status- 获取 Pod 状态- 参数:
- namespace (可选): 命名空间
- 参数:
describe_pod- 获取 Pod 详情- 参数:
- namespace (可选): 命名空间
- pod_name (必填): Pod 名称
- 参数:
get_pod_logs- 获取 Pod 日志- 参数:
- namespace (可选): 命名空间
- pod_name (必填): Pod 名称
- container (可选): 容器名称
- 参数:
错误处理
服务使用标准的 JSON-RPC 2.0 错误码:
- -32700: Parse error
- -32600: Invalid Request
- -32601: Method not found
- -32602: Invalid params
- -32603: Internal error
- -32000: Server error
开发
# 安装依赖
npm install
# 开发模式(HTTP)
npm run dev
# 开发模式(Smithery)
SMITHERY=true npm run dev
# 构建
npm run build
# 生产模式运行(HTTP)
SMITHERY=false node -r dotenv/config dist/index.js
# 生产模式运行(Smithery)
SMITHERY=true node -r dotenv/config dist/index.js
Docker 部署
# 构建镜像
docker build -t k8s-mcp:latest .
# HTTP 模式运行
docker run -p 3000:3000 k8s-mcp:latest
# Smithery 模式运行
docker run -e SMITHERY=true k8s-mcp:latest
Kubernetes 部署
# HTTP 模式部署
kubectl apply -f k8s/deployment.yaml
# Smithery 模式部署(修改 SMITHERY 环境变量为 true)
kubectl set env deployment/k8s-mcp SMITHERY=true
协议版本
服务器支持的协议版本:2024-11-05
License
MIT
Kubernetes Management Control Panel
Project Details
- vazylin1124/k8s-mcp
- Last Updated: 3/25/2025
Recomended MCP Servers
This repo is meant to serve as a guide for Machine Learning/AI technical interviews.
Python "hello world" mcp example for Warp Terminal
A Model Context Protocol server for interacting with Ledger CLI, a powerful double-entry accounting system. This server enables...
MCP server for retrieving relevant documentation from a knowledge base
Enable AI assistants to explore and query your Steampipe data!
这是一个针对于MySQL开发的MCP,该项目旨在帮助用户快速且精确的查询MySQL数据库中的内容
MCP server for managing EVM keys and deploying smart contracts via Infura
Universal MCP-Server for your Databases optimized for LLMs and AI-Agents.
MCP Server for interacting with a Steel web browser
https://github.com/microsoft/mcsmcp





