Industry problems

Can AI agents control smart home and IoT devices locally?

Yes, if the agent, the model and the devices can all reach each other on site. Today most agents reach devices through a hub's API or an MCP server in front of it, such as Home Assistant's, which can control exposed devices with no cloud in the path when the MCP client and the model also run locally. A cloud-hosted model or MCP client brings the internet back into the loop, and devices with no shared IP network need a discovery and messaging layer of their own.

TL;DR

An AI agent controls devices locally only when the model, MCP client and hub or devices all run on site, such as a local model using Home Assistant's MCP server. A cloud model or MCP client puts the internet back in the path. Expose only the devices the agent needs, have a person approve risky actions, and log every call.

Learning objectives

After reading this article you will be able to:

  • Compare the four ways an agent reaches a device, by internet dependence, discovery, authorization and path
  • Set up a local path from a model through MCP and a hub to a device, and spot the steps that still call the cloud
  • Limit what an agent can do to a device with exposure lists, confirmations and audit logs

AI agent device control methods

Most AI agents control devices the way a phone app does: through the maker’s cloud API or through a hub in the home that already controls them. The agent’s model decides what to do, and a tool layer turns that decision into an API call.

Four approaches are in use, and they differ mainly in whether the internet sits in the path. This table compares them as of October 2026.

ApproachNeeds the internetHow devices are foundHow the caller is authorizedPath a command takes
Vendor cloud APIYes, every callThe devices listed in the vendor accountThe vendor account’s credentials or tokensAgent to the vendor’s cloud, then down to the hub or device
A local hub’s API, such as Home Assistant’s REST or WebSocket APINo, if the agent runs on the home networkThe hub’s own device list; the hub itself is found at a local name such as homeassistant.localA long-lived access token sent as a bearer tokenAgent to hub on the local network, then hub to device
An MCP server in front of a hub, such as Home Assistant’sOnly if the model or the MCP client runs in the cloudThe tools the server lists, covering the devices exposed to itOAuth 2.0 with PKCE, administrator account by defaultModel to MCP client to the hub’s MCP endpoint, then hub to device
Peer service discovery on the devicesNomDNS and DNS-SD on a shared network, or discovery carried over a meshEach device’s own keys and allow listsAgent’s device to the provider directly or through relays

The vendor cloud path is the easiest to start with and the only one that stops during an outage. The hub paths keep the command inside the home, and the last row covers devices that have no hub in common.

MCP device control through a hub

The Model Context Protocol (MCP) is an open protocol that connects an AI application to tools and data. A host application, such as a chat app or coding agent, creates an MCP client for each MCP server it uses. The server lists tools, and the model calls them with structured arguments.

MCP has two standard transports. With stdio, the client launches the server as a subprocess on the same machine. With Streamable HTTP, the client sends each message as an HTTP request to the server’s endpoint, which can be on the local network or the internet. MCP’s authorization specification is optional and, for HTTP transports, based on OAuth 2.1.

Home Assistant ships both sides as integrations, both added in Home Assistant 2025.2:

  • The Model Context Protocol Server integration exposes Home Assistant to AI agents at its /api/mcp endpoint. Its documentation says the agent can control your devices and see the current state of your home, limited to the entities exposed to it. It supports MCP tools, prompts and a read-only context resource, but not sampling or notifications.
  • The Model Context Protocol integration works the other way. It lets Home Assistant’s own conversation agents use tools from outside MCP servers, such as memory or web search. It supports only tools and connects to servers over SSE, so a server that speaks only stdio needs a proxy such as mcp-proxy.

To connect an agent to Home Assistant’s MCP server:

  1. In Home Assistant, go to Settings, System, AI, enable MCP if it is off, and copy the MCP server URL.
  2. Add the integration under Settings, Devices and services, and review its options: whether all LLM APIs are exposed, and whether only administrator accounts may use the endpoint.
  3. Expose only the devices the agent should control, from the Expose tab under Settings, Voice assistants.
  4. Add the URL to your MCP client. Home Assistant documents the steps for Claude, ChatGPT, Claude Code, Codex and OpenCode, and the client opens a browser to sign in to Home Assistant.

Where the client runs decides whether the internet is involved. Home Assistant says that if the AI agent runs in the cloud, the Home Assistant instance must be reachable from the internet, and that Claude connects to the MCP server from the cloud even when you use Claude Desktop. Its Codex example uses a local address, http://homeassistant.local:8123/api/mcp.

Local models on home hardware

The model can run on your own hardware, with trade-offs in accuracy and hardware. Home Assistant’s Ollama integration adds a conversation agent powered by an Ollama server, which runs on macOS, Linux and Windows on your own network. When it is allowed to control Home Assistant, it acts only on exposed entities.

Home Assistant is frank about the limits of this experimental feature:

  • Only models that support tools can control Home Assistant.
  • Smaller models are more likely to make mistakes than larger ones, and may not reliably keep a conversation going while control is enabled.
  • It recommends exposing fewer than 25 entities when experimenting with a local model.
  • Its default context window is 8k tokens, and a larger window supports larger homes at the cost of more memory on the Ollama server.

Spoken commands can stay local too. Home Assistant’s local voice pipeline uses Speech-to-Phrase or Whisper to turn speech into text and Piper to speak the answer, all on your own hardware. It suggests Whisper, which is slower on small hardware, when you plan to pair the assistant with a language model. A fully local chain is therefore a microphone, a local speech engine, a local model, Home Assistant and the devices, with no step that needs the internet.

Local device and service discovery for agents

An agent rarely finds devices itself; it asks something that already knows them. A hub keeps the device list and exposes chosen devices as tools, so the agent’s discovery step is the MCP tools/list request.

