MCP server — connect Claude, ChatGPT & any AI agent¶
HomeLab Monitor ships a built-in Model Context Protocol (MCP) server so an AI agent — Claude, ChatGPT, or any MCP-capable client — can connect to the monitor and explore the whole homelab ecosystem through it: hosts, containers, systemd services, GPU, AI model servers, alerts and host posture.
It's a thin, well-described wrapper over the monitor's existing read-only HTTP endpoints. No collectors are touched, and nothing is mutated.
Read-only by design
There are no write tools in the MCP server. The dashboard itself has two
write actions — one-click self-update and the Containers/Services tabs'
start/stop/restart controls — gated behind ALLOW_SELF_UPDATE /
ENABLE_CONTROLS (on by default; set either to 0, or use
docker-compose.readonly.yml, to turn them off), each asking for
confirmation before it acts. Neither is exposed as an MCP tool — this
server stays read-only regardless of what the dashboard itself can do.
Tools¶
Everything the dashboard shows is reachable through these tools. The usual path is
list_hosts → get_host → get_snapshot, then a detail tool.
| Tool | What it answers | Wraps |
|---|---|---|
list_hosts() |
What's in the fleet, and is it healthy? | /api/fleet |
get_host(name) |
One host's System / Network / Security inventory ("local" = the hub) |
/api/host_data/<name> |
get_snapshot() |
Live GPU / host / Docker / systemd overview + diagnostics | /api/health |
get_containers() |
Full Docker list — state, health, ports, RAM/VRAM, image disk, uptime | /api/health |
get_services() |
Full systemd list — active/sub state, ports, RAM, admin/watched flags | /api/health |
get_memory(range) |
Per-service & per-process RAM breakdown (the memory treemap) | /api/data |
get_gpu(range) |
GPU util / VRAM / power / temp, per-model VRAM, caller attribution | /api/data |
get_ai_models(range) |
Which models are loaded, their VRAM, and who is driving them | /api/data |
get_installed_models() |
Every model available across the fleet's servers, grouped by provider | /api/models |
get_history(range) |
Charted time-series (GPU + host) for trends | /api/data |
get_costs(range) |
What the machine drew and cost, + a ranked per-process/container/service/model breakdown | /api/costs |
get_entity_cost(name, kind, range) |
Cost drill-down for one process/container/service/model | /api/costs/entity |
get_experiments(range, status) |
Tracked runs, each with the whole-box GPU energy over its window (not per-run attribution) | /api/runs |
get_experiment(run_id) |
One run's loss-curve metrics, GPU power/util series and whole-box energy over its window | /api/runs/<id> |
get_benchmarks(range, model) |
Stored model benchmarks — tokens/sec, VRAM fit, recommended context | /api/bench |
get_benchmark(run_id) |
One benchmark's full context sweep (tok/s & VRAM at each context size) | /api/bench/<id> |
get_events(range) / get_alerts(range) |
Recent persisted events and alert firings (OOM, disk-I/O, notifications) + insights | /api/data |
get_uptime(range) |
Uptime checks and maintenance windows, including current state, availability percentage, latency and whether a check is silenced | /api/uptime |
scan_disk(path, rescan) |
WizTree-style nested folder-size treemap | /api/disk_scan |
range accepts the same windows as the dashboard, e.g. 6h, 24h, 7d.
scan_disk takes an absolute host path (e.g. /, /var) and polls the background
scan until it's done.
Resources¶
| Resource | Content |
|---|---|
homelab://metrics |
Prometheus exposition text (/metrics) |
homelab://health |
Liveness + running version (/healthz) |
homelab://changelog |
The bundled CHANGELOG, for version context |
Configuration¶
| Env | Default | Meaning |
|---|---|---|
HOMELAB_MONITOR_URL |
http://localhost:9800 |
Base URL of the monitor to read |
HOMELAB_HTTP_TIMEOUT |
10 |
Per-request timeout (seconds) |
MCP_TRANSPORT |
stdio |
stdio, http (streamable-http) for the sidecar, or sse |
MCP_HOST / MCP_PORT |
0.0.0.0 / 9810 |
Bind address for the http and sse transports |
HOMELAB_API_TOKEN |
— | A read API key, needed once the dashboard has a login |
With a dashboard login. Once a password is set, the built-in HTTP server on
MCP_PORT asks every client for Authorization: Bearer <read or admin key>
(make one under Settings → Integrations → API keys) and answers 401 without it.
It checks a key at most once a minute, so a revoked key stops working within a
minute. A stdio client on your laptop sets HOMELAB_API_TOKEN to that key. The
built-in server reaches the dashboard with a per-container token, so it keeps
working with no setup. No password = no change.
SSE. MCP_TRANSPORT=sse follows the same rules: once a password is set,
both the event stream (/sse) and the message POSTs need the read key.
While the dashboard starts. The HTTP server answers 503 until the dashboard
has told it whether a login is set. A dashboard too old to have a login (404 on
/api/auth/status) counts as no password. If the 503 lasts, check
HOMELAB_MONITOR_URL. After that first answer, a dashboard that goes away
doesn't change what the port asks for.
Run it¶
The MCP server is built into the monitor image and served on MCP_PORT
(default 9810) alongside the dashboard — there's nothing extra to deploy. Set
ENABLE_MCP=0 to turn it off.
Run the server straight from a checkout against any monitor:
Try it¶
Once connected, ask your agent natural questions and let it pick the tools:
- "Which host has a reboot pending and an OS upgrade available — what's the safe order to apply it?"
- "Why is the GPU pinned right now, and which service is calling the model server?"
- "Any OOM kills in the last 24h? What got blamed?"
- "What did my homelab cost last night, and which model is the most expensive thing on the GPU?"
- "How much energy did my last training run burn, and what did it cost?"
Keep it on your LAN/VPN
Like the dashboard, the MCP server gives broad visibility into your hosts. Don't expose either to the public internet.