Nara Home MCP

Nara Home MCP

Enables ChatGPT to read selected Home Assistant data and perform limited home-control actions like turning on/off lights and running scenes, with a strict allowlist for security.

Category
访问服务器

README

Nara Home MCP

Nara Home MCP is a focused Model Context Protocol server that lets ChatGPT read selected Home Assistant data and perform a small set of explicitly approved home-control actions. It replaces broad Home Assistant access with named tools, aliases, and an allowlist that keeps the exposed surface understandable and auditable.

Architecture

flowchart LR
    A[ChatGPT or MCP client] -->|HTTPS /mcp| B[Nara Home MCP]
    B --> C[Tool validation and allowlist]
    C -->|Home Assistant REST API| D[Home Assistant]
    E[.env and entities.yaml] --> B

The server uses MCP Streamable HTTP on /mcp. Configuration is loaded from environment variables and a YAML entity map. A small asynchronous client communicates with the Home Assistant REST API using a Home Assistant access token.

Features and tools

Nara Home MCP currently exposes 18 tools.

State and presence

  • ha_get_state reads one explicitly allowed entity.
  • ha_get_temperature reads the temperature for a configured room or climate location.
  • ha_get_overnight_temperature summarizes minimum, maximum, and average temperature between 23:00 and 08:00.
  • ha_get_presence summarizes configured presence sensors.

Climate and home health

  • ha_get_climate_summary returns configured temperature, humidity, and battery readings.
  • ha_get_battery_summary reports configured batteries and detects values below a configurable threshold.
  • ha_get_ups_summary summarizes configured UPS sensors.
  • ha_get_home_health_summary combines climate, batteries, UPS, and infrastructure data.

Infrastructure

  • ha_get_proxmox_summary summarizes configured Proxmox sensors.
  • ha_get_nas_summary summarizes configured NAS sensors.
  • ha_get_infra_summary returns the combined Proxmox and NAS view.

Limited control

  • ha_turn_on turns on an allowlisted light.
  • ha_turn_off turns off an allowlisted light.
  • ha_set_light_brightness changes the brightness of an allowlisted light.
  • ha_set_display_brightness changes the brightness of an allowlisted display entity.
  • ha_run_scene activates an allowlisted scene.

Discovery and diagnostics

  • ha_list_allowed_entities lists the aliases and entities available through the server.
  • ha_get_server_version returns runtime and tool-catalog diagnostics.

Security model

The entity configuration is a static allowlist by default. With ALLOW_DYNAMIC_ENTITIES=false, only entities declared in entities.yaml can be read through ha_get_state. Dynamic discovery must be enabled explicitly and is not recommended for a tightly controlled deployment.

Control tools do not accept arbitrary Home Assistant services. They are limited to configured lights, displays, and scenes, and their resolvers reject targets outside the corresponding allowlist.

The Home Assistant token is read from .env, used as a bearer token for the Home Assistant API, and must never be committed. Use a dedicated Home Assistant account and the minimum permissions suitable for the deployment.

Warning: Do not expose the MCP endpoint to the public Internet without appropriate authentication and access controls. HTTPS encrypts traffic but does not, by itself, authorize clients.

Requirements

  • Python 3.11
  • A reachable Home Assistant instance
  • A Home Assistant access token
  • Network access from the MCP host to Home Assistant
  • An authenticated HTTPS endpoint when connecting from ChatGPT

Quick installation

python3 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements.txt
cp .env.example .env
cp config/entities.example.yaml config/entities.yaml

Edit .env and change ENTITIES_FILE to config/entities.yaml. Then replace all fictional values in config/entities.yaml with aliases and entity IDs from your own Home Assistant installation.

Configuration

The main environment settings are:

  • HA_URL: base URL of Home Assistant.
  • HA_TOKEN: Home Assistant access token.
  • MCP_HOST and MCP_PORT: local bind address and port.
  • ENTITIES_FILE: path to the private entity configuration.
  • ALLOW_DYNAMIC_ENTITIES: keep false for a static allowlist.
  • ALLOWED_HOSTS and ALLOWED_ORIGINS: optional transport-security restrictions.

Use .env.example as the environment template and config/entities.example.yaml as the entity-map template. The example values are fictional and are safe to replace locally. Do not commit the resulting .env or config/entities.yaml files.

Run the server

python -m app.main

With the default settings, the MCP endpoint is available locally at:

http://127.0.0.1:8000/mcp

The repository also includes a generalized systemd unit in systemd/nara-mcp.service for a persistent Linux deployment.

Connect from ChatGPT

Place the server behind an authenticated HTTPS reverse proxy or tunnel that forwards to the local MCP service without opening the local port directly. The external URL must include the MCP path, for example:

https://mcp.example.invalid/mcp

Enable Developer Mode in ChatGPT, create a developer-mode app, enter the HTTPS MCP URL, and verify that ChatGPT discovers the 18 tools listed above. OpenAI's current connection flow is documented in Connect from ChatGPT.

Usage examples

After replacing the sample aliases with your own configuration, prompts can be as simple as:

What is the temperature in sample_room?
Give me a home health summary, including low batteries and the UPS.
Set sample_lamp to 40% brightness.

Tests

Install the requirements, then run:

pytest

The suite covers entity resolution, allowlist behavior, Home Assistant client requests, infrastructure summaries, climate and battery summaries, overnight history, light controls, OAuth metadata, and the MCP tool inventory.

How it was built

Nara Home MCP was directed by Juan Pedro, with Codex used for implementation and ChatGPT used for architecture, debugging, and documentation. It has been tested against a real Home Assistant installation.

Project status

The project is functional and used in a production home environment. It is presented here as a personal project, with fictional public configuration examples and deployment-specific data kept private.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选