- Home
- MCP servers
- Home Assistant
Home Assistant
- python
1
GitHub Stars
python
Language
6 months ago
First Indexed
2 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
You are setting up an MCP server that connects Home Assistant with AI agents, exposing convenient MCP interactions and optional HTTP REST endpoints. This server lets you read entity states, control devices, access histories, run services, and generate YAML automations, all while supporting secure authentication and scalable multi-instance setups.
How to use
Start by choosing how you want to connect your AI agent or application. If your tool supports MCP directly, you can run the MCP server as a local stdio service and connect using the provided MCP config. If you prefer universal access or want to build custom dashboards, use the standalone HTTP REST API server.
How to install
Prerequisites you need before installation are Python 3.9+ and a Home Assistant instance reachable from the same network. You will also need network access to install dependencies.
-
Quick Raspberry Pi installation is recommended if you are running Home Assistant on a Raspberry Pi 3B+.
-
Desktop installation for development or remote setup involves Python and pip.
Follow one of these options to install the MCP server.
# Raspberry Pi installation (recommended)
curl -sSL https://raw.githubusercontent.com/Jonathan97480/McpHomeAssistant/master/install.sh | bash
# Desktop installation
cd homeassistant-mcp-server
pip install -e .
Configuration and usage notes
Configure the MCP server to connect to your Home Assistant instance by providing the Home Assistant URL and a long-lived access token. You can set these values in a .env file for the stdio server.
Example environment variables to enable MCP connectivity:
HASS_URL=http://192.168.1.22:8123
HASS_TOKEN=your_token_here
Note: Replace the URL with your actual Home Assistant address and insert your real token.
## HTTP REST server options
If you want universal HTTP access without MCP clients, you can run an HTTP REST API server. This mode lets any HTTP client—including web apps and mobile apps—query and control Home Assistant through standard REST endpoints.
Key endpoints include health checks, entity listing, entity detail retrieval, service calls, and history queries.
Install dependencies
pip install aiohttp python-dotenv
Start the HTTP server (example command)
python http_server.py
Server runs at http://localhost:3002 by default.
## Security and maintenance
Use secure authentication tokens from Home Assistant for the MCP connections. When running as a standalone HTTP server, ensure the server is accessible only from trusted networks or secured with appropriate network controls.
When configuring multiple instances or switching between MCP and HTTP modes, restart the respective service to apply changes.
## Available tools
### get\_entities
List all entities with optional domain filtering to see current state options.
### get\_entity\_state
Retrieve detailed state and attributes for a specific entity.
### get\_history
Fetch historical data for an entity over a specified time range.
### call\_service
Invoke a Home Assistant service to control devices or trigger actions.
### get\_services
List all available Home Assistant services.
### create\_automation
Generate ready-to-use YAML automations based on prompts or templates.
### list\_automations
List all active automations managed by the MCP server.
### toggle\_automation
Enable or disable a specified automation.