Home Assistant — Claude Code MCP server: features and setup
The MCP server for Claude Code reads Home Assistant data and runs its actions. An agent can inspect device states, check history, or change home settings.
MIT ★ 5 updated 2026-10-29
claude mcp add --env HOME_ASSISTANT_URL=<HOME_ASSISTANT_URL> --env HOME_ASSISTANT_TOKEN_FILE=<HOME_ASSISTANT_TOKEN_FILE> --env HOME_ASSISTANT_CONFIRM_DOMAINS=<HOME_ASSISTANT_CONFIRM_DOMAINS> --transport stdio home-assistant -- npx -y @foreverworks/mcp-home-assistantWhat Home Assistant does
The server gives an AI agent access to Home Assistant entities, areas, history, and logbook entries. It can also run actions, such as adjusting a light, changing a thermostat, or starting a script. Each action involving locks, alarm panels, covers, or valves requires approval before it runs.
The machine needs network access to a Home Assistant instance and a long-lived access token. The package @foreverworks/mcp-home-assistant runs on Node 22.19 or newer; set HOME_ASSISTANT_URL to the instance address and HOME_ASSISTANT_TOKEN_FILE to the token file path. A regular user's token supports every tool except render_template; an administrator token also enables admin-only actions.
What it helps with
- inspect device states and their areas
- check Home Assistant history and logbook entries
- adjust a light or thermostat setting
- run an action that requires approval
Example prompts for the agent
- Which devices are active in the living room?
- How did the living room temperature shift overnight?
- Set the kitchen light to 30 percent brightness.
How to install Home Assistant
Platform CLI
claude mcp add --env HOME_ASSISTANT_URL=<HOME_ASSISTANT_URL> --env HOME_ASSISTANT_TOKEN_FILE=<HOME_ASSISTANT_TOKEN_FILE> --env HOME_ASSISTANT_CONFIRM_DOMAINS=<HOME_ASSISTANT_CONFIRM_DOMAINS> --transport stdio home-assistant -- npx -y @foreverworks/mcp-home-assistantReplace <…> with your own values
Platform CLI
codex mcp add home-assistant --env HOME_ASSISTANT_URL=<HOME_ASSISTANT_URL> --env HOME_ASSISTANT_TOKEN_FILE=<HOME_ASSISTANT_TOKEN_FILE> --env HOME_ASSISTANT_CONFIRM_DOMAINS=<HOME_ASSISTANT_CONFIRM_DOMAINS> -- npx -y @foreverworks/mcp-home-assistantReplace <…> with your own values
Config file
{
"mcpServers": {
"home-assistant": {
"command": "npx",
"args": [
"-y",
"@foreverworks/mcp-home-assistant"
],
"env": {
"HOME_ASSISTANT_URL": "<HOME_ASSISTANT_URL>",
"HOME_ASSISTANT_TOKEN_FILE": "<HOME_ASSISTANT_TOKEN_FILE>",
"HOME_ASSISTANT_CONFIRM_DOMAINS": "<HOME_ASSISTANT_CONFIRM_DOMAINS>"
}
}
}
}Replace <…> with your own values
Config file
{
"servers": {
"home-assistant": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@foreverworks/mcp-home-assistant"
],
"env": {
"HOME_ASSISTANT_URL": "<HOME_ASSISTANT_URL>",
"HOME_ASSISTANT_TOKEN_FILE": "<HOME_ASSISTANT_TOKEN_FILE>",
"HOME_ASSISTANT_CONFIRM_DOMAINS": "<HOME_ASSISTANT_CONFIRM_DOMAINS>"
}
}
}
}Replace <…> with your own values
Platform CLI
gemini mcp add -e HOME_ASSISTANT_URL=<HOME_ASSISTANT_URL> -e HOME_ASSISTANT_TOKEN_FILE=<HOME_ASSISTANT_TOKEN_FILE> -e HOME_ASSISTANT_CONFIRM_DOMAINS=<HOME_ASSISTANT_CONFIRM_DOMAINS> home-assistant npx -y @foreverworks/mcp-home-assistantReplace <…> with your own values
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about Home Assistant
How do I install Home Assistant in Claude Code?
Run `claude mcp add home-assistant -e HOME_ASSISTANT_URL=<HOME_ASSISTANT_URL> -e HOME_ASSISTANT_TOKEN_FILE=<HOME_ASSISTANT_TOKEN_FILE> -- npx -y @foreverworks/mcp-home-assistant`. Set the Home Assistant address and the path to a file containing a long-lived access token.
What does the Home Assistant MCP server do?
It gives an agent access to Home Assistant entities, areas, history, and logbook data, and lets it run actions. Actions involving locks, alarm panels, covers, and valves require approval each time.
What does the Home Assistant MCP server need to run?
It requires a reachable Home Assistant instance, a long-lived access token, and Node 22.19 or newer. Configure the address with HOME_ASSISTANT_URL and the token file path with HOME_ASSISTANT_TOKEN_FILE.