ha-nexus-agent

ha-nexus-agent

MCP server for Home Assistant — 202 tools across 21 domains; full control of your smart home from Claude / Cursor / VS Code / any MCP client

Category
访问服务器

README

ha-nexus-agent

MCP server for Home Assistant — gives AI assistants full control over your smart home through 202 tools across 21 domains: entities (with bulk control + voice expose), automations & scripts (full CRUD + traces), blueprints, dashboards, helpers, areas, devices registry, calendar, todo lists, history, system management, YAML config files, git-based versioning, real-time WebSocket events, Energy Dashboard preferences, Zones (geofencing), Labels & Categories, fuzzy Search & Discovery, add-on management via Supervisor, and HACS integration.

Works with Claude Code CLI, Claude Desktop, VS Code, Cursor, Windsurf, OpenAI Codex CLI, Gemini CLI.


Installation — Home Assistant Add-on (recommended)

  1. In Home Assistant go to Settings → Add-ons → Add-on Store

  2. Click the three-dot menu (⋮) → Repositories

  3. Add:

    https://github.com/Fistacho/ha-nexus-agent
    
  4. Find Nexus Agent and click Install

  5. Click Start

  6. Click Open Web UI

The web UI shows your API key and generates ready-to-paste config for every MCP client. No manual token setup — the add-on connects to Home Assistant automatically.


Installation — Standalone (outside HA)

git clone https://github.com/Fistacho/ha-nexus-agent
cd ha-nexus-agent
pip install -r requirements.txt
cp .env.example .env
# Edit .env: set HA_URL and HA_TOKEN
python server.py

Open http://localhost:7123 to get your API key and MCP client configs.

Getting a Home Assistant token

  1. In HA go to Profile → Security → Long-Lived Access Tokens
  2. Click Create Token, name it nexus
  3. Paste as HA_TOKEN in .env

Connecting MCP clients

Open http://your-ha-ip:7123 after starting Nexus. The setup page generates the exact command or config snippet for each client — just copy and paste.

All SSE-based clients connect to:

http://your-ha-ip:7123/mcp?token=YOUR_API_KEY

Claude Code CLI

claude mcp add nexus --transport sse "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY" --scope user

OpenAI Codex CLI

codex mcp add nexus --url "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY"

Gemini CLI

gemini mcp add nexus --url "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY"

VS Code

Create .vscode/mcp.json:

{
  "servers": {
    "nexus": {
      "type": "sse",
      "url": "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY"
    }
  }
}

Cursor

Paste into ~/.cursor/mcp.json:

{
  "mcpServers": {
    "nexus": {
      "url": "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY",
      "type": "sse"
    }
  }
}

Windsurf

Paste into ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "nexus": {
      "url": "http://your-ha-ip:7123/mcp?token=YOUR_API_KEY",
      "type": "sse"
    }
  }
}

Claude Desktop (standalone, subprocess mode)

Paste into %APPDATA%/Claude/claude_desktop_config.json (Win) or ~/Library/Application Support/Claude/claude_desktop_config.json (Mac):

{
  "mcpServers": {
    "nexus": {
      "command": "python",
      "args": ["server.py"],
      "cwd": "/path/to/ha-nexus-agent",
      "env": {
        "HA_URL": "http://homeassistant.local:8123",
        "HA_TOKEN": "your_ha_token_here"
      }
    }
  }
}

Tip: Copy the exact config (with your real paths and key) from the Nexus web UI at http://your-ha-ip:7123.


Features

  • 202 MCP tools across 21 categories
  • Real-time WebSocket — subscribe to state changes, events and triggers live
  • Git versioning — every config change auto-committed with instant rollback
  • YAML validation before writing any config file
  • Setup web UI — auto-generates ready-to-use MCP config for every client
  • HA add-on native — one-click install from Add-on Store, no manual token setup
  • API key auth — MCP endpoint protected, token passed via URL query parameter

Tools overview

Category Count Examples
entities_* 17 list_entities, turn_on/off/toggle, bulk_control, set/get_entity_exposure (voice assistants)
services_* 19 call_service, send_notification, set_light_color, camera_snapshot, camera_record, persistent_notification create/dismiss
automations_* 21 list/trigger/enable/disable, get/set/delete_automation_config (full YAML CRUD), list/get_automation_traces (debug), same for scripts, scenes
blueprints_* 4 list, import from URL, delete, substitute (instantiate with inputs)
areas_* 8 list_areas, create_area, get_area_states, control_area
devices_* 4 list_devices, update_device (rename / move to area / disable), remove_device, list_devices_in_area
calendar_* 4 list_calendars, list_events, create_event, delete_event
todo_* 5 list_todo_lists, list_items, add_item, update_item, remove_item
helpers_* 11 set_input_boolean, set_input_number, start_timer, increment_counter
history_* 5 get_state_history, get_logbook, get_error_log
system_* 9 check_config, create_backup, restart_ha, list_integrations
dashboards_* 6 get_dashboard_config, add_card_to_view, add_view_to_dashboard
files_* 6 read_config_file, write_config_file, validate_yaml_content
git_* 11 git_commit_all, git_rollback_file, git_log, safe_write_with_checkpoint
ws_* 7 listen_state_changes, listen_events, subscribe_trigger
supervisor_* 20 list/install/start/stop/restart/update/uninstall add-ons, addon_logs, addon_options, backups (list/create/restore/delete), core/host info + restart
hacs_* 7 list/install/uninstall/update HACS repositories, add custom repository, list critical updates

Git versioning

Nexus keeps a git history of your HA config directory. Before every risky change, use git_safe_write_with_checkpoint — it commits the current state first, then applies the change. Roll back instantly if something breaks.

git_init_config()                                    # run once
git_safe_write_with_checkpoint("automations.yaml", new_content)
git_rollback_file("automations.yaml")                # undo single file
git_rollback_to_commit("abc1234")                    # full rollback
git_log(limit=10)                                    # see history

Environment variables

Variable Required Default Description
HA_URL Yes http://homeassistant.local:8123 Home Assistant URL
HA_TOKEN Standalone only Long-lived access token
SUPERVISOR_TOKEN Add-on only auto-injected Set automatically by HA
HA_CONFIG_PATH For git tools /config Path to HA config directory
NEXUS_API_KEY No auto-generated Pin to a specific API key
NEXUS_PORT No 7123 HTTP server port

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选