Home Assistant
An agent for the home, for requests such as “turn off the garden lights”.
| MCP server | built into Home Assistant: the mcp_server integration, at /api/mcp |
| Transport | Streamable HTTP |
| Authentication | bearer: a long-lived access token of Home Assistant |
Home Assistant serves the MCP server itself, once its mcp_server integration is set up: no separate server runs.
The address
Section titled “The address”Home Assistant answers at /api/mcp on the port of its web interface, 8123 by default, at the
address of the host that runs it, which only the installer knows: write that host in mcp.url
below. When Home Assistant runs on the network of the same host as Ambrogio, as it does to discover
the devices of the home, the server of Ambrogio reaches it as host.docker.internal, with
extra_hosts: ["host.docker.internal:host-gateway"] in the server service of compose.yaml.
Configure the connector
Section titled “Configure the connector”-
In Home Assistant, add the integration “Model Context Protocol Server” (
mcp_server) and expose to Assist the entities that Ambrogio may use. -
Create the token in your profile of Home Assistant, under Security, Long-lived access tokens, write it in
.envasHOME_ASSISTANT_TOKEN, and pass the variable to the server of Ambrogio incompose.yaml:services:server:environment:HOME_ASSISTANT_TOKEN: ${HOME_ASSISTANT_TOKEN:?} -
Add the agent file
agents/home-assistant.json, with the address of the Streamable HTTP endpoint of the MCP server inmcp.url:{"description": "Answers the household's requests about the home, with the tools of Home Assistant.","instructions": "You handle the household's requests about the home with the tools of Home Assistant. Requests may come from speech recognition and contain misheard words; interpret them in context. Answer briefly.","llm": {"provider": "mistral","model": "mistral-medium-latest","apiKeyEnv": "MISTRAL_API_KEY"},"maxToolCalls": 4,"mcp": {"url": "http://<home-assistant-host>:8123/api/mcp","auth": {"type": "bearer","tokenEnv": "HOME_ASSISTANT_TOKEN"}}} -
Restart with
docker compose up -d.
Authentication: a bearer token: a long-lived access token of Home Assistant, which the agent file names through the variable HOME_ASSISTANT_TOKEN. The description, the instructions, the language model and
maxToolCalls are an example: adapt them to the household. See
Agents for every field of the file.