homelab-mcp
by ShawnOakley
README.md
# homelab-mcp
An MCP server for a small home AI lab: two PCs running ComfyUI and a NAS they share. It lets an AI assistant submit and track image-generation jobs on either GPU, keep shared notes, file finished assets, and check that backups are current.
It is extracted from the server I run at home. The addresses, share names and folders that were written into my copy are settings here, and one tool that describes my NAS's admin login is left out.
## Tools
| Group | Tools | What they do |
| --- | --- | --- |
| Jobs | `list_targets`, `submit_job`, `job_status`, `finish_job`, `job_retry` | Show each ComfyUI host's GPU, free VRAM and queue; queue a workflow; follow it; record a verdict; resubmit it to either host |
| Notes | `notes_search`, `notes_add`, `notes_digest` | Lessons learned, one file each, with an off switch in a config file that the tools cannot flip |
| Assets | `asset_list`, `asset_promote`, `asset_publish`, `asset_loras` | A library of finished outputs on the NAS, a manifest of what is in it, and a publish step that refuses to overwrite |
| Operations | `backup_status`, `sync_status` | Age of each backup copy against a plan; files still waiting to reach the NAS |
| Reference | `studio_map`, `syllabus_list`, `course_state`, `tracker_get` | Read-only views of project documents kept on the NAS |
## How it behaves
- **Every tool call is logged.** One JSON line per call, with arguments, a trimmed result, any error, and the time taken (`tool_log.py`).
- **It keeps working when the NAS is down.** Results carry `"degraded": "nas"`, outputs are written locally, and copies wait in a pending folder until the share is back (`submit.py`).
- **Publishing needs an explicit yes.** `asset_publish` does nothing unless called with `approved=True`, and never overwrites a file.
- **Reference tools fail closed.** If the documents are missing they say so; they do not guess paths.
## Run it
Python 3.10 or later.
```bash
pip install -r requirements.txt
python homelab_mcp.py
```
It serves streamable HTTP at `http://127.0.0.1:8787/mcp` by default.
## Settings
All optional; see `settings.py` for the defaults.
| Variable | Meaning |
| --- | --- |
| `HOMELAB_NAS_ROOT` | The shared folder on the NAS |
| `HOMELAB_NAS_HOST` | The NAS's host name or address, checked on port 445 |
| `HOMELAB_LOCAL_ROOT` | Local folder for outputs, notes, logs and pending copies |
| `HOMELAB_HTTP_HOST`, `HOMELAB_HTTP_PORT` | Where the server listens |
| `HOMELAB_TARGETS` | JSON map of ComfyUI hosts: `{"name": {"host": "...", "lan": "...", "label": "..."}}` |
| `HOMELAB_ASSET_PROJECT`, `HOMELAB_GAME_ROOT`, `HOMELAB_LORA_CATALOG` | The project the asset library serves |
| `HOMELAB_SLUG_ALIASES` | JSON map of short names for course folders |
| `HOMELAB_NAS_DOWN` | Set to `1` to rehearse an outage |
## Limits
- There is no authentication. Run it on a network you trust.
- It expects ComfyUI on port 8188 on each host.
- No tests are included in this copy.
## License
MIT. See `LICENSE`.
This server cannot be deployed
Maintenance
ActivityMaintained
ResponsivenessNo recent community issues