
Devops Mcp
io.github.NotHarshhaa由 GitHub 账号 NotHarshhaa 发布v2.1.1更新于 Oct 24, 2026
Unified MCP server for Kubernetes, ArgoCD, Prometheus, PagerDuty, and Loki
概览
本地 MCP 服务器,让 AI 助手读写 Kubernetes、ArgoCD、Prometheus、Loki、PagerDuty 和 Helm,用于故障排查与运维。
- 可以做什么
- 查看和变更 Kubernetes 资源:列出 Pod、Deployment、Service 与事件,读取日志、describe 资源、扩缩容、应用清单、重启滚动更新,并在确认后删除资源。查看并操作 ArgoCD 应用:列出应用、差异、历史与资源树,触发同步、回滚和取消同步。用 PromQL 查询 Prometheus,列出告警与抓取目标,比较时间段并查看 SLO 状态。在 Loki 中检索近期错误日志和自定义 LogQL 查询。读取并处理 PagerDuty 事件:列出事件、查询值班人员、确认、添加备注和升级。管理 Helm release,并运行跨数据源的调试、运行手册、健康报告和事件时间线。
- 适用场景
- 适合 DevOps 与 SRE 场景:希望助手直接排查线上集群和部署问题,把部署变更与指标、日志变化关联起来,并执行扩缩容、同步、确认事件等日常操作,而无需把 kubectl 输出复制到对话中。
- 运行要求
- 通过 npx 以 stdio 在本地运行,需要 Node.js 20 或更高版本。需要 kubeconfig 路径或集群内 ServiceAccount,以及所用服务商的地址和令牌:ARGOCD_SERVER 与 ARGOCD_TOKEN、PROMETHEUS_URL 与可选的 PROMETHEUS_BEARER_TOKEN、LOKI_URL 与 LOKI_TOKEN、PAGERDUTY_TOKEN 与 PAGERDUTY_USER_EMAIL。Helm 工具需要 PATH 中有 helm 可执行文件。未配置的服务商会自动跳过。
安装
在 SourceWeft 中
- 打开 控制台中的 Devops Mcp,将其添加到工作区。
- 为需要使用其工具的对话启用该服务。
Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。
其他 MCP 客户端
参照 仓库 中的启动说明。
README
devops-mcp
Unified MCP server for DevOps engineers — query and manage Kubernetes, ArgoCD, Prometheus, and PagerDuty from any MCP-compatible AI agent.
[npm version] [License: MIT] [MCP]
What is this?
devops-mcp is an open source Model Context Protocol server that gives AI agents (Claude, etc.) real-time read and write access to your infrastructure stack — all from a single install.
Instead of copy-pasting kubectl output into a chat window, you can ask:
"Why is the payments deployment in CrashLoopBackOff?" "What changed in the last ArgoCD sync for the auth app?" "Show me the p99 latency for the API gateway over the last hour." "Who's on call right now and what incidents are open?" "Debug the payments service - what's wrong with it?"
...and get live answers, sourced directly from your cluster and tooling.
Providers included:
Quick start
Claude Desktop (stdio — recommended)
Add this to ~/.config/claude/claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/claude_desktop_config.json):
Restart Claude Desktop. The devops server will appear in the tools list.
Claude Code (CLI)
Local dev / test
Requires Node.js 20 or newer.
Configuration
All config is via environment variables. Only set the ones for providers you actually use — providers with missing config are silently skipped.
Tool reference
All tools follow a three-tier safety model:
- Read — safe, no side effects, no confirmation needed
- Mutate — defaults to
dry_run: true; setdry_run: falseto execute - Destructive — requires
confirm: true, or a 2026-07-28 client can complete the server's interactive MRTR confirmation
Kubernetes (k8s__*)
ArgoCD (argo__*)
Prometheus (prom__*)
Example usage:
What it outputs:
- Latency: "Latency increased: 120ms → 480ms (+300%)" or "Latency stable: 125ms"
- Error rate: "Error rate crossed SLO (5%): 7.2%" or "Error rate within SLO: 2.1%"
- Traffic: "Traffic dropped: 500 → 350 req/s (-30%)" or "Traffic spike detected (+150%)"
- Overall assessment: Summary of issues and positive indicators
Why this matters: Instead of raw PromQL numbers that require interpretation, this tool provides actionable insights that AI agents can use directly in responses, making monitoring data actually useful for incident investigation and communication.
Loki (logs__*)
Example usage:
Why this matters:
- Metrics tell what: Prometheus shows you that latency increased or error rate crossed SLO
- Logs tell why: Loki shows you the actual error messages, stack traces, and context around failures
- Complete debugging: Without logs, you can see that something is broken but not understand the root cause
Output format:
- Structured log entries with timestamp, message, service, namespace, and extracted log levels
- Error count summaries and filtering
- Raw LogQL results for detailed analysis
This makes incident investigation complete by combining the "what" (metrics) with the "why" (logs).
PagerDuty (pd__*)
pd__summarize_incident
Example usage:
What it outputs:
- What happened: Incident title, description, severity, urgency, status, creation time, and duration
- Affected services: Service name, ID, and current status
- Probable root cause: Analysis of trigger alerts and log entries to identify likely causes
- Current status: Current incident state, assignees, acknowledgements, and notes count
Output format:
Why this matters: Instead of manually piecing together incident details from multiple API calls, this tool provides a comprehensive, human-readable summary perfect for:
- Demos: Shows AI's ability to understand and summarize complex incident data
- Real-world use: Quickly understand incident impact without digging through raw data
- Communication: Share concise incident summaries with stakeholders
Helm (helm__*)
Requirements: Helm CLI binary must be available in PATH.
Example usage:
Cross-Provider Debugging (devops__*)
devops__debug_service
Example usage:
What it checks:
- Kubernetes: Pod status, restart counts, readiness, deployment health, recent events
- ArgoCD: Sync status, health status, Git diff detection, deployment history
- Prometheus: Error rate (5xx responses), latency (p95), firing alerts
- PagerDuty: Active incidents matching the service name
Output format:
- Human-readable diagnosis with emoji indicators (⚠️ warnings, ❌ errors)
- Per-provider status sections
- Summary highlighting critical issues
- Raw JSON data for detailed analysis
This is the most powerful tool for incident investigation - it gives you a complete picture of what's wrong with a service in seconds.
devops__explain_change
Example usage:
What it analyzes:
- ArgoCD: Deployment history within the timeframe, including revision, author, repo, and chart
- Kubernetes: Current rollout status, replica counts, image tags, and deployment readiness
- Prometheus: Error rate trends, latency patterns, and traffic spikes over the time window
Output format:
- Timeline of recent deployments with full metadata
- Kubernetes rollout status and health
- Metric anomaly detection (error rate spikes, latency issues, traffic changes)
- Correlation analysis that links deployments to metric changes
- Summary with root cause hypothesis
Problem it solves: "Everything was working yesterday… what changed?"
This tool answers that question by correlating deployment events with metric anomalies, helping you quickly identify whether a recent deployment, config change, or external factor caused the issue.
devops__runbook
Example usage:
Supported symptoms:
Output: Structured JSON with steps_executed[], findings[], and recommended_actions[].
devops__health_report
Example usage:
What it gathers:
- Kubernetes: Unhealthy pods, deployments not at desired replicas
- Prometheus: Count of firing alerts
- ArgoCD: Out-of-sync and unhealthy applications
- PagerDuty: Open incident count
Output: Overall status (healthy / degraded / critical), per-provider sections, and summary. Perfect for morning standup checks or shift handoffs.
Deployment options
stdio (recommended for local use)
The MCP host launches devops-mcp as a subprocess and communicates over stdin/stdout. Zero network config. Auth comes from the local environment (kubeconfig, env vars). Process lifecycle tied to Claude Desktop.
Stateless Streamable HTTP (shared deployments)
The HTTP entry serves MCP at POST /mcp using the 2026-07-28 stateless protocol. Each request gets a fresh MCP server instance, so requests can land on any replica without session affinity or shared protocol state. The same endpoint also accepts 2025-era Streamable HTTP clients in stateless compatibility mode.
Connect clients to http://127.0.0.1:3000/mcp. For a container or remote service, set MCP_HTTP_HOST=0.0.0.0 and configure MCP_ALLOWED_HOSTS with the public/proxy hostnames. Put the service behind TLS for team use.
The deprecated devops-mcp-sse binary remains as a temporary alias for the HTTP entry, but /sse, /message, and /ws now return HTTP 410. Legacy HTTP+SSE and non-standard WebSocket clients must migrate to Streamable HTTP.
2026-07-28 behavior
- No
initializerequirement orMcp-Session-Idon modern requests. server/discover, per-request client metadata, andMCP-Protocol-Versionare handled by the official SDK.Mcp-MethodandMcp-Nameheaders are validated against the JSON-RPC body for gateway routing and authorization.server/discoverandtools/listadvertise deterministic, public cache hints usingMCP_CACHE_TTL_MS(default 60 seconds).- Destructive tools accept
confirm: true; modern clients may instead complete an MRTR interactive confirmation. Confirmation state is HMAC-signed, expires after five minutes, and is bound to the exact tool arguments. Global dry-run blocks before prompting. MCP_REQUEST_STATE_SECRETmust be the same on every replica for MRTR retries to land anywhere. When omitted, the server derives the key fromMCP_AUTH_TOKEN, or uses a process-local random key when no token is configured.- 2025-era Streamable HTTP and stdio clients remain supported. Sessionful HTTP and legacy HTTP+SSE are not.
The built-in MCP_AUTH_TOKEN is a static bearer-token gate, not an OAuth authorization server. For Internet-facing deployments, terminate TLS and enforce your organization’s OAuth/OIDC policy at a gateway or integrate a dedicated identity provider; do not use deprecated Dynamic Client Registration for new deployments.
A minimal docker-compose.yml is available in examples/.
Security model
devops-mcp is designed for internal use inside a trusted network. That said:
- Kubernetes: Uses standard kubeconfig via
@kubernetes/client-node. Supports exec plugins (AWS EKS, GKE). In-cluster: auto-mounts SA token. Add RBAC rules scoped to your desired permissions — run devops-mcp under a dedicated ServiceAccount with minimal verbs. Context selection is fixed byK8S_CONTEXTat startup; the tool only previews changes because runtime switching would affect other callers. - ArgoCD: Generate a long-lived token:
argocd account generate-token --account devops-mcp. Create a dedicated account in argocd-cm with apiKey capability and a role limited to read + sync. - Prometheus: Usually unauthenticated inside a cluster. If using Grafana Mimir or Thanos with auth, pass a Bearer token. All tools are read-only so minimal permissions are needed.
- PagerDuty: Create a dedicated API key in PagerDuty → API Access → Create New API Key. Use Full Access if you want acknowledge/escalate tools; Read-only if you want a safe-only mode.
- Mutations are dry-run by default. Every mutating tool defaults
dry_run: true. The AI must explicitly passdry_run: false— it won't do this unless the user clearly requests an action. - Destructive tools require confirmation. Pass
confirm: truedirectly, or use a 2026-07-28 client that supports the server's MRTR confirmation request.DEVOPS_MCP_DRY_RUN=trueblocks execution even after confirmation. - Audit log. Set
DEVOPS_MCP_AUDIT_LOGto a file path. Every tool call is written as a JSONL line with timestamp, tool name, parameters, and outcome. Mutations and destructive calls are flagged. - Global dry-run mode. Set
DEVOPS_MCP_DRY_RUN=trueto block every executing mutation, even when a caller passesdry_run: false. Safe previews remain available — useful for read-only team deployments.
Architecture
Key architectural features:
- Stateless remote protocol: each
/mcprequest creates a fresh server instance; no protocol session ID or sticky load balancing. - Dual-era compatibility: official SDK entries serve 2026-07-28 and compatible 2025-era stdio/Streamable HTTP clients.
- Runtime schema validation: Zod schemas validate tool parameters before dispatch, providing clear, structured error feedback on invalid inputs.
- Strict namespace isolation:
K8S_ALLOWED_NAMESPACESrestricts queries and mutations across Kubernetes, Helm, and Loki providers, preventing cross-tenant leakage. - Credential & secret safety: Secret payload data is automatically masked and redacted in resource describe operations.
- Gateway-friendly routing: modern method and tool headers are validated before dispatch.
- Safe caching: deterministic
tools/listordering and configurable public cache hints. - Provider isolation: each provider remains independently configured and safely skipped when unavailable.
Contributing
Contributions are welcome. The most useful areas:
- New providers — Grafana, Datadog, Vault, Terraform Cloud, Flux CD
- New tools — within existing providers (e.g.
k8s__get_node_pressure,argo__get_app_logs) - Better output formatting — richer structured responses for specific resource types
- Tests — unit tests for provider logic using mocked clients
Adding a new provider
- Create
src/providers/yourprovider/withindex.ts,client.ts, and one file per resource group. - Register it in
src/server.ts. - Add config keys to
.env.exampleandsrc/config.ts. - Document tools in this README following the existing table format.
- Open a PR.
Local development
Run against a local kind/minikube cluster for Kubernetes testing. Use DEVOPS_MCP_DRY_RUN=true to prevent accidental mutations during development.
Roadmap
- Grafana provider (
grafana__*) — dashboards, annotations, datasources - Flux CD provider (
flux__*) — kustomizations, helm releases, image automation - Terraform Cloud provider (
tfc__*) — workspace runs, state, variables - HashiCorp Vault provider (
vault__*) — secret read (never write), lease status - Datadog provider (
dd__*) — metrics, monitors, events - Web UI for provider health, task progress, and audit events
License
MIT — see LICENSE.
Built for DevOps and platform engineers who want AI that actually knows what's happening in their cluster.
来源:README.md,提交 b3badd7
工具
0版本历史
2- v2.1.1最新Oct 5, 2026
- v2.1.0Sep 16, 2026
评分
已满足适用检查项的 50%
该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。
- 近 30 天内可连通25 分
请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。
- 已声明认证方式10 分
请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。
- 已列出工具15 分
请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。
- 描述必需15 分
- 图标10 分
- 文档15 分
- 许可证10 分