Add authenticated Home Assistant MCP to shared clients #340

Merged
nimmo merged 2 commits from feat/home-assistant-mcp into main 2026-10-16 00:21:46 +01:00
Owner

Add Home Assistant to the shared MCP registry using its existing HTTP endpoint and a dedicated SOPS-backed bearer token. The entry enables automatically once its encrypted credential file is included, with configurable enable, URL and secret-file options.

The existing shared registry supplies Codex, OpenCode, Pi, Antigravity and Hermes formats. Documentation covers provisioning and client restarts. Credentials stay in SOPS and private runtime files/environment; no plaintext token is added to source or the Nix store.

Validation: fresh full nix flake check passed before publication. Supported enabled client formats were evaluated with dummy credentials across all four AI hosts. The operator previously ran just test on Electra, preserving igpu; runtime secret loading, authenticated MCP initialization and discovery of 21 tools succeeded. Zero tools or device actions were invoked. Electra's Codex, OpenCode, Pi and Antigravity entries were confirmed; Hermes rendering was validated, with live Hermes connection not yet exercised. Existing upstream stdenv deprecation warnings are unrelated.

Current-head automated review 94 is Ready to merge with zero findings or suggestions, and CI passed. Remaining: normal fleet deployment after merge. Closes #339; milestone 40, Home Assistant MCP Integration. The user authorized merging after clean review and passing checks before 04:00 BST on 16 October.

Add Home Assistant to the shared MCP registry using its existing HTTP endpoint and a dedicated SOPS-backed bearer token. The entry enables automatically once its encrypted credential file is included, with configurable enable, URL and secret-file options. The existing shared registry supplies Codex, OpenCode, Pi, Antigravity and Hermes formats. Documentation covers provisioning and client restarts. Credentials stay in SOPS and private runtime files/environment; no plaintext token is added to source or the Nix store. Validation: fresh full nix flake check passed before publication. Supported enabled client formats were evaluated with dummy credentials across all four AI hosts. The operator previously ran just test on Electra, preserving igpu; runtime secret loading, authenticated MCP initialization and discovery of 21 tools succeeded. Zero tools or device actions were invoked. Electra's Codex, OpenCode, Pi and Antigravity entries were confirmed; Hermes rendering was validated, with live Hermes connection not yet exercised. Existing upstream stdenv deprecation warnings are unrelated. Current-head automated review 94 is Ready to merge with zero findings or suggestions, and CI passed. Remaining: normal fleet deployment after merge. Closes #339; milestone 40, Home Assistant MCP Integration. The user authorized merging after clean review and passing checks before 04:00 BST on 16 October.
chore(mcp): provision encrypted Home Assistant client token
All checks were successful
Build and Push Attic Cache / test (pull_request) Successful in 1m31s
Build and Push Attic Cache / build (pull_request) Has been skipped
Build and Push Attic Cache / pin-lifecycle (pull_request) Has been skipped
Build and Push Attic Cache / remediate (pull_request) Has been skipped
Build and Push Attic Cache / notify-remediation (pull_request) Has been skipped
Build and Push Attic Cache / record-remediation-notify-failure (pull_request) Has been skipped
AI pull-request review / review (pull_request) Successful in 12m3s
0ed509f0a4
clankbot left a comment

Automated code review

Reviewed commit: 0ed509f0a46d11fafce51b35bb739fd5f774d3f7

Verdict: Ready to merge

No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory.

Overall assessment

