Model Context Protocol Server
The Model Context Protocol Server (MCP) integration lets you connect an AI agent, such as ChatGPT or Claude, to Home Assistant. The AI agent can then control your devices and see the current state of your home.
Prerequisites
- Your MCP server URL. To get it:
- Go to Settings > System > AI.
- If MCP is not enabled, enable it.
- Next to the MCP server you want to use, select the copy icon
. We recommend My MCP because it lets the AI agent control everything Home Assistant has access to.
- An AI agent that supports MCP servers.
- If the AI agent runs in the cloud, for example when you use it through a website, your Home Assistant instance must be accessible from the internet. Use Home Assistant Cloud or another method of remote access.
For detailed configuration instructions, refer to the Client configuration section.
Configuration
To add the Model Context Protocol Server service to your Home Assistant instance, use this My button:
Manual configuration steps
If the above My button doesn’t work, you can also perform the following steps manually:
-
Browse to your Home Assistant instance.
-
In the bottom right corner, select the
Add Integration button. -
From the list, select Model Context Protocol Server.
-
Follow the instructions on screen to complete the setup.
When you set up the integration, it exposes all LLM APIs and requires an administrator account. To change this, go to Settings > Devices & services, select Model Context Protocol Server, and then select Configure.
Configuration options
The integration provides the following configuration options:
If MCP clients can use every LLM API, including LLM APIs that are added later. This option is turned on by default. If you set up the integration before this option existed, it stays turned off so that your clients keep the LLM APIs you selected. Turn it off to select individual LLM APIs.
The LLM APIs that MCP clients can use when Expose all LLM APIs is turned off. Clients can only control or provide information about entities that are exposed to them.
Client configuration
Home Assistant implements the standard Model Context Protocol, including OAuth 2.0 with PKCE. It supports OAuth Client ID Metadata Documents, so AI agents set up the client ID and callback URL automatically.
Example: Claude
Before you start, copy your MCP server URL as described in the prerequisites.
Claude connects to your MCP server from the cloud, also when you use Claude Desktop. Your Home Assistant instance must be accessible from the internet.
-
Open the form to add a connector:
- On claude.ai, go to the Claude connectors page. In the top-right corner, select Add > Add custom connector.
- In Claude Desktop, go to Settings > Connectors and select Add > Add custom connector.
-
Enter the following details:
-
Name:
Home Assistant - MCP Server URL: Paste your MCP server URL.
-
Name:
-
Select Add.
-
Claude verifies the MCP server and shows a dialog. Enter the following details:
- Authentication: Select Sign in now.
- OAuth client: Select Use Claude’s published identity.
-
Select Add.
-
On the page for your new connector, select Connect.
-
Log in to your Home Assistant instance.
-
You can now enable tools from Home Assistant when chatting with Claude, allowing you to control Home Assistant in a similar way to how you control it through the Voice Assistant. Claude will ask you for permission before calling any tools.

