1
0
Fork 0
mirror of https://github.com/nix-community/home-manager.git synced 2025-11-08 11:36:05 +01:00

opencode: add mcp module integration

This commit is contained in:
Thierry Delafontaine 2025-10-27 12:15:04 +01:00 committed by Austin Horstman
parent 083b20c1a0
commit c740351870
6 changed files with 202 additions and 8 deletions

View file

@ -11,4 +11,6 @@
opencode-mixed-content = ./mixed-content.nix;
opencode-themes-inline = ./themes-inline.nix;
opencode-themes-path = ./themes-path.nix;
opencode-mcp-integration = ./mcp-integration.nix;
opencode-mcp-integration-with-override = ./mcp-integration-with-override.nix;
}

View file

@ -0,0 +1,27 @@
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"context7": {
"enabled": true,
"headers": {
"CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
},
"type": "remote",
"url": "https://mcp.context7.com/mcp"
},
"custom-server": {
"enabled": true,
"type": "remote",
"url": "https://example.com"
},
"everything": {
"command": [
"custom-command"
],
"enabled": false,
"type": "local"
}
},
"model": "anthropic/claude-sonnet-4-20250514",
"theme": "opencode"
}

View file

@ -0,0 +1,48 @@
{
programs.mcp = {
enable = true;
servers = {
everything = {
command = "npx";
args = [
"-y"
"@modelcontextprotocol/server-everything"
];
};
context7 = {
url = "https://mcp.context7.com/mcp";
headers = {
CONTEXT7_API_KEY = "{env:CONTEXT7_API_KEY}";
};
};
};
};
programs.opencode = {
enable = true;
enableMcpIntegration = true;
settings = {
theme = "opencode";
model = "anthropic/claude-sonnet-4-20250514";
# User's custom MCP settings should override generated ones
mcp = {
everything = {
enabled = false; # Override to disable
command = [ "custom-command" ];
type = "local";
};
custom-server = {
enabled = true;
type = "remote";
url = "https://example.com";
};
};
};
};
nmt.script = ''
assertFileExists home-files/.config/opencode/config.json
assertFileContent home-files/.config/opencode/config.json \
${./mcp-integration-with-override.json}
'';
}

View file

@ -0,0 +1,30 @@
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"context7": {
"enabled": true,
"headers": {
"CONTEXT7_API_KEY": "{env:CONTEXT7_API_KEY}"
},
"type": "remote",
"url": "https://mcp.context7.com/mcp"
},
"disabled-server": {
"command": [
"echo",
"test"
],
"enabled": false,
"type": "local"
},
"everything": {
"command": [
"npx",
"-y",
"@modelcontextprotocol/server-everything"
],
"enabled": true,
"type": "local"
}
}
}

View file

@ -0,0 +1,36 @@
{
programs.mcp = {
enable = true;
servers = {
everything = {
command = "npx";
args = [
"-y"
"@modelcontextprotocol/server-everything"
];
};
context7 = {
url = "https://mcp.context7.com/mcp";
headers = {
CONTEXT7_API_KEY = "{env:CONTEXT7_API_KEY}";
};
};
disabled-server = {
command = "echo";
args = [ "test" ];
disabled = true;
};
};
};
programs.opencode = {
enable = true;
enableMcpIntegration = true;
};
nmt.script = ''
assertFileExists home-files/.config/opencode/config.json
assertFileContent home-files/.config/opencode/config.json \
${./mcp-integration.json}
'';
}