Skip to content

feat(mcp): MCP Notifications — real-time HA state push to connected AI clients #263

Description

@pgroene

Summary

Enable Kyber's MCP server to push real-time notifications to connected MCP clients (Claude, ChatGPT, Cursor) when Home Assistant state changes — without the client needing to poll.

What are MCP Notifications?

The MCP Notifications primitive allows the server to send unsolicited messages to the client when something changes. Examples: entity state changed, tool list updated, resource content changed.

Why it matters for Kyber

Scenario Today With Notifications
Front door opens at night Requires separate HA automation MCP client receives push → LLM decides what to do
Motion detected in an unexpected area Poll-based or webhook Client is notified instantly, can reason + act
New device added to HA Client has stale tool list \
otifications/tools/list_changed\ triggers refresh
Energy spike on a circuit Separate automation required Client notified → can suggest or take action
Calendar event starting in 5 min Manual reminder setup Kyber pushes context to AI client proactively

Proposed implementation

  • Subscribe to HA event bus for state changes on exposed entities
  • Emit
    otifications/resources/updated\ when the context snapshot changes significantly (debounced)
  • Emit
    otifications/tools/list_changed\ when exposed entities change (new device, removed entity)
  • Requires persistent connection — needs SSE or WebSocket transport (not the stateless Streamable HTTP path)
  • Add notification log to the MCP debug UI

Transport consideration

Notifications require a persistent connection. Options:

  1. SSE transport — Kyber already has MCP over HTTP; add SSE channel for server→client push
  2. WebSocket — more bidirectional, better for high-frequency state changes
  3. Streamable HTTP with server-sent events per MCP 2025-06-18 spec

Acceptance criteria

  • Connected client receives
    otifications/resources/updated\ when HA entity states change
  • Connected client receives
    otifications/tools/list_changed\ when exposed entity list changes
  • Notifications are debounced (not fired per individual state change in bulk updates)
  • Notifications appear in the MCP debug call log UI
  • Only exposed entities trigger notifications (respects entity filtering)
  • Graceful degradation when client doesn't support notifications

Notes

  • Neither HA's MCP nor Kyber currently supports this — a meaningful differentiator
  • This is the foundation for turning an external LLM into a proactive home agent (watches your home, not just answers questions)
  • Pairs well with MCP Sampling (feat(mcp): MCP Sampling — server-side LLM reasoning via connected client #262) — notify client of event → client uses sampling to reason about it → Kyber acts
  • Requires persistent transport; evaluate impact on the existing stateless /api/kyber/mcp\ endpoint

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestfeature-requestNew feature or requestseverity: highHigh — significant breakage, no workaroundtimeline: long-termLong-term — requires significant design or multiple PRs

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions