ha-mcp 3.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ha_mcp-3.3.0/LICENSE +21 -0
- ha_mcp-3.3.0/PKG-INFO +419 -0
- ha_mcp-3.3.0/README.md +388 -0
- ha_mcp-3.3.0/pyproject.toml +206 -0
- ha_mcp-3.3.0/setup.cfg +4 -0
- ha_mcp-3.3.0/src/ha_mcp/__init__.py +20 -0
- ha_mcp-3.3.0/src/ha_mcp/__main__.py +42 -0
- ha_mcp-3.3.0/src/ha_mcp/client/__init__.py +10 -0
- ha_mcp-3.3.0/src/ha_mcp/client/rest_client.py +761 -0
- ha_mcp-3.3.0/src/ha_mcp/client/websocket_client.py +638 -0
- ha_mcp-3.3.0/src/ha_mcp/client/websocket_listener.py +340 -0
- ha_mcp-3.3.0/src/ha_mcp/config.py +157 -0
- ha_mcp-3.3.0/src/ha_mcp/prompts/__init__.py +1 -0
- ha_mcp-3.3.0/src/ha_mcp/prompts/enhanced.py +673 -0
- ha_mcp-3.3.0/src/ha_mcp/server.py +115 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/__init__.py +11 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/backup.py +460 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/device_control.py +615 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/enhanced.py +191 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/helpers.py +76 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/registry.py +50 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/smart_search.py +675 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_config_automations.py +257 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_config_helpers.py +678 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_config_scripts.py +232 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_search.py +315 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_service.py +234 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/tools_utility.py +343 -0
- ha_mcp-3.3.0/src/ha_mcp/tools/util_helpers.py +98 -0
- ha_mcp-3.3.0/src/ha_mcp/utils/__init__.py +30 -0
- ha_mcp-3.3.0/src/ha_mcp/utils/domain_handlers.py +380 -0
- ha_mcp-3.3.0/src/ha_mcp/utils/fuzzy_search.py +347 -0
- ha_mcp-3.3.0/src/ha_mcp/utils/operation_manager.py +442 -0
- ha_mcp-3.3.0/src/ha_mcp/utils/usage_logger.py +146 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/PKG-INFO +419 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/SOURCES.txt +40 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/dependency_links.txt +1 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/entry_points.txt +4 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/requires.txt +11 -0
- ha_mcp-3.3.0/src/ha_mcp.egg-info/top_level.txt +1 -0
- ha_mcp-3.3.0/tests/test_constants.py +15 -0
- ha_mcp-3.3.0/tests/test_env_manager.py +317 -0
ha_mcp-3.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Julien
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
ha_mcp-3.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ha-mcp
|
|
3
|
+
Version: 3.3.0
|
|
4
|
+
Summary: Home Assistant MCP Server - Complete control of Home Assistant through MCP
|
|
5
|
+
Author-email: Julien <github@qc-h.net>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/homeassistant-ai/ha-mcp
|
|
8
|
+
Project-URL: Bug Tracker, https://github.com/homeassistant-ai/ha-mcp/issues
|
|
9
|
+
Project-URL: Repository, https://github.com/homeassistant-ai/ha-mcp
|
|
10
|
+
Keywords: mcp,home-assistant,ai,automation,smart-home
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Topic :: Home Automation
|
|
19
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
20
|
+
Requires-Python: <3.14,>=3.11
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: fastmcp>=2.11.0
|
|
24
|
+
Requires-Dist: httpx>=0.27.0
|
|
25
|
+
Requires-Dist: textdistance[extras]>=4.6.0; platform_machine != "arm64" and platform_machine != "aarch64" and platform_machine != "ARM64"
|
|
26
|
+
Requires-Dist: textdistance>=4.6.0; platform_machine == "arm64" or platform_machine == "aarch64" or platform_machine == "ARM64"
|
|
27
|
+
Requires-Dist: pydantic>=2.5.0
|
|
28
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
29
|
+
Requires-Dist: websockets>=12.0
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
<div align="center">
|
|
33
|
+
<img src="docs/img/ha-mcp-logo.png" alt="Home Assistant MCP Server Logo" width="300"/>
|
|
34
|
+
|
|
35
|
+
# The Unofficial and Awesome Home Assistant MCP Server
|
|
36
|
+
|
|
37
|
+
<p align="center">
|
|
38
|
+
<a href="https://github.com/homeassistant-ai/ha-mcp"><img src="https://img.shields.io/badge/Home%20Assistant-Add--on-41BDF5?logo=home-assistant" alt="Home Assistant Add-on"></a>
|
|
39
|
+
<a href="https://github.com/homeassistant-ai/ha-mcp/releases"><img src="https://img.shields.io/github/v/release/homeassistant-ai/ha-mcp" alt="Release"></a>
|
|
40
|
+
<a href="https://github.com/homeassistant-ai/ha-mcp/actions/workflows/e2e-tests.yml"><img src="https://img.shields.io/github/actions/workflow/status/homeassistant-ai/ha-mcp/e2e-tests.yml?branch=master&label=E2E%20Tests" alt="E2E Tests"></a>
|
|
41
|
+
<a href="LICENSE.md"><img src="https://img.shields.io/github/license/homeassistant-ai/ha-mcp.svg" alt="License"></a>
|
|
42
|
+
<br>
|
|
43
|
+
<a href="https://github.com/homeassistant-ai/ha-mcp/commits/master"><img src="https://img.shields.io/github/commit-activity/m/homeassistant-ai/ha-mcp.svg" alt="Activity"></a>
|
|
44
|
+
<a href="https://github.com/jlowin/fastmcp"><img src="https://img.shields.io/badge/Built%20with-FastMCP-purple" alt="Built with FastMCP"></a>
|
|
45
|
+
<img src="https://img.shields.io/python/required-version-toml?tomlFilePath=https%3A%2F%2Fraw.githubusercontent.com%2Fhomeassistant-ai%2Fha-mcp%2Fmaster%2Fpyproject.toml" alt="Python Version">
|
|
46
|
+
</p>
|
|
47
|
+
|
|
48
|
+
<p align="center">
|
|
49
|
+
<em>A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with Home Assistant.<br>
|
|
50
|
+
Using natural language, control smart home devices, query states, execute services and manage your automations.</em>
|
|
51
|
+
</p>
|
|
52
|
+
</div>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+

