devops-mcp-server
by rpsangam
README.md
# devops-mcp-server
A **Model Context Protocol (MCP) server** that exposes common DevOps/SRE operations — Kubernetes pod status, Prometheus-style metrics queries, and recent deploy history — as tools any MCP-compatible client (Claude Desktop, Claude Code, or a custom LangGraph agent) can call.
> Part of a portfolio of agentic AI / AIOps projects. See the [index](https://github.com/rpsangam/rpsangam) for the full set.
## Why this exists
MCP is now supported natively across Anthropic, OpenAI, Google, and Microsoft's agent stacks, but hands-on experience actually *building* an MCP server (not just consuming public ones) is still uncommon. This repo demonstrates the pattern applied to the domain I know best after 20+ years in infra: exposing operational tooling to an agent in a controlled, typed, auditable way.
## Tools exposed
| Tool | Description |
|---|---|
| `get_pod_status` | Returns status/restarts/resource usage for a named pod (mock K8s data source) |
| `list_recent_deploys` | Returns the last N deploys for a service with timestamp + commit (mock CI data source) |
| `query_metric` | Returns a time-series-style summary for a metric + resource (mock Prometheus data source) |
Each tool ships with a strict input schema and read-only mock data sources — safe to demo without cloud credentials. Swap `mock_backends.py` for real `kubernetes` client / `prometheus-api-client` / GitHub Actions API calls to go to production.
## Architecture
```mermaid
flowchart LR
C[MCP Client<br/>Claude Desktop / Code / custom agent] -->|JSON-RPC over stdio| S[devops-mcp-server]
S --> K[get_pod_status]
S --> D[list_recent_deploys]
S --> M[query_metric]
K -.-> MB[(mock_backends.py)]
D -.-> MB
M -.-> MB
```
## Quickstart
```bash
pip install -r requirements.txt
python server.py
```
### Connect it to Claude Desktop
Add to your `claude_desktop_config.json` (see `claude_desktop_config.example.json`):
```json
{
"mcpServers": {
"devops-tools": {
"command": "python",
"args": ["/absolute/path/to/devops-mcp-server/server.py"]
}
}
}
```
Restart Claude Desktop, then ask: *"Check pod status for payments-api-deployment/pod-7c9f4."*
## Project layout
```
devops-mcp-server/
├── server.py # MCP server + tool registration
├── mock_backends.py # swappable data sources
├── claude_desktop_config.example.json
├── requirements.txt
└── Dockerfile
```
## Extending this
`aiops-agent-orchestrator` calls these same tools programmatically (not just from a chat client), which is what turns this from a demo into an actual AIOps building block.
## License
MIT
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues