Chaos Mesh MCP Server
Enables chaos engineering on Kubernetes clusters by providing tools to inject faults like network delays, pod kills, and HTTP delays, along with cluster inspection and chaos lifecycle management.
README
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-mcp
Docker
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/k8s
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.