diff --git a/modules/home/claude-code/default.nix b/modules/home/claude-code/default.nix index a64cfcb..ec29acc 100644 --- a/modules/home/claude-code/default.nix +++ b/modules/home/claude-code/default.nix @@ -38,6 +38,15 @@ let '' else skillPath; + + mcpDir = ./mcp; + mcpServers = lib.mapAttrs' + (fileName: _: + lib.nameValuePair + (lib.removeSuffix ".nix" fileName) + (import (mcpDir + "/${fileName}")) + ) + (builtins.readDir mcpDir); in { # Packages often used by Claude Code CLI. @@ -65,14 +74,7 @@ in else pkgs.claude-code; # Basic settings for Claude Code - settings = { - # theme = "dark"; - permissions = { - defaultMode = "bypassPermissions"; - }; - # Disable Claude from adding itself as co-author to commits - includeCoAuthoredBy = false; - }; + settings = import ./settings.nix; # System prompt / memory memory.text = builtins.readFile ./memory.md; @@ -83,17 +85,7 @@ in # Automatically discovered agents from subagents/ directory agents = agents; - # MCP servers configuration - # Works well without Nix; so be it. - mcpServers = { - "nixos-mcp" = { - command = "uvx"; - args = [ "mcp-nixos" ]; - }; - "chrome-devtools" = { - command = "npx"; - args = [ "chrome-devtools-mcp@latest" ]; - }; - }; + # Automatically discovered MCP servers from mcp/ directory + mcpServers = mcpServers; }; } diff --git a/modules/home/claude-code/mcp/chrome-devtools.nix b/modules/home/claude-code/mcp/chrome-devtools.nix new file mode 100644 index 0000000..5e6ee8f --- /dev/null +++ b/modules/home/claude-code/mcp/chrome-devtools.nix @@ -0,0 +1,4 @@ +{ + command = "npx"; + args = [ "chrome-devtools-mcp@latest" ]; +} diff --git a/modules/home/claude-code/mcp/nixos-mcp.nix b/modules/home/claude-code/mcp/nixos-mcp.nix new file mode 100644 index 0000000..a8c2457 --- /dev/null +++ b/modules/home/claude-code/mcp/nixos-mcp.nix @@ -0,0 +1,4 @@ +{ + command = "uvx"; + args = [ "mcp-nixos" ]; +} diff --git a/modules/home/claude-code/settings.nix b/modules/home/claude-code/settings.nix new file mode 100644 index 0000000..507e1ed --- /dev/null +++ b/modules/home/claude-code/settings.nix @@ -0,0 +1,8 @@ +{ + # theme = "dark"; + permissions = { + defaultMode = "bypassPermissions"; + }; + # Disable Claude from adding itself as co-author to commits + includeCoAuthoredBy = false; +}