No description
- Python 91.4%
- Nix 8.6%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
FastMCP server exposing entity states, service calls, history, the logbook, templates, calendars, camera snapshots, and the error log -- the full REST API surface HA's built-in mcp_server component lacks. The long-lived token is read per-request from HASS_TOKEN so an MCP auth proxy can inject it. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01E7pLd8gMUm8KpNY8wDLnLF |
||
| src/hass_rest_mcp | ||
| tests | ||
| .gitignore | ||
| flake.lock | ||
| flake.nix | ||
| pyproject.toml | ||
| README.md | ||
| result | ||
hass-rest-mcp
An MCP server for the
Home Assistant REST API,
built because Home Assistant's built-in mcp_server component only exposes a
small assist-oriented tool set. This server gives an agent the full picture:
entity states, service calls, history, the logbook, templates, calendars, and
camera snapshots.
Tools
| Tool | Purpose |
|---|---|
get_config |
HA version, location, units, loaded components |
list_entities |
Compact entity list, filterable by domain / search |
get_state |
Full state + attributes of one entity |
call_service |
Act on the home: light.turn_on, climate.set_temperature, ... |
list_services |
What each domain can do (fields included per-domain) |
get_history |
State history for entities over a time window |
get_logbook |
Human-readable event log |
render_template |
Evaluate a Jinja2 template server-side |
get_calendars |
List calendars / fetch events in a window |
get_camera_image |
Current snapshot from a camera entity |
get_error_log |
Tail of the HA error log |
Intentionally not exposed: POST /api/states (writes state without touching
devices — confusing for an agent), POST /api/events (raw event injection),
intent handling, and config checks.
Configuration
| Variable | Meaning |
|---|---|
HASS_TOKEN |
Long-lived access token (create under your HA user profile → Security). Read per-request, never logged. |
HASS_URL |
Base URL, default http://127.0.0.1:8123. |
Running
uv run hass-rest-mcp # stdio transport (default)
uv run hass-rest-mcp --transport http --port 8000
Development
uv run pytest
uv run ruff check .