Chaos Mesh MCP Server
Provides tools for interacting with Kubernetes clusters to perform Chaos Mesh experiments, including cluster inspection (namespaces, pods, nodes), network chaos, HTTP chaos, pod kill, and chaos lifecycle management (list, delete).
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Chaos Mesh MCP ServerAdd 200ms network delay between service-a and service-b"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Chaos Mesh MCP Server
Chaos Mesh MCP 服务端,基于 Python FastMCP 实现,提供 Chaos Mesh 混沌实验的 MCP 工具集。
项目结构
chaosmesh-mcp/
├── src/
│ └── chaosmesh_mcp/ # 源代码 (src 布局)
│ ├── __init__.py
│ ├── __main__.py # python -m 入口
│ ├── server.py # FastMCP 服务启动
│ ├── tools/ # MCP 工具注册
│ │ ├── chaos.py # list_chaos / delete_chaos
│ │ ├── cluster.py # 集群巡检 (namespace/pod/node)
│ │ ├── httpchaos.py # HTTP 接口级延迟注入
│ │ ├── network_chaos.py # 网络延迟/丢包/外部延迟
│ │ └── pod.py # Pod Kill 注入
│ ├── services/ # 服务适配层
│ │ ├── kubectl.py # kubectl 命令封装
│ │ └── chaosmesh.py # 模板渲染与 Chaos CRD 应用
│ ├── utils/ # 工具函数
│ │ ├── generate.py # 混沌资源名生成
│ │ ├── response.py # 统一响应格式
│ │ └── validate.py # 输入校验
│ └── templates/ # Chaos Mesh YAML 模板
│ ├── network_delay.yaml
│ ├── network_loss.yaml
│ ├── network_external_delay.yaml
│ ├── pod_kill.yaml
│ └── httpchaos_delay.yaml
├── tests/
│ └── __init__.py
├── deploy/k8s/ # Kubernetes 部署清单
│ ├── deployment.yaml
│ ├── service.yaml
│ ├── ingress.yaml
│ ├── kustomization.yaml
│ ├── kustomizeconfig.yaml
│ ├── .env.config
│ └── .env.secret.example
├── pyproject.toml
├── uv.lock
├── .python-version
├── Dockerfile
└── README.md运行方式
环境准备
# 确保已安装 uv
uv --version
# 同步依赖(自动创建 .venv 并安装所有依赖)
uv sync本地运行
# 使用 uv run 启动服务
uv run python -m chaosmesh_mcp
# 或通过 console_scripts
uv run chaosmesh-mcpDocker
docker build -t chaos-mcp:latest .
docker run -p 8000:8000 chaos-mcp:latest环境变量
MCP_HOST— 服务监听地址,默认0.0.0.0MCP_PORT— 服务监听端口,默认8000
功能说明
集群巡检工具 (tools/cluster.py)
get_namespaces— 查询集群中的 namespace 列表get_pods— 以 wide 格式列出目标命名空间中的 Podget_nodes— 以 wide 格式列出集群中的所有节点cluster_info— 获取 Kubernetes 集群端点与服务信息
网络混沌工具 (tools/network_chaos.py)
resolve_namespace— 根据 K8s 服务名称查询所在的 namespacenetwork_delay— 对服务与服务之间的网络连接注入延迟network_external_delay— 对发往第三方渠道域名注入响应延迟 (Workflow)network_loss— 对服务间注入 NetworkChaos 丢包故障
HTTP 混沌工具 (tools/httpchaos.py)
httpchaos_delay— 按 HTTP 路径和端口精准注入延迟
Pod 混沌工具 (tools/pod.py)
pod_kill— PodChaos pod-kill 故障注入
混沌生命周期工具 (tools/chaos.py)
list_chaos— 列出指定命名空间中的混沌资源delete_chaos— 按类型、名称和命名空间删除单个混沌资源
响应格式
所有工具返回统一的 JSON 响应:
{
"success": true,
"message": "操作描述",
"data": {
"kubectl": "kubectl 返回内容",
"yaml": "渲染后的 YAML"
},
"yaml": "渲染后的 YAML (顶层)"
}Kubernetes 部署
kubectl create namespace chaos-mcp
cp deploy/k8s/.env.secret.example deploy/k8s/.env.secret
# 编辑 deploy/k8s/.env.secret 填入真实值
kubectl apply -k deploy/k8sResources
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/Ausium/chaosmesh-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server