Example: ChatGPT
Before you start, copy your MCP server URL as described in the prerequisites.
If you use ChatGPT on chatgpt.com, your Home Assistant instance must be accessible from the internet.
- Open the form to add an MCP server:
- On chatgpt.com, go to the ChatGPT plugins page. In the top-right corner, select Add > Add custom MCP server.
- In ChatGPT Desktop, go to Settings > Plugins and select Add > Add MCP server.
- Enter the following details:
-
Name:
Home Assistant - Connection: Paste your MCP server URL.
- Authentication: Select OAuth.
-
Name:
- Select I understand and want to continue.
- Select Create as plugin.
- ChatGPT offers to Connect Home Assistant. Select Continue to Home Assistant.
- Log in to your Home Assistant instance.
Example: Claude Code
Claude Code connects to MCP servers over HTTPS only. Use the MCP server URL of your remotely accessible Home Assistant instance, as described in the prerequisites.
-
Install Claude Code and log in.
-
In your terminal, run the following command. Replace
<your_mcp_server_url>with your MCP server URL.claude mcp add home-assistant --transport http <your_mcp_server_url> -
Start
claudeand type/mcp. -
Select
home-assistant. -
Select Authenticate.
-
Log in to your Home Assistant instance.
-
You can now enable tools from Home Assistant when chatting with Claude, allowing you to control Home Assistant in a similar way to how you control it through the Voice Assistant. Claude will ask you for permission before calling any tools.
Example: Codex
-
Install Codex and sign in.
-
In your terminal, run the following command. Replace
<your_mcp_server_url>with your MCP server URL, for examplehttp://homeassistant.local:8123/api/mcp.codex mcp add homeassistant --url <your_mcp_server_url> -
Codex opens your Home Assistant instance in your web browser. Log in to your Home Assistant instance.
Example: OpenCode
OpenCode can connect to Home Assistant as a remote MCP server by using OAuth. This example uses the configuration format of OpenCode v2.
-
Install OpenCode.
-
Edit or create your configuration file:
- To make the server available in every project, edit
~/.config/opencode/opencode.jsonc. - To use the server in one project only, edit
opencode.jsoncin your project.
- To make the server available in every project, edit
-
Add the following to your configuration:
{ "$schema": "https://opencode.ai/config.json", "mcp": { "servers": { "homeassistant": { "type": "remote", "url": "<your_home_assistant_url>/api/mcp", "oauth": { "client_id": "http://127.0.0.1:12345", "callback_port": 12345 } } } } } -
Replace
<your_home_assistant_url>with the complete URL of your Home Assistant server, includinghttp://orhttps://and the port, if required. For example, usehttp://homeassistant.localfor a typical local connection. The callback port and the port inclient_idmust match. Theclient_idvalue is the base URL of the local OAuth callback used by OpenCode. Do not replace it with your Home Assistant URL. -
Run the following command:
opencode mcp auth homeassistant -
Complete the authentication in your web browser and authorize OpenCode to access Home Assistant.
-
Run
opencode mcp listto confirm that the server is connected. The Home Assistant tools appear with the prefixhomeassistant_.
Example: Cursor
Cursor connects to Home Assistant through mcp-proxy. This local MCP server acts as a gateway to the Home Assistant MCP server. You also need a long-lived access token, which you can create in User profile > Security.
-
Download and install Cursor.
-
Install
mcp-proxyfollowing the instructions in the README. For example,uv tool install git+https://github.com/sparfenyuk/mcp-proxy. -
Open the main Cursor Settings and select MCP.
-
Select Add new global MCP server and add the Home Assistant server configuration:
{ "mcpServers": { "Home Assistant": { "command": "mcp-proxy", "args": [ "--transport=streamablehttp", "--stateless", "http://<your_local_home_assistant_ip_or_url>:8123/api/mcp" ], "env": { "API_ACCESS_TOKEN": "<your_access_token_here>" } } } } -
Save your
mcp.jsonfile. You can also find this file in the$HOME/.cursor/mcp.jsondirectory. -
Restart Cursor and return to the MCP settings. You should see the Home Assistant server in the list. The indicator should be green.
-
In chat agent mode (Ctrl+I), ask it to control your home and the tool should be used.

