MCP

Home Assistant MCP

Let AI view the status of devices in your home and operate the smart-home devices you have authorized it to access.

Translation reviewed
Read the original Chinese text

让 AI 查看家中设备状态,并操作你授权开放的智能家居设备。

Target: Home Assistant. Based on author documentation.

Query Home Assistant devices with Codex

These steps are based on source documentation. We have not run this resource and tool combination.

Systems: macos、windows、linux. Guide prepared: 2026-11-09.

Requirements

  • You have an accessible Home Assistant instance with connected devices.
  • Codex CLI is installed and signed in. Your machine must be able to reach the Home Assistant URL.
  • Check the exposed toolsets in Home Assistant. Device control and the broader Home Assistant toolset have different scopes. Start with only the access you need.

Setup steps

  1. In Home Assistant, open Settings → System → AI, enable Model Context Protocol and copy the MCP URL you want to use.
  2. Check the exposed scope in toolset settings. Device control sees only exposed entities; other toolsets may read more entities, logs and history.
  3. Replace <your_mcp_server_url> in the command with the URL you copied, then add the connection in your own terminal.
  4. Follow the Codex prompt to sign in to Home Assistant in your browser and authorize access. Run the login command if needed.
  5. List MCP configurations and check the connection. Start by reading device status without controlling devices.

Add connection · replace the URL placeholder first

Replace placeholders before use. This site does not collect access tokens or device passwords.

codex mcp add homeassistant --url <your_mcp_server_url>

Sign in when OAuth is required

codex mcp login homeassistant

Check configured servers

codex mcp list

First small task

Query only the lights I authorized. List their names and current on/off states. Do not change device states; describe the specific error if reading fails.

How to check the result

  • The homeassistant configuration exists in Codex and authorization is complete.
  • Returned device names and states match their Home Assistant entities.
  • No device states were changed.

Troubleshooting

URL cannot be reached

Check that this machine can open Home Assistant in a browser and that the MCP URL comes from the current instance. Local machines and cloud AI services have different network access requirements.

Repeated OAuth failures

Use the official Home Assistant troubleshooting instructions to check the URL and authentication configuration, then sign in again. Do not paste access tokens into this site.

Devices missing or exposure scope unexpected

Check the toolset and exposed entities. Adjust permissions in Home Assistant before retrying; a successful sync does not prove permissions are correct.

How to disable it

  • Run codex mcp remove homeassistant in your terminal to remove the client configuration. To revoke access, also check authorization in Home Assistant.