Strict validation pass over the six changed files found no evidence-based defect. The new registry module modules/mcp/home-assistant.nix matches the established authenticated-HTTP pattern used by modules/mcp/kiwifs.nix and modules/mcp/navidrome.nix (name/enable/type=http/url/secretName/tokenEnvVar plus sopsSecrets with key "home-assistant/mcp/token", owner = user, mode = "0400"), and those attributes are exactly the ones consumed by modules/mcp/default.nix (tokenExports, agyMcpServers, opencodeMcp, standardMcpServers, hermesMcpServers, hermesEnv, codexEnsureSnippet), so no per-client override is required. The option block in modules/common/default-config.nix:208-227 sits inside the same nixosConfig.mcp attrset as the neighbouring forgejo/karakeep entries and mirrors the existing Redview gate (default = builtins.pathExists ...sopsFile, sopsFile default ../../secrets + "/home-assistant-mcp.yaml"). The new .sops.yaml creation rule at line 476 is not shadowed: no earlier path_regex in the ordered list (lines 24-464) matches secrets/home-assistant-mcp.yaml, and the broad secrets/.*.yaml$ fallback is at line 507. The seven age recipients embedded in secrets/home-assistant-mcp.yaml match the rule's key_groups literally against the keys: aliases (electra age1qkndq..., lena age1een3f..., vega age1206h9..., lyra age1sxaj9..., yubikey-nano5c age1yubikey1qf8kmph..., yubikey-5-nfc age1yubikey1q0srxtg..., provision-key age1vlc2ea...), and the file's nested structure home-assistant/mcp/token matches the declared secret key. Registry names remain unique across the 13 imported modules. The documented just edit-secrets-provisioning home-assistant-mcp matches justfiles/secrets.just:337 (NAME = path under secrets/ without .yaml). Hermes on Vega receives the token through sops.templates."hermes-env" (hermes.nix:179 injects mcp.hermesEnv), which is substituted by sops at template generation and does not require the secret to be in the narrow group-readable allowlist at hermes.nix:163-171 (Redview, KiwiFS and Navidrome tokens are absent from that list too), so no consumer needs updating. The two findings from the initial review were dropped: the default-config.nix 'enable = true without a staged file' item describes behaviour identical to the pre-existing Redview module and is already covered by README.md:208 and README.md:219-220 ('Stage the encrypted file before building'), and the secrets/README.md documentation-drift item is outside the changed files.

Blocking findings

None.

Important findings

None.

Suggestions

None.

Tests and validation

  • No configured deterministic checks.

Questions

  • The endpoint https://home.nimmog.uk/api/mcp appears only in README.md:207 and modules/common/default-config.nix:218; no route, ingress, container or service in the supplied tree defines home.nimmog.uk. Is that endpoint owned by an external/Pangolin setup whose path is stable, or should a repository route/ingress entry accompany this change?
  • Because secrets/home-assistant-mcp.yaml is added in this same change, builtins.pathExists is true immediately, so the entry becomes enabled on every host that imports the ai-agents/ai-runtime profiles rather than being opted in per host. Is fleet-wide enablement intended, or should specific hosts set nixosConfig.mcp.homeAssistant.enable = false?
  • No fixture check analogous to scripts/check-redview-mcp.nix exists for this entry; is that verification class expected for a new generic HTTP MCP module, or is ad-hoc evaluation sufficient? (Treated as a suggestion, not a defect: no repository rule in AGENTS.md mandates such a fixture.)

Review limitations

  • No Nix evaluation, flake check, test deployment, or repository code was executed; findings are from static reading of the supplied diff and checked-out files only.
  • The encrypted token and MAC in secrets/home-assistant-mcp.yaml cannot be decrypted or verified from supplied material; only the recipient key sets were compared textually against the .sops.yaml aliases.
  • Git tracking state could not be inspected with the supplied tools, so it is not verified that modules/mcp/home-assistant.nix and secrets/home-assistant-mcp.yaml are staged (AGENTS.md requires new .nix files to be git added before flake check); .gitignore contains no pattern that would exclude either path.
  • Reachability, authentication behaviour, and tool count of https://home.nimmog.uk/api/mcp are taken from the pull-request text, not from supplied repository evidence; no live client behaviour (Codex, OpenCode, Pi, Antigravity, Hermes) was observed.
  • Only the four hosts in hosts/ (electra, lena, vega, lyra) were checked against the SOPS rule; potential/nova imports modules/profiles/ai-agents.nix and would therefore also require this secret, but it is not registered in flake.nix and is not built by CI, and the same applies to the pre-existing ai-agents.yaml/redview-mcp secrets.
  • No access to the Forgejo issue, milestone, CI/attic-cache workflow output, or any branch/commit outside the supplied diff and checked-out tree.

