2.home-manager/tests/modules/programs/claude-code/mcp-integration.nix
Thierry Delafontaine 83bcb17377
Some checks failed
/ triage (push) Has been cancelled
GitHub Pages / publish (ubuntu-latest) (push) Has been cancelled
claude-code: add enableMcpIntegration
Add `enableMcpIntegration` option to merge MCP servers from
`programs.mcp.servers` into Claude Code configuration. Claude Code
servers take precedence over general MCP servers when both define
the same server name.
2026-01-17 21:33:01 -06:00

72 lines
1.6 KiB
Nix

{ config, ... }:
{
programs = {
claude-code = {
package = config.lib.test.mkStubPackage {
name = "claude-code";
buildScript = ''
mkdir -p $out/bin
touch $out/bin/claude
chmod 755 $out/bin/claude
'';
};
enable = true;
enableMcpIntagretion = true;
mcpServers = {
github = {
type = "http";
url = "https://api.githubcopilot.com/mcp/";
};
filesystem = {
type = "stdio";
command = "npx";
args = [
"-y"
"@modelcontextprotocol/server-filesystem"
"/tmp"
];
};
};
};
mcp = {
enable = true;
servers = {
filesystem = {
type = "stdio";
command = "npx";
args = [
"-y"
"@modelcontextprotocol/server-filesystem"
"/other-tmp"
];
};
database = {
command = "npx";
args = [
"-y"
"@bytebase/dbhub"
"--dsn"
"postgresql://user:pass@localhost:5432/db"
];
env = {
DATABASE_URL = "postgresql://user:pass@localhost:5432/db";
};
};
customTransport = {
type = "websocket";
url = "wss://example.com/mcp";
customOption = "value";
timeout = 5000;
};
};
};
};
nmt.script = ''
normalizedWrapper=$(normalizeStorePaths home-path/bin/claude)
assertFileContent $normalizedWrapper ${./expected-mcp-wrapper}
'';
}