|
| 1 | +--- |
| 2 | +title: Model Context Protocol Server |
| 3 | +description: Instructions on how to integrate Matter with Home Assistant. |
| 4 | +ha_category: |
| 5 | + - Voice |
| 6 | +ha_release: 2023.2 |
| 7 | +ha_iot_class: Local Push |
| 8 | +ha_config_flow: true |
| 9 | +ha_codeowners: |
| 10 | + - 'allenporter' |
| 11 | +ha_domain: mcp_server |
| 12 | +ha_integration_type: integration |
| 13 | +related: |
| 14 | + - docs: /integrations/conversation/ |
| 15 | + title: Conversation |
| 16 | +--- |
| 17 | + |
| 18 | +The [Model Context Protocol](https://modelcontextprotocol.io) is an open protocol for standardizing how applications provide context to LLMs. The **Model Context Protocol Server** integration enables using Home Assistant as context for MCP LLM Client Applications. |
| 19 | + |
| 20 | +This integration can help you expose other Home Assistant integrations as |
| 21 | +context for LLM applications outside of Home Assistant. For example, you can expose |
| 22 | +your Google Tasks To-do list as a tool for Claude Desktop. |
| 23 | + |
| 24 | +Controlling Home Assistant is done by providing MCP clients access to the Assist API of Home Assistant. You can control what devices and entities it can access from the {% my voice_assistants title="exposed entities page" %}. |
| 25 | + |
| 26 | +## Pre-requisites |
| 27 | + |
| 28 | +1. You will need an [MCP client ](https://modelcontextprotocol.io/clients) LLM Application such as [Claude Desktop](https://claude.ai/download). |
| 29 | +1. Since most clients do not support native remote servers, you will need an additional local MCP server remote gateway. |
| 30 | + |
| 31 | +See [Client Configuration](#client-configuration) below for detailed instructions. |
| 32 | + |
| 33 | +{% include integrations/config_flow.md %} |
| 34 | + |
| 35 | +## Configuration options |
| 36 | + |
| 37 | +The integration provides the following configuration options: |
| 38 | + |
| 39 | +{% configuration_basic %} |
| 40 | +Control Home Assistant: |
| 41 | + description: The API to use to expose tools over the Model Context Protocol. Clients |
| 42 | + can only control or provide information about entities that are [exposed](/voice_control/voice_remote_expose_devices/) to it. |
| 43 | +{% endconfiguration_basic %} |
| 44 | + |
| 45 | +## Architecture Overview |
| 46 | + |
| 47 | +This integration can provide similar functionality as other LLM based conversation |
| 48 | +agents (for example [Anthropic](/integrations/anthropic/), [Google Generative AI](/integrations/google_generative_ai_conversation), [Ollama](/integrations/ollama/), [Open AI](/integrations/openai_conversation/)). In those conversation agents, Home Assistant is the |
| 49 | +client and prepares the available tools and passes them into the LLM with a prompt. |
| 50 | + |
| 51 | +The Model Context Protocol follow a different pattern: An LLM application acts as |
| 52 | +a client and can connect to multiple MCP servers to provide context. See the |
| 53 | +[Model Context Protocol Introducton](https://modelcontextprotocol.io/introduction#general-architecture) for more details. |
| 54 | + |
| 55 | +## Client Configuration |
| 56 | + |
| 57 | +The Model Context Protocol specification does not yet currently define standards |
| 58 | +for authentication and connecting to remote servers. These are a *work in progress* |
| 59 | +and this configugration will likely change in the near future. |
| 60 | + |
| 61 | +### Access Control |
| 62 | + |
| 63 | +For now, we can use |
| 64 | +[Long-lived access token](https://developers.home-assistant.io/docs/auth_api/#long-lived-access-token) to control access to the API. |
| 65 | + |
| 66 | +1. Visit your account profile settings, under the **Security** tab. {% my profile badge %}. |
| 67 | + |
| 68 | +1. Create a **Long-lived access token** |
| 69 | + |
| 70 | +1. Copy the access token to use when configuring the MCP client LLM application. |
| 71 | + |
| 72 | +See [Authentication](https://www.home-assistant.io/docs/authentication/#your-account-profile) for more information about Authentication in Home Assistant. |
| 73 | + |
| 74 | +### Client Configuration |
| 75 | + |
| 76 | +Most MCP clients do not support native remote servers. You will need an |
| 77 | +additional local MCP server to act as a gateway to Home Assistant. |
| 78 | + |
| 79 | +#### Example: Claude Desktop |
| 80 | + |
| 81 | +See [MCP Quickstart: For Claude Desktop Users](https://modelcontextprotocol.io/quickstart/user#for-claude-desktop-users) for a detailed guide on using Claude Desktop with |
| 82 | +a local MCP server. It is recommended to get another server working first before |
| 83 | +configuring Home Assistant MCP Server. |
| 84 | + |
| 85 | +TODO: Give example |
| 86 | + |
| 87 | +## Supported functionality |
| 88 | + |
| 89 | +### Prompts |
| 90 | + |
| 91 | +[MCP Prompts](https://modelcontextprotocol.io/docs/concepts/prompts) are reusable |
| 92 | +workflows that clients can surface. The prompt used by the LLM API are exposed. |
| 93 | + |
| 94 | +### Tools |
| 95 | + |
| 96 | +[MCP Tools](https://modelcontextprotocol.io/docs/concepts/tools) enable LLMs to |
| 97 | +perform actions through Home Assistant. The tools used by the configured LLM API |
| 98 | +are exposed. |
| 99 | + |
| 100 | +## Known Limitations |
| 101 | + |
| 102 | +The Remote Model Context Protocol integration does not currently support |
| 103 | +notifications which notify clients of state changes. |
| 104 | + |
| 105 | +## Remove integration |
| 106 | + |
| 107 | +This integration can be removed by following these steps: |
| 108 | + |
| 109 | +{% include integrations/remove_device_service.md %} |
0 commit comments