nix: extraMcpServers http entries can read request headers from one file via headersHelper
This commit is contained in:
parent
62ab45297c
commit
53eed2a757
3 changed files with 79 additions and 1 deletions
|
|
@ -93,6 +93,23 @@ in
|
|||
`type = "http"`; ignored (leave `null`) for `"stdio"`.
|
||||
'';
|
||||
};
|
||||
headersFile = lib.mkOption {
|
||||
type = lib.types.nullOr lib.types.str;
|
||||
default = null;
|
||||
example = "/agents/janet/state/secrets/truth-headers.json";
|
||||
description = ''
|
||||
Absolute path (a string, never a nix path literal, which would
|
||||
copy the secret into the world-readable store) to a file holding
|
||||
a JSON object of request headers, e.g.
|
||||
`{"Authorization": "Bearer <token>"}`, for an `"http"` server
|
||||
that needs them. Rendered as claude's `headersHelper`
|
||||
(`cat <file>`), so the file is read when claude connects, on
|
||||
reconnect and after a 401/403: a rotated token needs no
|
||||
harness restart. A missing or non-JSON file leaves that server
|
||||
without headers (claude's own behaviour). `"http"` only; not
|
||||
applied to ACP agents.
|
||||
'';
|
||||
};
|
||||
allowedTools = lib.mkOption {
|
||||
type = lib.types.listOf lib.types.str;
|
||||
default = [ "*" ];
|
||||
|
|
@ -250,6 +267,10 @@ in
|
|||
assertion = spec.type != "stdio" || spec.command != null;
|
||||
message = "services.hyperhive.agent.extraMcpServers.${name}: type = \"stdio\" requires `command` to be set";
|
||||
}) config.services.hyperhive.agent.extraMcpServers
|
||||
++ lib.mapAttrsToList (name: spec: {
|
||||
assertion = spec.headersFile == null || (spec.type == "http" && lib.hasPrefix "/" spec.headersFile);
|
||||
message = "services.hyperhive.agent.extraMcpServers.${name}: headersFile needs type = \"http\" and an absolute path string";
|
||||
}) config.services.hyperhive.agent.extraMcpServers
|
||||
++ lib.mapAttrsToList (name: spec: {
|
||||
assertion = spec.type != "http" || spec.url != null;
|
||||
message = "services.hyperhive.agent.extraMcpServers.${name}: type = \"http\" requires `url` to be set";
|
||||
|
|
|
|||
Loading…
Reference in a new issue