Example: Antigravity CLI
-
Install the Antigravity CLI if you haven’t already. You can find installation instructions at https://antigravity.google.
-
Open the Antigravity CLI MCP configuration file,
mcp_config.json. This is usually located at~/.gemini/antigravity-cli/mcp_config.json. For more details, refer to the Antigravity CLI MCP server documentation. -
Add the following to your
mcpServersconfiguration:{ "mcpServers": { "homeassistant": { "serverUrl": "https://<your_home_assistant_url>/api/mcp", "headers": { "Authorization": "Bearer ${HOMEASSISTANT_TOKEN}" } } } } -
Replace
<your_home_assistant_url>with the URL of your Home Assistant instance. -
Set the
HOMEASSISTANT_TOKENenvironment variable to a Long-Lived Access Token from your Home Assistant instance. -
Save the file. You can now use Home Assistant tools within the Antigravity CLI.
Example: Mistral Vibe
Mistral Vibe can connect to Home Assistant as a remote MCP server by using a long-lived access token. The Vibe CLI doesn’t support OAuth for MCP servers yet.
-
Install Mistral Vibe and run
vibeonce to complete the setup. -
Create a long-lived access token in User profile > Security.
-
Set the
HOMEASSISTANT_TOKENenvironment variable to your access token in the shell where you start Vibe. -
Open
~/.vibe/config.tomland add the following at the end of the file:[[mcp_servers]] name = "homeassistant" transport = "streamable-http" url = "<your_home_assistant_url>/api/mcp" api_key_env = "HOMEASSISTANT_TOKEN" api_key_header = "Authorization" api_key_format = "Bearer {token}" -
Replace
<your_home_assistant_url>with the complete URL of your Home Assistant instance, including the port if required. For example, usehttp://homeassistant.local:8123for a typical local connection. -
Start
vibeand type/mcpto confirm the server is connected. The Home Assistant tools appear with the prefixhomeassistant_.
Supported functionality
Tools
MCP Tools enable LLMs to perform actions through Home Assistant. The tools used by the configured LLM API are exposed.
Prompts
The MCP Prompts provided inform LLMs how to call the tools. The tools used by the configured LLM API are exposed.
Resources
When the configured LLM API includes the GetLiveContext tool, Home Assistant
also exposes a read-only MCP Resource
named homeassistant://assist/context-snapshot.
This resource returns a plain-text snapshot that matches the existing
GetLiveContext tool output. It is intended for inspection, debugging, and
explanation workflows where a static snapshot is useful. If the configured LLM
API does not expose GetLiveContext, this resource is not available.
Known limitations
The Home Assistant Model Context Protocol integration currently only supports a subset of MCP features:
- Prompts: Supported
- Tools: Supported
- Resources: Supported (Assist only)
- Sampling: Not supported
- Notifications: Not supported
Troubleshooting
Repeated OAuth failures
Symptom: Unable to access Home Assistant after several failed login attempts
If authentication keeps failing during the OAuth setup flow, the most likely cause is that one or more OAuth details are incorrect, such as the client ID or the Home Assistant URL.
Resolution
- Review the OAuth configuration in your client and verify the details:
- Make sure the Client ID is the base URL of the LLM client application (for example,
https://claude.aifor Claude orhttps://chatgpt.comfor ChatGPT), and never your Home Assistant instance URL. IndieAuth validates that the redirect URI shares the same scheme and domain with the client ID; setting the client ID to your Home Assistant instance causes the authorization flow to fail. - Home Assistant does not use a client secret. If the field is required by the client application, enter any text; if it is optional, leave it blank.
- Make sure the URL used to access Home Assistant matches the configured Internal URL or External URL in Settings > System > Network.
- Make sure the Client ID is the base URL of the LLM client application (for example,
- If you have explicitly enabled IP bans in Home Assistant and repeated failed sign-in attempts caused a ban, check the
ip_bans.yamlfile in your Home Assistant configuration directory. If your computer’s IP address or the client’s IP address is listed there, remove it, restart Home Assistant, and then try authenticating again.
Symptom: OAuth discovery fails or authorization server metadata is rejected
When connecting an external client (such as ChatGPT or Claude) through a tunnel, reverse proxy, or custom domain, the client fails to complete OAuth discovery or rejects the metadata with an error regarding the issuer or registration endpoint.
Description
This can occur for two reasons:
-
Hostname or proxy mismatch: Home Assistant checks incoming requests against its configured internal and external URLs. If the hostname used by the remote LLM client does not match the configured URL, or if reverse-proxy headers (
X-Forwarded-Host,X-Forwarded-Proto) are missing or mismatched, Home Assistant cannot resolve theissuerin/.well-known/oauth-authorization-serverand returns relative paths. Conforming OAuth clients reject this metadata because RFC 8414 requires theissuerto match the URL used to discover it. -
Unsupported Dynamic Client Registration (RFC 7591): Home Assistant uses the
draft-ietf-oauth-client-id-metadata-documentstandard (client_id_metadata_document_supported: true) rather than RFC 7591 Dynamic Client Registration. LLM clients that strictly require RFC 7591 Dynamic Client Registration cannot register automatically.
Resolution
- Go to Settings > System > Network and make sure that the External URL (or Internal URL) matches the exact hostname and scheme used by the remote LLM client to reach Home Assistant.
- If using a reverse proxy or tunnel (such as Cloudflare Tunnel), make sure Home Assistant is configured to trust forwarded headers from the proxy. See Reverse proxies in the HTTP integration documentation for details on configuring Trust X-Forwarded-For and Trusted proxies.
- If the LLM client supports manual OAuth configuration (such as ChatGPT’s user-defined OAuth client), enter the authorization and token endpoints manually rather than relying on automatic discovery.
- Using Home Assistant Cloud (
https://<your-id>.ui.nabu.casa) avoids reverse-proxy and tunnel configuration pitfalls because it automatically handles canonical hostnames and SSL termination.
Removing the integration
This integration can be removed by following these steps:
To remove an integration instance from Home Assistant
- Go to Settings > Devices & services and select the integration card.
- From the list of devices, select the integration instance you want to remove.
- Next to the entry, select the three dots
menu. Then, select Delete.