Diff coverage

  • .sops.yaml: reviewed — included in a context-limited batch
  • README.md: reviewed — included in a context-limited batch
  • modules/common/default-config.nix: reviewed — included in a context-limited batch
  • modules/mcp/default.nix: reviewed — included in a context-limited batch
  • modules/mcp/home-assistant.nix: reviewed — included in a context-limited batch
  • secrets/home-assistant-mcp.yaml: reviewed — included in a context-limited batch
Review metadata
  • Reviewer: forgejo-ai-review v1
  • Model: strata/strata
  • Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md
  • Commits considered: 2
  • Previous automated review: none found
  • Findings: 0
<!-- forgejo-ai-review:v1 --> ## Automated code review Reviewed commit: `0ed509f0a46d11fafce51b35bb739fd5f774d3f7` ## Verdict: Ready to merge No blocking or important findings were retained, and deterministic checks passed. Suggestions remain advisory. ### Overall assessment Strict validation pass over the six changed files found no evidence-based defect. The new registry module modules/mcp/home-assistant.nix matches the established authenticated-HTTP pattern used by modules/mcp/kiwifs.nix and modules/mcp/navidrome.nix (name/enable/type=http/url/secretName/tokenEnvVar plus sopsSecrets with key "home-assistant/mcp/token", owner = user, mode = "0400"), and those attributes are exactly the ones consumed by modules/mcp/default.nix (tokenExports, agyMcpServers, opencodeMcp, standardMcpServers, hermesMcpServers, hermesEnv, codexEnsureSnippet), so no per-client override is required. The option block in modules/common/default-config.nix:208-227 sits inside the same nixosConfig.mcp attrset as the neighbouring forgejo/karakeep entries and mirrors the existing Redview gate (default = builtins.pathExists ...sopsFile, sopsFile default ../../secrets + "/home-assistant-mcp.yaml"). The new .sops.yaml creation rule at line 476 is not shadowed: no earlier path_regex in the ordered list (lines 24-464) matches secrets/home-assistant-mcp.yaml, and the broad secrets/.*\.yaml$ fallback is at line 507. The seven age recipients embedded in secrets/home-assistant-mcp.yaml match the rule's key_groups literally against the keys: aliases (electra age1qkndq..., lena age1een3f..., vega age1206h9..., lyra age1sxaj9..., yubikey-nano5c age1yubikey1qf8kmph..., yubikey-5-nfc age1yubikey1q0srxtg..., provision-key age1vlc2ea...), and the file's nested structure home-assistant/mcp/token matches the declared secret key. Registry names remain unique across the 13 imported modules. The documented `just edit-secrets-provisioning home-assistant-mcp` matches justfiles/secrets.just:337 (NAME = path under secrets/ without .yaml). Hermes on Vega receives the token through sops.templates."hermes-env" (hermes.nix:179 injects mcp.hermesEnv), which is substituted by sops at template generation and does not require the secret to be in the narrow group-readable allowlist at hermes.nix:163-171 (Redview, KiwiFS and Navidrome tokens are absent from that list too), so no consumer needs updating. The two findings from the initial review were dropped: the default-config.nix 'enable = true without a staged file' item describes behaviour identical to the pre-existing Redview module and is already covered by README.md:208 and README.md:219-220 ('Stage the encrypted file before building'), and the secrets/README.md documentation-drift item is outside the changed files. ### Blocking findings None. ### Important findings None. ### Suggestions None. ### Tests and validation - No configured deterministic checks. ### Questions - The endpoint https://home.nimmog.uk/api/mcp appears only in README.md:207 and modules/common/default-config.nix:218; no route, ingress, container or service in the supplied tree defines home.nimmog.uk. Is that endpoint owned by an external/Pangolin setup whose path is stable, or should a repository route/ingress entry accompany this change? - Because secrets/home-assistant-mcp.yaml is added in this same change, builtins.pathExists is true immediately, so the entry becomes enabled on every host that imports the ai-agents/ai-runtime profiles rather than being opted in per host. Is fleet-wide enablement intended, or should specific hosts set nixosConfig.mcp.homeAssistant.enable = false? - No fixture check analogous to scripts/check-redview-mcp.nix exists for this entry; is that verification class expected for a new generic HTTP MCP module, or is ad-hoc evaluation sufficient? (Treated as a suggestion, not a defect: no repository rule in AGENTS.md mandates such a fixture.) ### Review limitations - No Nix evaluation, flake check, test deployment, or repository code was executed; findings are from static reading of the supplied diff and checked-out files only. - The encrypted token and MAC in secrets/home-assistant-mcp.yaml cannot be decrypted or verified from supplied material; only the recipient key sets were compared textually against the .sops.yaml aliases. - Git tracking state could not be inspected with the supplied tools, so it is not verified that modules/mcp/home-assistant.nix and secrets/home-assistant-mcp.yaml are staged (AGENTS.md requires new .nix files to be `git add`ed before flake check); .gitignore contains no pattern that would exclude either path. - Reachability, authentication behaviour, and tool count of https://home.nimmog.uk/api/mcp are taken from the pull-request text, not from supplied repository evidence; no live client behaviour (Codex, OpenCode, Pi, Antigravity, Hermes) was observed. - Only the four hosts in hosts/ (electra, lena, vega, lyra) were checked against the SOPS rule; potential/nova imports modules/profiles/ai-agents.nix and would therefore also require this secret, but it is not registered in flake.nix and is not built by CI, and the same applies to the pre-existing ai-agents.yaml/redview-mcp secrets. - No access to the Forgejo issue, milestone, CI/attic-cache workflow output, or any branch/commit outside the supplied diff and checked-out tree. ### Diff coverage - `.sops.yaml`: **reviewed** — included in a context-limited batch - `README.md`: **reviewed** — included in a context-limited batch - `modules/common/default-config.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/default.nix`: **reviewed** — included in a context-limited batch - `modules/mcp/home-assistant.nix`: **reviewed** — included in a context-limited batch - `secrets/home-assistant-mcp.yaml`: **reviewed** — included in a context-limited batch <details><summary>Review metadata</summary> - Reviewer: forgejo-ai-review v1 - Model: strata/strata - Guidance loaded: .forgejo/ai-review.md, .forgejo/ai-review.yml, AGENTS.md, docs/auto-update-remediation.md, docs/hermes-fleet-ssh.md, docs/nova-remote-builder.md, README.md - Commits considered: 2 - Previous automated review: none found - Findings: 0 </details>
Author
Owner

