Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 21 additions & 4 deletions modules/nixos/llm/mcpjungle.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,24 @@ in {
};
};

systemd.timers.mcpjungle-register = lib.mkIf (cfg.servers != {}) {
description = "Trigger MCP server registration";
wantedBy = ["timers.target"];
# Re-trigger when server configuration changes
restartTriggers = [(builtins.hashString "sha256" (builtins.toJSON cfg.servers))];
timerConfig = {
OnActiveSec = "5s";
};
};

systemd.services.mcpjungle-register = lib.mkIf (cfg.servers != {}) {
description = "Register MCP servers with MCPJungle";
after = ["mcpjungle.service"];
requires = ["mcpjungle.service"];
wantedBy = ["multi-user.target"];
# Prevent NixOS activation from blocking on this oneshot
restartIfChanged = false;
serviceConfig = {
Type = "oneshot";
RemainAfterExit = true;
Type = "simple";
};
path = [pkgs.curl pkgs.envsubst];
script = let
Expand Down Expand Up @@ -150,9 +160,16 @@ in {
fi
'';

registrations = lib.concatStringsSep "\n" (lib.mapAttrsToList mkRegistration cfg.servers);
mkBackgroundRegistration = name: server: ''
(
${mkRegistration name server}
) &
'';

registrations = lib.concatStringsSep "\n" (lib.mapAttrsToList mkBackgroundRegistration cfg.servers);
in ''
${registrations}
wait
'';
};

Expand Down