How to persist security gated option in standalone mode? #1648
Replies: 2 comments 3 replies
|
The persistence code isn't add-on-specific – standalone mode persists too, it just resolves a different directory. Nothing is missing here. Two layers are involved: 1. The master toggle (
2. The policy rules themselves are saved to Where
So in standalone mode the files land in The likely NixOS catch: a hardened systemd unit ( The fix is to point ha-mcp at a persistent writable directory explicitly: # systemd service
StateDirectory=ha-mcp
Environment=HA_MCP_CONFIG_DIR=/var/lib/ha-mcpWith |
|
What do you mean by standalone mode? Are you running via Claude Desktop or another client that connects via stdio, or are you using a docker or container version of ha-mcp? There's a bit of difference between them. |

The persistence code isn't add-on-specific – standalone mode persists too, it just resolves a different directory. Nothing is missing here.
Two layers are involved:
1. The master toggle (
ENABLE_TOOL_SECURITY_POLICIES) is a regular feature flag. In standalone mode I can persist it either way:ENABLE_TOOL_SECURITY_POLICIES=true. An explicitly-set env var always wins, and this is the most declarative fit for a NixOS service.feature_flags.jsoninto the data directory (the stdio/standalone settings persistence landed in #1381).2. The policy rules themselves are saved to
tool_policy.jsonviasave_policy(data_dir)/load_policy(…