MCP server for Home Assistant providing 21 tools for LLM-driven control and maintenance.
- ๐ฏ Smart Resolution: Fuzzy search and typo-tolerant mapping for 3,200+ names
- ๐ฎ Full Control: Lights, climate, media, fans, and service calls
- ๐ Deep Discovery: Explore topology, entity relationships, and device health
- ๐ Analytics: Live context, historical baselines, and anomaly detection
- โก Performance: Persistent disk cache with 60s auto-refresh for <50ms responses
SynapseHA can be installed as a Home Assistant add-on for easy integration. The add-on runs an HTTP/SSE server that MCP clients can connect to.
-
Add this repository to Home Assistant
Or manually:
- Go to Settings โ Add-ons โ Add-on Store
- Click the three dots menu (โฎ) in the top right
- Select Repositories
- Add:
https://github.com/hellosamblack/SynapseHA - Click Add โ Close
-
Install the add-on
- Find SynapseHA in the add-on store
- Click Install
-
Start the add-on
- Click Start
- The add-on will automatically connect to your Home Assistant instance using the Supervisor API
- The MCP server will be available at
http://<homeassistant-ip>:3000
Once the add-on is running, MCP clients can connect to:
- SSE endpoint:
GET http://<homeassistant-ip>:3000/mcp - Messages endpoint:
POST http://<homeassistant-ip>:3000/messages?sessionId=<id> - Health check:
GET http://<homeassistant-ip>:3000/health
The add-on supports the following configuration options:
| Option | Default | Description |
|---|---|---|
log_level |
info |
Logging level (debug, info, warn, error) |
http_port |
3000 |
HTTP port for MCP server |
bearer_token |
"" |
Optional bearer token for authentication |
require_auth |
false |
Require authentication for connections |
cache_refresh_interval |
60 |
Cache refresh interval in seconds |
entity_cache_enabled |
true |
Enable entity caching |
Set the following environment variables:
export HA_URL="http://homeassistant.local:8123"
export HA_TOKEN="your_long_lived_access_token"
export CACHE_DIR="./cache" # Optional, defaults to ./cache
export CACHE_TTL="60000" # Optional, defaults to 60 seconds- Open Home Assistant
- Go to your profile (bottom left)
- Scroll to "Long-Lived Access Tokens"
- Click "Create Token"
- Copy the token
npm start-
Install the connection:
- Ensure you have the MCP Extension installed in VS Code.
- Open your MCP Server Configuration (usually in
.vscode/mcp.jsonor global settings).
-
Add the SynapseHA Server:
If running via Home Assistant Add-on (Remote/Network): Use the URL where your Add-on is communicating.
{ "mcpServers": { "synapseha": { "url": "http://<homeassistant-ip>:3000/mcp" } } }Run Locally (Development only): If you are running this code locally (not on HA OS), point directly to the build:
{ "mcpServers": { "synapseha": { "command": "node", "args": ["f:/CastleBlackCode/SynapseHA/synapseha/dist/index.js"], "env": { "HA_URL": "http://homeassistant.local:8123", "HA_TOKEN": "your_long_lived_token" } } } }
Add to your Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json on macOS or %APPDATA%\Claude\claude_desktop_config.json on Windows):
{
"mcpServers": {
"synapseha": {
"command": "node",
"args": ["/absolute/path/to/SynapseHA/synapseha/dist/index.js"],
"env": {
"HA_URL": "http://homeassistant.local:8123",
"HA_TOKEN": "your_token_here"
}
}
}
}Entity Discovery (4 tools)
- list_entities - List all entities or filter by domain (light, switch, climate, sensor)
- search_entities - Fuzzy search entities by name with typo tolerance
- get_entity_state - Get detailed state and attributes for specific entities
- get_entity_relationships - Get relationships between entities, devices, and areas
Device Control (5 tools)
- control_light - Control lights: on/off, brightness, color, temperature
- control_climate - Control thermostats: temperature, mode, fan
- control_media_player - Control media: play, pause, volume, source
- control_fan - Control fans: speed, direction
- control_switch - Control switches and smart plugs
Service Calls (1 tool)
- call_service - Call any Home Assistant service with custom parameters
Topology & Discovery (4 tools)
- get_areas - List all areas (rooms)
- get_devices - List all devices with optional area filter
- get_device_health - Check unavailable entities and low battery devices
- list_services - List all available services by domain
Analytics (4 tools)
- get_live_context - Get current state: active entities, recent changes
- get_history - Get historical data for entities over time
- calculate_baseline - Calculate statistics (avg, min, max, median)
- detect_anomalies - Detect stuck sensors and anomalies
Automation (2 tools)
- activate_scene - Activate a Home Assistant scene
- trigger_automation - Trigger a Home Assistant automation
System Info (1 tool)
- get_system_info - Get Home Assistant version, location, and entity counts
See API.md for detailed documentation of each tool.
SynapseHA features intelligent entity resolution that allows flexible device control:
// Use friendly names instead of entity IDs
{name: "living room lights"} // โ light.living_room_main
// Combine with area for disambiguation
{name: "temperature", area: "bedroom"} // โ sensor.bedroom_temperature
// Add floor for multi-level homes
{name: "lights", area: "bedroom", floor: "2"} // โ light.2f_bedroom_main
// Direct entity_id still works
{entity_id: "light.living_room"}Name normalization: Handles variations like "living room" vs "livingroom", ignores special characters
Partial matching: Finds "temp" when searching for "temperature"
Domain preference: Prefers lights when multiple entity types match
- "Turn on the living room lights at 50% brightness"
- "What's the temperature in the bedroom?"
- "Show me all devices with low battery"
- "Find entities that haven't updated in the last hour"
- "What lights are currently on?"
- "Set the thermostat to 72 degrees"
- "Show me the history of the front door sensor for the last 24 hours"
SynapseHA/
โโโ src/
โ โโโ index.ts # Main MCP server
โ โโโ lib/
โ โ โโโ ha-client.ts # Home Assistant API wrapper
โ โ โโโ cache.ts # Persistent cache with auto-refresh
โ โ โโโ fuzzy-search.ts # Fuzzy matching for entities
โ โ โโโ name-resolver.ts # Intelligent entity name resolution
โ โโโ tools/
โ โ โโโ index.ts # All 21 MCP tools
โ โโโ types/
โ โโโ index.ts # TypeScript type definitions
โโโ dist/ # Compiled JavaScript (ES modules)
โโโ cache/ # Persistent disk cache
- Cache Hit: <50ms response time
- Cache Miss: ~200-500ms (API call + cache write)
- Auto-refresh: Every 60 seconds for entity states
- Fuzzy Search: ~5-10ms for 3,200+ entities
# Watch mode for development
npm run watch
# Build for production
npm run build
# Run the server
npm startSee CONTRIBUTING.md for development guidelines.
- API.md - Complete API reference for all tools
- TROUBLESHOOTING.md - Common issues and solutions
- CHANGELOG.md - Version history and changes
- CONTRIBUTING.md - Development guide
Contributions are welcome! Please read CONTRIBUTING.md for details.
ISC - See LICENSE file for details.
Built with:
- Model Context Protocol SDK - MCP implementation
- Home Assistant - Smart home platform
- Fuse.js - Fuzzy search library
- Axios - HTTP client
- Check TROUBLESHOOTING.md first
- Search existing issues
- Create a new issue if needed
If you find SynapseHA useful, please consider giving it a star on GitHub!