telecom-noc
README.md
# noc-alarm-service
A FastAPI microservice for **mock 4G/5G NOC alarms and KPIs**, with an **MCP server** so AI assistants (Claude Desktop / Claude Code)
can read alarms and KPIs and **propose** actions. The AI can never execute anything itself: a NOC engineer approves each proposal, and approval
follows a **four-eyes rule** (nobody can approve their own proposal).
> All data is mock (lab-style node names, public 3GPP concepts). No real operator or vendor data.
```
MCP client (Claude) ──stdio──► mcp_server.py ──REST + JWT (role: agent)──► FastAPI /api/v1 ──► Postgres
▲
NOC engineer (Swagger / UI) ──REST + JWT (role: noc_engineer)─────────┘ ack · delete · approve/reject
```
## Features
- Versioned REST API `/api/v1`, OpenAPI/Swagger at `/docs`
- JWT auth (OAuth2 password flow) with **roles**: `agent` (read + propose) and `noc_engineer` (create, ack, soft-delete, approve)
- Alarms: filter (severity, node_type, acknowledged), search `q`, **whitelisted sort**, pagination with a **page-size cap**
- **Soft delete** for audit history; latest KPIs per node
- **Human-in-the-loop** proposals: pending → approved/rejected (409 if already decided, 403 on self-approval)
- Health probes `/health/live`, `/health/ready`; `X-Correlation-ID` and JSON access logs
- 13 pytest tests, ruff, Docker, docker-compose (Postgres), GitHub Actions CI
- Measured locally: `GET /api/v1/alarms` p50 ≈ 10.5 ms, p95 ≈ 12.7 ms (200 requests, SQLite, single worker)
## Run locally (uv)
```bash
uv sync
cp .env.example .env # set SECRET_KEY
uv run python -m app.seed # demo users: engineer1, engineer2, noc-agent (password from .env)
uv run uvicorn app.main:app --reload
# open http://localhost:8000/docs → Authorize → engineer1 / dev-password
uv run pytest -q
```
## Run with Docker (Postgres)
```bash
cp .env.example .env
docker compose up -d --build
docker compose exec api python -m app.seed
```
## Use from Claude (MCP)
Add to Claude Desktop `claude_desktop_config.json` (or `claude mcp add` in Claude Code):
```json
{"mcpServers": {"telecom-noc": {
"command": "uv", "args": ["--directory", "C:/Dev/projects/2026-11_noc-alarm-service", "run", "mcp_server.py"],
"env": {"NOC_API": "http://127.0.0.1:8000/api/v1", "NOC_AGENT_USER": "noc-agent", "NOC_AGENT_PASSWORD": "dev-password"}}}}
```
Try: *“Show critical alarms, check KPIs of the affected node, and propose next steps.”* Then approve in Swagger as `engineer2`.
## API
| Method | Path | Role |
|---|---|---|
| POST | /api/v1/token | – |
| GET | /api/v1/alarms?severity=&node_type=&acknowledged=&q=&page=&per_page=&sort=&order= | any |
| POST | /api/v1/alarms | noc_engineer |
| GET | /api/v1/alarms/{id} | any |
| PATCH | /api/v1/alarms/{id}/ack | noc_engineer |
| DELETE | /api/v1/alarms/{id} (soft) | noc_engineer |
| GET | /api/v1/kpis/{node} | any |
| POST / GET | /api/v1/proposals | agent, noc_engineer / any |
| POST | /api/v1/proposals/{id}/approve · /reject | noc_engineer (not the proposer) |
## Roadmap
- [ ] Alembic migrations instead of `create_all`
- [ ] Kafka `alarm.raised` events + correlator consumer (alarm → incident)
- [ ] Redis cache + rate limiting for agent tool calls
- [ ] OpenTelemetry tracing, Prometheus `/metrics`
- [ ] Helm chart + kind deployment
- [ ] LangGraph triage agent on top of the MCP tools
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues