Skip to content

Commit b75d4b3

Browse files
allenporterCopilot
andcommitted
Clarify MCP Server setup instructions for local and remote clients
Co-authored-by: Copilot <copilot@github.com>
1 parent 706aa88 commit b75d4b3

1 file changed

Lines changed: 100 additions & 39 deletions

File tree

source/_integrations/mcp_server.markdown

Lines changed: 100 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,10 @@ Clients that support OAuth can use this to allow you to give the client access
7777
to your Home Assistant MCP server.
7878

7979
Home Assistant has adopted [IndieAuth](https://indieauth.spec.indieweb.org/) and does not require you to pre-define
80-
an OAuth Client ID. Instead, the Client ID is the base of the redirect URL.
80+
an OAuth Client ID. Instead, the Client ID is the base URL of the client application making the request.
8181

82-
- *Client ID*: If your redirect-uri is `https://www.example.com/mcp/redirect`, your client ID should be `https://www.example.com`.
83-
- *Client Secret*: This is not used by Home Assistant and can be ignored or set to any value.
82+
- *Client ID*: This is the base URL of the LLM application configuring the connector (for example, `https://claude.ai` for Claude, or `https://chatgpt.com` for ChatGPT). It should **not** be your Home Assistant server's URL.
83+
- *Client Secret*: This is not used by Home Assistant. If the client strictly requires a value, you can put any random text or leave it blank.
8484

8585
#### Long-Lived Access Tokens
8686

@@ -97,24 +97,76 @@ For more information about Authentication in Home Assistant, refer to the [Authe
9797

9898
### Example: Claude for Desktop
9999

100-
Claude for Desktop now supports remote MCP servers, making it extremely easy to connect to your
101-
Home Assistant instance:
100+
Claude for Desktop can connect to Home Assistant using either a cloud-based remote connector or a local MCP proxy server.
101+
102+
**Option 1: Remote connector (requires public Home Assistant URL)**
103+
104+
When using a remote custom connector in Claude for Desktop, the connection is brokered through Anthropic's cloud infrastructure. This means your Home Assistant instance must be publicly accessible from the internet.
102105

103106
1. Download [Claude for Desktop](https://claude.ai/download) and log in.
104-
2. Click your profile name, select **Settings**, and go to **Connectors**.
105-
3. Click **Add Custom Connector**.
107+
2. Select your profile name, select **Settings**, and go to **Connectors**.
108+
3. Select **Add Custom Connector**.
106109
4. Enter the following details:
107110
- **Name**: "Home Assistant" (or any more descriptive name you prefer)
108-
- **Remote MCP Server URL**: `https://<your_home_assistant_url>/api/mcp`
111+
- **Remote MCP Server URL**: `https://<your_home_assistant_external_url>/api/mcp`
109112
- Under advanced settings:
110113
- **OAuth Client ID**: `https://claude.ai`
111114
- **OAuth Client Secret**: Leave this blank
112-
5. Click **OK**. Now click **Connect** next to the entry created with the name you provided above.
115+
5. Select **OK**. Now select **Connect** next to the entry created with the name you provided above.
113116
6. Log in to your Home Assistant instance and allow the redirect back to Claude Desktop.
114117
7. 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.
115118

116119
![Screenshot of Claude for Desktop adding an item to a Home Assistant To-do list](/images/integrations/mcp_server/claude-todo-list-control.png)
117120

121+
**Option 2: Local MCP proxy server (for internal/local Home Assistant URLs)**
122+
123+
If your Home Assistant instance is only accessible on your local network (for example, `http://homeassistant.local:8123` or `http://192.168.1.10:8123`) or behind a VPN, you can use a local MCP proxy. This allows Claude Desktop to connect directly from your computer without routing through Anthropic's cloud.
124+
125+
1. Make sure you have a [Long-lived access token](#long-lived-access-tokens) from your Home Assistant account.
126+
2. Install `mcp-proxy` following the instructions in the [README](https://github.com/sparfenyuk/mcp-proxy). For example: `uv tool install git+https://github.com/sparfenyuk/mcp-proxy`.
127+
3. Locate your Claude Desktop configuration file (for example, `~/Library/Application Support/Claude/claude_desktop_config.json` on macOS or `%APPDATA%\Claude\claude_desktop_config.json` on Windows).
128+
4. Add the following to your `mcpServers` configuration:
129+
130+
```json
131+
{
132+
"mcpServers": {
133+
"Home Assistant": {
134+
"command": "mcp-proxy",
135+
"args": [
136+
"--transport=streamablehttp",
137+
"--stateless",
138+
"http://<your_local_home_assistant_ip_or_url>:8123/api/mcp"
139+
],
140+
"env": {
141+
"API_ACCESS_TOKEN": "<your_access_token_here>"
142+
}
143+
}
144+
}
145+
}
146+
```
147+
5. Restart Claude for Desktop to connect.
148+
149+
### Example: ChatGPT
150+
151+
ChatGPT supports connecting to remote Model Context Protocol servers for Plus, Pro, Business, and Enterprise/Edu users. ChatGPT currently only supports remote connections, which means your Home Assistant instance must be publicly accessible from the internet.
152+
153+
1. Log in to [ChatGPT](https://chatgpt.com). Ensure developer mode is enabled for your account (this can be toggled in **Settings** > **Apps** > **Advanced Settings**).
154+
2. Navigate to **Workspace settings** (or user settings), select **Apps**, and select **Create**.
155+
3. Enter the following details:
156+
- **Name**: "Home Assistant" (or any name you prefer).
157+
- **MCP Server URL**: `https://<your_home_assistant_external_url>/api/mcp`
158+
- Select **OAuth** for the authentication mechanism. ChatGPT will attempt to auto discover OAuth settings. If this does not work you will need to manually enter the settings under **Advanced OAuth Settings** > **User defined oauth client**:
159+
- Under **Client registration**:
160+
- **OAuth Client ID**: `https://chatgpt.com`
161+
- **OAuth Client Secret**: Enter any random text (it is not used by Home Assistant, but the ChatGPT configuration form may require a value).
162+
- **Token endpoint auth method**: `client_secret_post`
163+
- Under **OAuth endpoints**:
164+
- **Auth Url**: `https://<your_home_assistant_external_url>/auth/authorize`
165+
- **Token url**: `https://<your_home_assistant_external_url>/auth/token`
166+
- **Authorization server base**: `https://<your_home_assistant_external_url>`
167+
4. Select **Create**. Once created, the app will appear in your **Enabled Apps**.
168+
5. Begin a new chat in ChatGPT, open the apps menu, and select your newly created Home Assistant app. ChatGPT will prompt you to authenticate, which will redirect you to Home Assistant to log in and authorize the connection.
169+
118170
### Example: Claude Code
119171

120172
Claude Code supports remote MCP servers, making it easy to connect to your Home Assistant instance:
@@ -132,7 +184,7 @@ Claude Code supports remote MCP servers, making it easy to connect to your Home
132184
}
133185
}' --client-secret
134186
```
135-
The name "HA", the URL "https://<your_home_assistant_url>", and the callback port "12345" are examples; adjust them to match your setup.
187+
The name `"HA"`, the URL `"https://<your_home_assistant_url>"`, and the callback port `"12345"` are examples; adjust them to match your setup. *(Note: `clientId: "http://localhost:12345"` is correct for the Claude Code CLI's internal local callback server. Do not change this to your Home Assistant URL.)*
136188

137189
3. Start `claude` and type `/mcp`. Navigate to your MCP listing (for example, **HA**) and press Enter. Select **Authenticate** to open a web browser to your Home Assistant login page.
138190
4. After you authenticate to your Home Assistant server, Home Assistant will tell you that you can close the web browser.
@@ -144,24 +196,25 @@ Claude Code supports remote MCP servers, making it easy to connect to your Home
144196
2. Install `mcp-proxy` following the instructions in the [README](https://github.com/sparfenyuk/mcp-proxy).
145197
For example, `uv tool install git+https://github.com/sparfenyuk/mcp-proxy`.
146198
3. Open the main Cursor Settings and select **MCP**.
147-
4. Click **Add new global MCP server** and add the Home Assistant server configuration:
199+
4. Select **Add new global MCP server** and add the Home Assistant server configuration:
200+
148201
```json
149-
{
150-
"mcpServers": {
151-
"Home Assistant": {
152-
"command": "mcp-proxy",
153-
"args": [
154-
"--transport=streamablehttp",
155-
"--stateless",
156-
"http://localhost:8123/api/mcp"
157-
],
158-
"env": {
159-
"API_ACCESS_TOKEN": "<your_access_token_here>"
160-
}
161-
}
162-
}
163-
}
164-
```
202+
{
203+
"mcpServers": {
204+
"Home Assistant": {
205+
"command": "mcp-proxy",
206+
"args": [
207+
"--transport=streamablehttp",
208+
"--stateless",
209+
"http://<your_local_home_assistant_ip_or_url>:8123/api/mcp"
210+
],
211+
"env": {
212+
"API_ACCESS_TOKEN": "<your_access_token_here>"
213+
}
214+
}
215+
}
216+
}
217+
```
165218
5. Save your `mcp.json` file. You can also find this file in the `$HOME/.cursor/mcp.json` directory.
166219
6. Restart Cursor and return to the MCP settings. You should see the Home Assistant server in the list. The indicator should be green.
167220
7. In chat agent mode (Ctrl+I), ask it to control your home and the tool should be used.
@@ -205,18 +258,16 @@ The [MCP Prompts](https://modelcontextprotocol.io/docs/concepts/prompts) provide
205258
inform LLMs how to call the tools. The tools used by the configured LLM API
206259
are exposed.
207260

208-
## Known Limitations
261+
## Known limitations
209262

210263
The Home Assistant Model Context Protocol integration currently only supports a
211264
subset of MCP features:
212265

213-
| Feature | Supported by Home Assistant |
214-
| ------- | --------- |
215-
| Prompts | ✅ |
216-
| Tools | ✅ |
217-
| Resources | ❌ |
218-
| Sampling | ❌ |
219-
| Notifications | ❌ |
266+
- **Prompts**: Supported
267+
- **Tools**: Supported
268+
- **Resources**: Not supported
269+
- **Sampling**: Not supported
270+
- **Notifications**: Not supported
220271

221272

222273
## Troubleshooting
@@ -254,17 +305,27 @@ or the MCP server in Home Assistant is not configured.
254305

255306
To understand the root cause, first check debug logs on the client. For example in Claude for Desktop:
256307

257-
1. Visit **Settings...**.
308+
1. Select **Settings...**.
258309
2. Select **Developer**.
259-
3. Select the `Home Assistant` MCP server.
310+
3. Select the **Home Assistant** MCP server.
260311
4. Select **Open Logs Folder**.
261312
5. View `mcp-server-Home Assistant.log`. These are known problems and their resolution:
262-
- `Client error '404 Not Found' for url 'http://localhost:8123/api/mcp'`:
313+
- `Client error '404 Not Found' for url 'http://<your_local_home_assistant_ip_or_url>:8123/api/mcp'`:
263314
this means the MCP Server integration is not configured in Home Assistant.
264-
- `Client error '401 Unauthorized' for url 'http://localhost:8123/api/mcp'`:
315+
- `Client error '401 Unauthorized' for url 'http://<your_local_home_assistant_ip_or_url>:8123/api/mcp'`:
265316
this means that the long live access token is not correct.
266317
...
267318

319+
### Repeated OAuth failures
320+
321+
#### Symptom: Unable to access Home Assistant after several failed login attempts
322+
323+
If you accidentally enter incorrect credentials or configuration details multiple times during the OAuth setup flow, Home Assistant might temporarily block your IP address for security.
324+
325+
##### Resolution
326+
327+
Check your `ip_bans.yaml` file in the Home Assistant configuration directory. If your computer's IP address or the client's IP is listed there, remove it and restart Home Assistant, then try authenticating again.
328+
268329
## Removing the integration
269330

270331
This integration can be removed by following these steps:

0 commit comments

Comments
 (0)