Add authenticated Home Assistant MCP to shared clients #340
No reviewers
Labels
No labels
area:authentication
area:flake-utilities
area:performance
area:tbd
host:chaos
host:cosmos
host:electra
host:fleet
host:lena
host:lyra
host:mass-storage
host:media1
host:nimmog-de
host:nova
host:pangolin
host:pangolin-vps
host:phone
host:router
host:vega
investigation
phase:cutover
phase:deploy
phase:mcp
phase:module
phase:packaging
phase:prep
phase:validation
priority:high
priority:medium
project:attic-postgres-lyra-rollout
project:auto-update-reliability
project:auto-update-remediation
project:declarative-purity-cleanup
project:external-review
project:fleet-boundary-cleanup
project:host-facts-refactor
project:lyra-nixos-deploy
project:lyra-service-stack-migration
project:nebula-mesh-network
project:nix-idioms-hygiene
project:nixos-build-deployment-pipeline
project:security-hardening
project:service-stack-migration
project:vega-sillytavern-cutover
project:wiki-rebuild
repo:numtide/flake-utils
repo:numtide/nix-auth
repo:numtide/nixos-passthru-cache
repo:numtide/nix-relay
service:auto-update
service:gitlab
service:hermes
service:mem0
service:nix
service:sillytavern
service:slskd
service:synthseek
service:tdarr
No milestone
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
nimmo/nixos-config!340
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/home-assistant-mcp"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.
Automated code review
Reviewed commit:
0ed509f0a46d11fafce51b35bb739fd5f774d3f7Verdict: 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-mcpmatches 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
Questions
Review limitations
git added before flake check); .gitignore contains no pattern that would exclude either path.Diff coverage
.sops.yaml: reviewed — included in a context-limited batchREADME.md: reviewed — included in a context-limited batchmodules/common/default-config.nix: reviewed — included in a context-limited batchmodules/mcp/default.nix: reviewed — included in a context-limited batchmodules/mcp/home-assistant.nix: reviewed — included in a context-limited batchsecrets/home-assistant-mcp.yaml: reviewed — included in a context-limited batchReview metadata
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.