Underneath, local discovery uses multicast DNS. Home Assistant’s Matter documentation says the Matter protocol relies on local IPv6 and mDNS traffic traveling freely in the network. Multicast DNS, RFC 6762, resolves names ending in .local with no DNS server, which is how homeassistant.local reaches the hub. DNS-Based Service Discovery, RFC 6763, lets a client list the named instances of a service type, such as every printer or every Matter device on the network.

Both stay inside one network segment with multicast allowed. VLANs and guest networks that block multicast break them, which is a common reason an agent or hub cannot see a device that a phone can. How do devices discover services without a server? covers the options in more depth.

Agent safety controls for devices

Keeping an agent safe around devices means limiting what it can reach, keeping a person approving risky actions, and recording every call. The MCP specification says that for trust and safety there should always be a human in the loop with the ability to deny tool invocations.

The specification and Home Assistant’s documentation give concrete controls:

  1. Expose the minimum. Home Assistant lets you choose which entities each assistant can control, and its MCP server and Ollama agent act only on exposed entities. Leave locks, garage doors and heating out until you trust the setup.
  2. Require confirmation for actions that matter. MCP says clients should prompt for user confirmation on sensitive operations and show tool inputs before calling the server. Home Assistant notes that Claude asks for permission before calling any tools.
  3. Restrict who can connect. Home Assistant’s MCP server requires an administrator account by default and uses OAuth 2.0 with PKCE. A remote client means the instance is reachable from the internet, so treat that exposure as part of the risk.
  4. Do not trust tool descriptions blindly. MCP says clients must treat tool annotations as untrusted unless they come from trusted servers.
  5. Bound and log every call. MCP says servers must validate inputs, enforce access controls and rate limit tool calls, and clients should set timeouts and log tool use for audit.
  6. Make retries safe. A command with no reply may still have run. Give each action an ID so a retry is applied only once, and prefer “set to 20 degrees” over “raise by 2”.

When devices share only a radio link, the IP-based paths stop working, so discovery and calls have to travel over the radio itself. mDNS needs a shared IP network, MCP over Streamable HTTP needs an IP route, and stdio works only on one machine.

That is the case for agents on phones, handhelds, vehicles and robots that meet with no shared Wi-Fi. Two devices may share only Bluetooth LE, or a direct Wi-Fi link that one platform supports and the other does not. BLE vs Wi-Fi Direct vs Wi-Fi Aware compares those links. Software that works here has to carry three steps over the radio: advertise a capability, discover who offers it, and invoke it with a request and response. Each device also takes over the authorization a hub used to provide, deciding which peers may call it and which providers it will trust. How do AI agents talk to each other without a server? walks through that pattern.

Offline Protocol service calls between agents

Offline Protocol does not control smart home or IoT devices. It is not a hub, it does not speak Matter, Zigbee, Z-Wave or Thread, and its MCP server is for coding agents building apps with the SDK, not for operating devices.

It covers the last row of the table: agents and services on phones, computers and gateways that need to find and call each other without a central registry. In SDK v0.31.0, a device registers a service, other devices discover it with queries that spread across the mesh, and the caller sends a typed request and gets a response, with requests sealed in an end-to-end encrypted session once one exists. The discovery messages themselves are signed but readable by the devices that relay them, so a service description should hold nothing sensitive. On a local network the Python binding can also publish services as DNS-SD records. A host can run the SDK as a local service that programs reach over JSON-RPC on a WebSocket, and its HTTP front lets a program call an HTTP service on another device by that device’s address, with the request carried inside an end-to-end encrypted message. Device control stays with the hub or the device’s own protocol. For a site team, that means agents and handhelds keep handing work to each other on the spot instead of waiting on a cloud round trip for every handoff.

Frequently asked questions

Does Home Assistant have an MCP server?

Yes. Home Assistant's Model Context Protocol Server integration, added in Home Assistant 2025.2, lets an AI agent such as ChatGPT or Claude control the devices exposed to it and read the state of the home. It uses OAuth 2.0 with PKCE and by default requires an administrator account.

Can I use Claude Desktop with Home Assistant without exposing it to the internet?

No, according to Home Assistant. Its MCP Server page says Claude connects to the MCP server from the cloud, also when you use Claude Desktop, so the Home Assistant instance must be reachable from the internet through Home Assistant Cloud or another remote access method.

Can a local LLM control Home Assistant?

Yes, as an experimental feature. The Ollama integration adds a conversation agent powered by an Ollama server on your network, and when control is enabled it can act only on entities exposed to it. Home Assistant recommends exposing fewer than 25 entities, warns that smaller models make more mistakes, and says only models that support tools can control the home.

Is MCP the same as Matter?

No. Matter is a smart home standard that defines device types and how controllers command devices on an IP network. MCP is a protocol that connects an AI application to tools and data, so an MCP server can sit in front of a hub that in turn controls Matter devices.

Can an AI agent find devices on my network by itself?

Only through something that already knows them or a discovery protocol. Matter relies on mDNS on the local network, and a hub such as Home Assistant keeps the list of devices and exposes chosen ones to the agent as tools. An agent with no hub and no shared IP network needs discovery carried over whatever link the devices share.

Does the Offline Protocol MCP server control devices?

No. It serves coding agents that are building apps with the SDK, with package lookup, integration guidance, planning and scaffolding. Device communication runs inside the app through the SDK.

Sources

Build it with Offline Protocol

The local API page shows how to run one Offline Protocol engine as a service on a host, let programs talk to it over JSON-RPC on a WebSocket, and use the HTTP front to call an HTTP service on another device by its address.

Read the local API page