Home Assistant MCP
Exposes a Home Assistant instance as an MCP tool set, running as a stateful agent on Cloudflare Workers, enabling clients to read entity states, call services, run scripts and automations, and send commands to phones.
README
Home Assistant MCP
An MCP server that exposes a Home Assistant instance as a tool set, running as a stateful agent on Cloudflare Workers. Point an MCP client (Claude, etc.) at the deployed endpoint and it can read entity states, call services, run scripts and automations, and send commands to phones via the HA companion app — all against your own Home Assistant instance.
How it works
MCP client ──HTTP/SSE──► Worker (/mcp) ──► HomeAssistantMCP (Durable Object)
│
HomeAssistantClient
│
Home Assistant REST API (Bearer auth)
HomeAssistantMCP is a McpAgent
hosted on a Durable Object; each tool call goes through HomeAssistantClient,
a thin wrapper around the HA REST API that handles auth, path-safe entity
IDs, and error normalization. Areas have no dedicated REST endpoint in HA, so
listAreas / getEntitiesByArea go through /api/template with a small
Jinja template instead.
Tools
| Tool | Description |
|---|---|
get_entities |
List entity states, optionally filtered by domain |
get_entity_state |
Full state and attributes for one entity |
call_service |
Call any HA service (light.turn_on, lock.lock, ...) |
list_areas |
List configured areas (rooms) |
get_entities_by_area |
Entity IDs belonging to an area |
list_automations |
Automations with state and last-triggered time |
trigger_automation |
Trigger an automation, bypassing conditions |
list_scripts |
Scripts with their running state |
run_script |
Run a script |
get_entity_history |
Recent state history for an entity |
phone_list_capabilities |
List commands sendable to the HA mobile app |
phone_send_command |
Send a command (e.g. DND toggle) to a phone |
Setup
npm install
wrangler secret put HA_TOKEN # long-lived access token from HA
HA_URL is set in wrangler.jsonc under vars — point it at your own Home
Assistant instance before deploying.
Development
npm run dev # wrangler dev
npm test # vitest run
npm run test:watch # vitest watch mode
Tests cover HomeAssistantClient by mocking fetch — no live Home
Assistant instance is required to run them.
Deploy
npm run deploy
Or connect this repository to a Cloudflare Worker for git-based deploys.
Either way, HA_TOKEN must be set as a Wrangler secret in the target
environment — it is never stored in the repo.
Stack
- Cloudflare Workers + Durable Objects (SQLite-backed)
- Cloudflare Agents SDK (
agents/mcp) - MCP TypeScript SDK
- TypeScript, Zod for tool input schemas, Vitest
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.