|
|
57
|
+
|
|
58
|
+
**[YouTube version →](https://youtu.be/eCO93KfSvIM)**
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## ✨ Features
|
|
63
|
+
|
|
64
|
+
### 🔍 Discover, Search and Query
|
|
65
|
+
- **Fuzzy Entity Search**: Comprehensive search with similar words tolerance
|
|
66
|
+
- **Deep Configuration Search**: Search within automation triggers, script sequences, and helper configurations
|
|
67
|
+
- **AI-Optimized System Overview**: Complete system analysis showing entity counts, areas, and device status
|
|
68
|
+
- **Intelligent Entity Matching**: Advanced search across all Home Assistant entities with partial name matching
|
|
69
|
+
- **Template Evaluation**: Evaluate Home Assistant templates for dynamic data processing and calculations
|
|
70
|
+
- **Logbook Data Access**: Query logbook entries with date filtering and entity-specific searches
|
|
71
|
+
|
|
72
|
+
### 🏠 Control
|
|
73
|
+
- **Universal Service Control**: Execute any Home Assistant service with full parameter support
|
|
74
|
+
- **Real-time State Access**: Get detailed entity states with attributes, timestamps, and context information
|
|
75
|
+
|
|
76
|
+
### 🔧 Manage
|
|
77
|
+
- **Automation and Scripts**: Create, modify, delete, enable/disable, and trigger Home Assistant automations
|
|
78
|
+
- **Helper Entity Management**: Create, modify, and delete input_boolean, input_number, input_select, input_text, input_datetime, and input_button entities
|
|
79
|
+
- **Backup and Restore**: Create fast local backups (excludes database) and restore with safety mechanisms
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## 🚀 Installation
|
|
84
|
+
|
|
85
|
+
Choose the installation method that best fits your setup:
|
|
86
|
+
|
|
87
|
+
### Method 1: Home Assistant Add-on (Recommended)
|
|
88
|
+
|
|
89
|
+
**Best for:** Users running Home Assistant OS
|
|
90
|
+
|
|
91
|
+
**Advantages:**
|
|
92
|
+
- ✅ 5 clicks installation
|
|
93
|
+
- ✅ Isolated environment
|
|
94
|
+
- ✅ Automatic updates
|
|
95
|
+
- ✅ Part of your Home Assistant Setup
|
|
96
|
+
|
|
97
|
+
**Installation Steps:**
|
|
98
|
+
|
|
99
|
+
1. **Click the button to add the repository** to your Home Assistant instance:
|
|
100
|
+
|
|
101
|
+
[](https://my.home-assistant.io/redirect/supervisor_add_addon_repository/?repository_url=https%3A%2F%2Fgithub.com%2Fhomeassistant-ai%2Fha-mcp)
|
|
102
|
+
|
|
103
|
+
Or manually add this repository URL in Supervisor → Add-on Store:
|
|
104
|
+
```
|
|
105
|
+
https://github.com/homeassistant-ai/ha-mcp
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
2. **Navigate to the add-on** "Home Assistant MCP Server" from the add-on store
|
|
109
|
+
|
|
110
|
+
3. **Click Install, Wait and then Start**
|
|
111
|
+
|
|
112
|
+
4. Follow the [configuration instructions for clients in the add-on documentation](homeassistant-addon/DOCS.md)
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
### Method 2: Container
|
|
117
|
+
|
|
118
|
+
**Best for:** Recommended for Home Assistant Container or when Docker is available
|
|
119
|
+
|
|
120
|
+
**Advantages:**
|
|
121
|
+
- ✅ No installation
|
|
122
|
+
- ✅ Isolated environment
|
|
123
|
+
- ✅ Automatic updates
|
|
124
|
+
|
|
125
|
+
**Get a long-lived token:** Home Assistant → Your Profile → Security → Long-Lived Access Tokens
|
|
126
|
+
|
|
127
|
+
**Client Configuration:**
|
|
128
|
+
|
|
129
|
+
<details>
|
|
130
|
+
<summary><b>📱 Claude Desktop or any mcp.json format</b></summary>
|
|
131
|
+
|
|
132
|
+
**Location:**
|
|
133
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
134
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
135
|
+
|
|
136
|
+
Add to your `mcp.json`:
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"mcpServers": {
|
|
140
|
+
"home-assistant": {
|
|
141
|
+
"command": "docker",
|
|
142
|
+
"args": [
|
|
143
|
+
"run",
|
|
144
|
+
"--rm",
|
|
145
|
+
"-e", "HOMEASSISTANT_URL=http://homeassistant.local:8123",
|
|
146
|
+
"-e", "HOMEASSISTANT_TOKEN=your_long_lived_token",
|
|
147
|
+
"ghcr.io/homeassistant-ai/ha-mcp:latest"
|
|
148
|
+
]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
</details>
|
|
155
|
+
|
|
156
|
+
<details>
|
|
157
|
+
<summary><b>🌐 Web Clients (Claude.ai, ChatGPT, etc.)</b></summary>
|
|
158
|
+
|
|
159
|
+
1. **Create a docker-compose.yml:**
|
|
160
|
+
```yaml
|
|
161
|
+
version: '3.8'
|
|
162
|
+
services:
|
|
163
|
+
ha-mcp:
|
|
164
|
+
image: ghcr.io/homeassistant-ai/ha-mcp:latest
|
|
165
|
+
container_name: ha-mcp
|
|
166
|
+
ports:
|
|
167
|
+
- "8086:8086"
|
|
168
|
+
environment:
|
|
169
|
+
HOMEASSISTANT_URL: http://homeassistant.local:8123
|
|
170
|
+
HOMEASSISTANT_TOKEN: your_long_lived_token
|
|
171
|
+
MCP_SECRET_PATH: /__your_secret_string__
|
|
172
|
+
command: ["fastmcp", "run", "fastmcp-webclient.json"]
|
|
173
|
+
restart: unless-stopped
|
|
174
|
+
|
|
175
|
+
cloudflared:
|
|
176
|
+
image: cloudflare/cloudflared:latest
|
|
177
|
+
command: tunnel --url http://ha-mcp:8086
|
|
178
|
+
depends_on:
|
|
179
|
+
- ha-mcp
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
2. **Start the services:**
|
|
183
|
+
```bash
|
|
184
|
+
docker compose up -d
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
3. **Check cloudflared logs for your URL:**
|
|
188
|
+
```bash
|
|
189
|
+
docker compose logs cloudflared
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
4. **Use:** `https://abc-def.trycloudflare.com/__your_secret_string__`
|
|
193
|
+
|
|
194
|
+
</details>
|
|
195
|
+
|
|
196
|
+
<details>
|
|
197
|
+
<summary><b>💻 Claude Code</b></summary>
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
claude mcp add-json home-assistant '{
|
|
201
|
+
"command": "docker",
|
|
202
|
+
"args": [
|
|
203
|
+
"run",
|
|
204
|
+
"--rm",
|
|
205
|
+
"-e", "HOMEASSISTANT_URL=http://homeassistant.local:8123",
|
|
206
|
+
"-e", "HOMEASSISTANT_TOKEN=your_long_lived_token",
|
|
207
|
+
"ghcr.io/homeassistant-ai/ha-mcp:latest"
|
|
208
|
+
]
|
|
209
|
+
}'
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
</details>
|
|
213
|
+
|
|
214
|
+
---
|
|
215
|
+
|
|
216
|
+
### Method 3: Running Python with UV
|
|
217
|
+
|
|
218
|
+
**Best for:** When Docker is not available
|
|
219
|
+
|
|
220
|
+
> **Windows users:** Follow the [Windows UV setup guide](docs/Windows-uv-guide.md)
|
|
221
|
+
|
|
222
|
+
**Prerequisites:**
|
|
223
|
+
- [UV package manager](https://docs.astral.sh/uv/getting-started/installation/) and [Git binary](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)
|
|
224
|
+
- Windows: winget install astral-sh.uv Git.Git -e
|
|
225
|
+
- MacOS: brew install git uv
|
|
226
|
+
- Your Home assistant URL (ex: http://localhost:8123) for HOMEASSISTANT_URL variable
|
|
227
|
+
- A Home Assistant long-lived access token (Profile → Security → Long-Lived Access Tokens) for HOMEASSISTANT_TOKEN variable
|
|
228
|
+
|
|
229
|
+
**Client Configuration:**
|
|
230
|
+
|
|
231
|
+
<details>
|
|
232
|
+
<summary><b>📱 Claude Desktop or any mcp.json format</b></summary>
|
|
233
|
+
|
|
234
|
+
**Config file:**
|
|
235
|
+
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
236
|
+
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
237
|
+
|
|
238
|
+
```json
|
|
239
|
+
{
|
|
240
|
+
"mcpServers": {
|
|
241
|
+
"Home Assistant": {
|
|
242
|
+
"command": "uvx",
|
|
243
|
+
"args": ["--from=git+https://github.com/homeassistant-ai/ha-mcp", "ha-mcp"],
|
|
244
|
+
"env": {
|
|
245
|
+
"HOMEASSISTANT_URL": "http://localhost:8123",
|
|
246
|
+
"HOMEASSISTANT_TOKEN": "your_long_lived_token"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
```
|
|
252
|
+
Note: replace both HOMEASSISTANT_URL and HOMEASSISTANT_TOKEN with your values.
|
|
253
|
+
|
|
254
|
+
</details>
|
|
255
|
+
|
|
256
|
+
<details>
|
|
257
|
+
<summary><b>💻 Claude Code</b></summary>
|
|
258
|
+
|
|
259
|
+
```bash
|
|
260
|
+
claude mcp add --transport stdio home-assistant \
|
|
261
|
+
--env HOMEASSISTANT_URL=http://localhost:8123 \
|
|
262
|
+
--env HOMEASSISTANT_TOKEN=your_long_lived_token \
|
|
263
|
+
-- uvx --from=git+https://github.com/homeassistant-ai/ha-mcp ha-mcp
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
</details>
|
|
267
|
+
|
|
268
|
+
<details>
|
|
269
|
+
<summary><b>🌐 Web Clients (Claude.ai, ChatGPT, etc.)</b></summary>
|
|
270
|
+
|
|
271
|
+
Run the MCP server with uvx (replace the values of the environement variables):
|
|
272
|
+
|
|
273
|
+
Windows:
|
|
274
|
+
```bash
|
|
275
|
+
set HOMEASSISTANT_URL=http://localhost:8123
|
|
276
|
+
set HOMEASSISTANT_TOKEN=your_long_lived_token
|
|
277
|
+
set MCP_PORT=8086
|
|
278
|
+
set MCP_SECRET_PATH=/__my_secret__
|
|
279
|
+
uvx --from=git+https://github.com/homeassistant-ai/ha-mcp ha-mcp-web
|
|
280
|
+
```
|
|
281
|
+
Others:
|
|
282
|
+
```bash
|
|
283
|
+
export HOMEASSISTANT_URL=http://localhost:8123
|
|
284
|
+
export HOMEASSISTANT_TOKEN=your_long_lived_token
|
|
285
|
+
export MCP_PORT=8086
|
|
286
|
+
export MCP_SECRET_PATH=/__my_secret__
|
|
287
|
+
uvx --from=git+https://github.com/homeassistant-ai/ha-mcp ha-mcp-web
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Web client required https and a public URL. You need to use a proxy in front of `http://localhost:8086`.
|
|
291
|
+
|
|
292
|
+
Easiest option is to download [Cloudflare Tunnel](https://developers.cloudflare.com/cloudflare-one/networks/connectors/cloudflare-tunnel/downloads/#latest-release)
|
|
293
|
+
|
|
294
|
+
**In another terminal, start Cloudflare Tunnel:**
|
|
295
|
+
|
|
296
|
+
```bash
|
|
297
|
+
cloudflared tunnel --url http://localhost:8086
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Use the public url provided and add your secret path like so `https://XYZ.trycloudflare.com/__my_secret__`. This url must be used in your Web client MCP configuration and kept secret.
|
|
301
|
+
</details>
|
|
302
|
+
|
|
303
|
+
**Development:** See [CONTRIBUTING.md](CONTRIBUTING.md) for testing and contribution guidelines.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 🛠️ Available Tools
|
|
308
|
+
|
|
309
|
+
### Search & Discovery Tools
|
|
310
|
+
| Tool | Description | Example |
|
|
311
|
+
|------|-------------|---------|
|
|
312
|
+
| `ha_search_entities` | Comprehensive entity search with fuzzy matching | `ha_search_entities("lumiere salon")` |
|
|
313
|
+
| `ha_deep_search` | Search within automation/script/helper configurations | `ha_deep_search("light.turn_on")` |
|
|
314
|
+
| `ha_get_overview` | AI-optimized system overview with entity counts | `ha_get_overview()` |
|
|
315
|
+
|
|
316
|
+
### Core Home Assistant API Tools
|
|
317
|
+
| Tool | Description | Example |
|
|
318
|
+
|------|-------------|---------|
|
|
319
|
+
| `ha_get_state` | Get entity state with attributes and context | `ha_get_state("light.living_room")` |
|
|
320
|
+
| `ha_call_service` | Execute any Home Assistant service (universal control) | `ha_call_service("light", "turn_on", {"entity_id": "light.all"})` |
|
|
321
|
+
|
|
322
|
+
### Device Control Tools
|
|
323
|
+
| Tool | Description | Example |
|
|
324
|
+
|------|-------------|---------|
|
|
325
|
+
| `ha_bulk_control` | Control multiple devices with WebSocket verification | `ha_bulk_control([{"entity_id": "light.all", "action": "turn_on"}])` |
|
|
326
|
+
| `ha_get_operation_status` | Check status of device operations | `ha_get_operation_status("operation_id")` |
|
|
327
|
+
| `ha_get_bulk_status` | Check status of multiple operations | `ha_get_bulk_status(["op1", "op2"])` |
|
|
328
|
+
|
|
329
|
+
### Configuration Management Tools
|
|
330
|
+
| Tool | Description | Example |
|
|
331
|
+
|------|-------------|---------|
|
|
332
|
+
| `ha_config_set_helper` | Create/update helper entities | `ha_config_set_helper("input_boolean", "test")` |
|
|
333
|
+
| `ha_config_remove_helper` | Delete helper entities | `ha_config_remove_helper("input_boolean", "test")` |
|
|
334
|
+
| `ha_config_set_script` | Create/update scripts | `ha_config_set_script("script_id", config)` |
|
|
335
|
+
| `ha_config_get_script` | Get script configuration | `ha_config_get_script("script_id")` |
|
|
336
|
+
| `ha_config_remove_script` | Delete scripts | `ha_config_remove_script("script_id")` |
|
|
337
|
+
| `ha_config_set_automation` | Create/update automations | `ha_config_set_automation(config)` |
|
|
338
|
+
| `ha_config_get_automation` | Get automation configuration | `ha_config_get_automation("automation.id")` |
|
|
339
|
+
| `ha_config_remove_automation` | Delete automations | `ha_config_remove_automation("automation.id")` |
|
|
340
|
+
|
|
341
|
+
### History & Insights Tools
|
|
342
|
+
| Tool | Description | Example |
|
|
343
|
+
|------|-------------|---------|
|
|
344
|
+
| `ha_get_logbook` | Access historical logbook entries | `ha_get_logbook(hours_back=24)` |
|
|
345
|
+
|
|
346
|
+
### Backup & Restore Tools
|
|
347
|
+
| Tool | Description | Example |
|
|
348
|
+
|------|-------------|---------|
|
|
349
|
+
| `ha_backup_create` | Create fast local backup | `ha_backup_create("backup_name")` |
|
|
350
|
+
| `ha_backup_restore` | Restore from backup | `ha_backup_restore("backup_id")` |
|
|
351
|
+
|
|
352
|
+
### Template & Documentation Tools
|
|
353
|
+
| Tool | Description | Example |
|
|
354
|
+
|------|-------------|---------|
|
|
355
|
+
| `ha_eval_template` | Evaluate Jinja2 templates | `ha_eval_template("{{ states('sensor.temp') }}")` |
|
|
356
|
+
| `ha_get_domain_docs` | Get Home Assistant domain documentation | `ha_get_domain_docs("light")` |
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
## ⚙️ Configuration Options
|
|
361
|
+
|
|
362
|
+
### Environment Variables
|
|
363
|
+
|
|
364
|
+
| Variable | Description | Default | Required |
|
|
365
|
+
|----------|-------------|---------|----------|
|
|
366
|
+
| `HOMEASSISTANT_URL` | Home Assistant URL | - | Yes |
|
|
367
|
+
| `HOMEASSISTANT_TOKEN` | Long-lived access token | - | Yes |
|
|
368
|
+
| `BACKUP_HINT` | Backup recommendation level | `normal` | No |
|
|
369
|
+
|
|
370
|
+
**Backup Hint Modes:**
|
|
371
|
+
- `strong`: Suggests backup before first modification each day/session
|
|
372
|
+
- `normal`: Suggests backup only before irreversible operations (recommended)
|
|
373
|
+
- `weak`: Rarely suggests backups
|
|
374
|
+
- `auto`: Same as normal (future: auto-detection)
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## 🤝 Contributing
|
|
379
|
+
|
|
380
|
+
For development setup, testing instructions, and contribution guidelines, see **[CONTRIBUTING.md](CONTRIBUTING.md)**.
|
|
381
|
+
|
|
382
|
+
For comprehensive testing documentation, see **[tests/README.md](tests/README.md)**.
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## 🛣️ Development Roadmap
|
|
387
|
+
|
|
388
|
+
### Completed ✅
|
|
389
|
+
- [x] Core infrastructure and HTTP client
|
|
390
|
+
- [x] FastMCP integration with OpenAPI auto-generation
|
|
391
|
+
- [x] Smart search tools with fuzzy matching
|
|
392
|
+
- [x] Optimized tool documentation to reduce tool call errors
|
|
393
|
+
- [x] WebSocket async device control
|
|
394
|
+
- [x] Logbook history and operational insights
|
|
395
|
+
- [x] Comprehensive test suite
|
|
396
|
+
- [x] Home Assistant Add-on support
|
|
397
|
+
- [x] Docker images with multi-mode support
|
|
398
|
+
|
|
399
|
+
For future enhancements and planned features, see the [Development Roadmap](https://github.com/homeassistant-ai/ha-mcp/wiki) in our wiki.
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## 📄 License
|
|
404
|
+
|
|
405
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
406
|
+
|
|
407
|
+
---
|
|
408
|
+
|
|
409
|
+
## 🙏 Acknowledgments
|
|
410
|
+
|
|
411
|
+
- **[Home Assistant](https://home-assistant.io/)**: Amazing smart home platform (!)
|
|
412
|
+
- **[FastMCP](https://github.com/jlowin/fastmcp)**: Excellent MCP server framework
|
|
413
|
+
- **[Model Context Protocol](https://modelcontextprotocol.io/)**: Standardized AI-application communication
|
|
414
|
+
- **[Claude Code](https://github.com/anthropics/claude-code)**: AI-powered coding assistant
|
|
415
|
+
|
|
416
|
+
## 👥 Contributors
|
|
417
|
+
|
|
418
|
+
- **[@julienld](https://github.com/julienld)** — Project maintainer & core contributor.
|
|
419
|
+
- **[@kingbear2](https://github.com/kingbear2)** — Windows UV setup guide.
|