Assessed review 94 for current head 0ed509f: Ready to merge, zero findings or suggestions. CI test and automated review workflow passed; no Codex fallback was needed.

Answers to the remaining questions: this change connects to the existing operator-provided Home Assistant endpoint, whose authenticated initialization and discovery already passed; it does not take ownership of Home Assistant ingress. Fleet-wide availability through the existing shared AI-client profiles is intentional, including Hermes, with a per-host disable option available. This module uses the existing generic HTTP adapters without adding transformation logic; enabled client rendering was checked with dummy credentials for all four AI hosts, followed by a successful Electra test activation and authenticated discovery. A duplicate permanent fixture is not necessary for this bounded registry addition.

No actionable feedback remains. Merging under the user's explicit authorization before 04:00 BST; normal fleet auto-update will apply the shared configuration.

Assessed review 94 for current head 0ed509f: Ready to merge, zero findings or suggestions. CI test and automated review workflow passed; no Codex fallback was needed. Answers to the remaining questions: this change connects to the existing operator-provided Home Assistant endpoint, whose authenticated initialization and discovery already passed; it does not take ownership of Home Assistant ingress. Fleet-wide availability through the existing shared AI-client profiles is intentional, including Hermes, with a per-host disable option available. This module uses the existing generic HTTP adapters without adding transformation logic; enabled client rendering was checked with dummy credentials for all four AI hosts, followed by a successful Electra test activation and authenticated discovery. A duplicate permanent fixture is not necessary for this bounded registry addition. No actionable feedback remains. Merging under the user's explicit authorization before 04:00 BST; normal fleet auto-update will apply the shared configuration.
nimmo merged commit d15b6bb654 into main 2026-10-16 00:21:46 +01:00
nimmo deleted branch feat/home-assistant-mcp 2026-10-16 00:21:47 +01:00
Sign in to join this conversation.
No reviewers
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
nimmo/nixos-config!340
No description provided.