diff --git a/modules/programs/github-copilot-cli.nix b/modules/programs/github-copilot-cli.nix index c9971c1a0d..6ae2e52c33 100644 --- a/modules/programs/github-copilot-cli.nix +++ b/modules/programs/github-copilot-cli.nix @@ -22,17 +22,19 @@ let transformSingleServer = _name: server: let - base = removeAttrs server [ "disabled" ]; - withType = - if base ? type then - base - else if base ? url then - base // { type = "http"; } - else - base // { type = "local"; }; - withTools = if withType ? tools then withType else withType // { tools = [ "*" ]; }; + server' = removeAttrs server [ "disabled" ]; + type = server'.type or (if server' ? url then "http" else "local"); in - withTools; + server' + // { + inherit type; + } + // lib.optionalAttrs (type == "local") { + args = server'.args or [ ]; + } + // lib.optionalAttrs (!(server' ? tools)) { + tools = [ "*" ]; + }; transformedMcpServers = if cfg.enableMcpIntegration && config.programs.mcp.enable && config.programs.mcp.servers != { } then diff --git a/tests/modules/programs/github-copilot-cli/expected-mcp-integration-config.json b/tests/modules/programs/github-copilot-cli/expected-mcp-integration-config.json index 58ca793e9c..14d4b9a590 100644 --- a/tests/modules/programs/github-copilot-cli/expected-mcp-integration-config.json +++ b/tests/modules/programs/github-copilot-cli/expected-mcp-integration-config.json @@ -14,6 +14,14 @@ ], "type": "local" }, + "fetch": { + "args": [], + "command": "mcp-server-fetch", + "tools": [ + "*" + ], + "type": "local" + }, "filesystem": { "args": [ "-y", diff --git a/tests/modules/programs/github-copilot-cli/mcp-integration.nix b/tests/modules/programs/github-copilot-cli/mcp-integration.nix index a60fbee99b..d5f9e61d8f 100644 --- a/tests/modules/programs/github-copilot-cli/mcp-integration.nix +++ b/tests/modules/programs/github-copilot-cli/mcp-integration.nix @@ -36,6 +36,9 @@ DATABASE_URL = "postgresql://user:pass@localhost:5432/db"; }; }; + fetch = { + command = "mcp-server-fetch"; + }; disabled-server = { command = "disabled-cmd"; disabled = true;