diff --git a/registry/coder/modules/antigravity/main.test.ts b/registry/coder/modules/antigravity/main.test.ts index a0d6e5c7..f79bee38 100644 --- a/registry/coder/modules/antigravity/main.test.ts +++ b/registry/coder/modules/antigravity/main.test.ts @@ -99,6 +99,7 @@ describe("antigravity", async () => { it("writes ~/.gemini/antigravity/mcp_config.json when mcp provided", async () => { const id = await runContainer("alpine"); + try { const mcp = JSON.stringify({ servers: { demo: { url: "http://localhost:1234" } }, @@ -108,7 +109,7 @@ describe("antigravity", async () => { agent_id: "foo", mcp, }); - + const script = findResourceInstance( state, "coder_script", @@ -121,6 +122,7 @@ describe("antigravity", async () => { console.log(resp.stderr); } expect(resp.exitCode).toBe(0); + const content = await readFileContainer( id, "/root/.gemini/antigravity/mcp_config.json", diff --git a/registry/coder/modules/antigravity/main.tf b/registry/coder/modules/antigravity/main.tf index f54422e5..364f2e29 100644 --- a/registry/coder/modules/antigravity/main.tf +++ b/registry/coder/modules/antigravity/main.tf @@ -53,7 +53,7 @@ variable "display_name" { variable "mcp" { type = string description = "JSON-encoded string to configure MCP servers for Antigravity. When set, writes $HOME/.gemini/antigravity/mcp_config.json." - default = "" + default = null } data "coder_workspace" "me" {} @@ -73,7 +73,7 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - mcp_config = var.mcp + mcp_config = var.mcp != null ? jsondecode(var.mcp) : null # turn MCP JSON string into map(any) for vscode-desktop-core module protocol = "antigravity" config_folder = "$HOME/.gemini/antigravity" diff --git a/registry/coder/modules/cursor/main.test.ts b/registry/coder/modules/cursor/main.test.ts index fdba8501..3adbd885 100644 --- a/registry/coder/modules/cursor/main.test.ts +++ b/registry/coder/modules/cursor/main.test.ts @@ -79,7 +79,7 @@ describe("cursor", async () => { ); }); - it("writes ~/.cursor/mcp.json when mcp provided", async () => { + it("writes ~/.cursor/mcp.json when var.mcp provided", async () => { const id = await runContainer("alpine"); try { const mcp = JSON.stringify({ diff --git a/registry/coder/modules/cursor/main.tf b/registry/coder/modules/cursor/main.tf index 0c0f8aa2..fed2cf1d 100644 --- a/registry/coder/modules/cursor/main.tf +++ b/registry/coder/modules/cursor/main.tf @@ -53,7 +53,7 @@ variable "display_name" { variable "mcp" { type = string description = "JSON-encoded string to configure MCP servers for Cursor. When set, writes ~/.cursor/mcp.json." - default = "" + default = null } data "coder_workspace" "me" {} @@ -61,12 +61,11 @@ data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} locals { - mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : "" + mcp_b64 = var.mcp != null ? base64encode(var.mcp) : null } module "vscode-desktop-core" { - source = "registry.coder.com/coder/vscode-desktop-core/coder" - version = "1.0.0" + source = "git::https://github.com/coder/registry.git//registry/coder/modules/vscode-desktop-core?ref=phorcys/vscode-desktop-core-mcp" agent_id = var.agent_id @@ -78,11 +77,14 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - protocol = "cursor" + # TODO: set mcp_config instead of coder_script + + protocol = "cursor" + config_folder = "$HOME/.cursor" } resource "coder_script" "cursor_mcp" { - count = var.mcp != "" ? 1 : 0 + count = var.mcp != null ? 1 : 0 agent_id = var.agent_id display_name = "Cursor MCP" icon = "/icon/cursor.svg" diff --git a/registry/coder/modules/kiro/main.test.ts b/registry/coder/modules/kiro/main.test.ts index 608abf89..3fb4b850 100644 --- a/registry/coder/modules/kiro/main.test.ts +++ b/registry/coder/modules/kiro/main.test.ts @@ -58,7 +58,7 @@ describe("kiro", async () => { ); }); - it("writes ~/.kiro/settings/mcp.json when mcp provided", async () => { + it("writes ~/.kiro/settings/mcp.json when var.mcp provided", async () => { const id = await runContainer("alpine"); try { const mcp = JSON.stringify({ diff --git a/registry/coder/modules/kiro/main.tf b/registry/coder/modules/kiro/main.tf index c48364bc..3e13f8af 100644 --- a/registry/coder/modules/kiro/main.tf +++ b/registry/coder/modules/kiro/main.tf @@ -41,19 +41,18 @@ variable "group" { variable "mcp" { type = string description = "JSON-encoded string to configure MCP servers for Kiro. When set, writes ~/.kiro/settings/mcp.json." - default = "" + default = null } data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} locals { - mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : "" + mcp_b64 = var.mcp != null ? base64encode(var.mcp) : null } module "vscode-desktop-core" { - source = "registry.coder.com/coder/vscode-desktop-core/coder" - version = "1.0.0" + source = "git::https://github.com/coder/registry.git//registry/coder/modules/vscode-desktop-core?ref=phorcys/vscode-desktop-core-mcp" agent_id = var.agent_id @@ -65,11 +64,14 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - protocol = "kiro" + # TODO: set mcp_config instead of coder_script + + protocol = "kiro" + config_folder = "$HOME/.kiro" } resource "coder_script" "kiro_mcp" { - count = var.mcp != "" ? 1 : 0 + count = var.mcp != null ? 1 : 0 agent_id = var.agent_id display_name = "Kiro MCP" icon = "/icon/kiro.svg" diff --git a/registry/coder/modules/vscode-desktop/main.tf b/registry/coder/modules/vscode-desktop/main.tf index c9e6dd35..89315c7f 100644 --- a/registry/coder/modules/vscode-desktop/main.tf +++ b/registry/coder/modules/vscode-desktop/main.tf @@ -39,8 +39,7 @@ variable "group" { } module "vscode-desktop-core" { - source = "registry.coder.com/coder/vscode-desktop-core/coder" - version = "1.0.0" + source = "git::https://github.com/coder/registry.git//registry/coder/modules/vscode-desktop-core?ref=phorcys/vscode-desktop-core-mcp" agent_id = var.agent_id @@ -52,7 +51,9 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - protocol = "vscode" + + protocol = "vscode" + config_folder = "$HOME/.vscode" } output "vscode_url" { diff --git a/registry/coder/modules/windsurf/main.test.ts b/registry/coder/modules/windsurf/main.test.ts index 27e61039..2823edda 100644 --- a/registry/coder/modules/windsurf/main.test.ts +++ b/registry/coder/modules/windsurf/main.test.ts @@ -79,27 +79,32 @@ describe("windsurf", async () => { ); }); - it("writes ~/.codeium/windsurf/mcp_config.json when mcp provided", async () => { + it("writes ~/.codeium/windsurf/mcp_config.json when var.mcp is provided", async () => { const id = await runContainer("alpine"); + try { const mcp = JSON.stringify({ servers: { demo: { url: "http://localhost:1234" } }, }); + const state = await runTerraformApply(import.meta.dir, { agent_id: "foo", mcp, }); + const script = findResourceInstance( state, "coder_script", - "windsurf_mcp", + "vscode-desktop-mcp", // from "vscode-desktop-core" module ).script; + const resp = await execContainer(id, ["sh", "-c", script]); if (resp.exitCode !== 0) { console.log(resp.stdout); console.log(resp.stderr); } expect(resp.exitCode).toBe(0); + const content = await readFileContainer( id, "/root/.codeium/windsurf/mcp_config.json", diff --git a/registry/coder/modules/windsurf/main.tf b/registry/coder/modules/windsurf/main.tf index 3ec29d5b..903bdcbb 100644 --- a/registry/coder/modules/windsurf/main.tf +++ b/registry/coder/modules/windsurf/main.tf @@ -53,19 +53,14 @@ variable "display_name" { variable "mcp" { type = string description = "JSON-encoded string to configure MCP servers for Windsurf. When set, writes ~/.codeium/windsurf/mcp_config.json." - default = "" + default = null } data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} -locals { - mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : "" -} - module "vscode-desktop-core" { - source = "registry.coder.com/coder/vscode-desktop-core/coder" - version = "1.0.0" + source = "git::https://github.com/coder/registry.git//registry/coder/modules/vscode-desktop-core?ref=phorcys/vscode-desktop-core-mcp" agent_id = var.agent_id @@ -77,23 +72,10 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - protocol = "windsurf" -} + mcp_config = var.mcp != null ? jsondecode(var.mcp) : null # turn MCP JSON string into map(any) for vscode-desktop-core module -resource "coder_script" "windsurf_mcp" { - count = var.mcp != "" ? 1 : 0 - agent_id = var.agent_id - display_name = "Windsurf MCP" - icon = "/icon/windsurf.svg" - run_on_start = true - start_blocks_login = false - script = <<-EOT - #!/bin/sh - set -eu - mkdir -p "$HOME/.codeium/windsurf" - echo -n "${local.mcp_b64}" | base64 -d > "$HOME/.codeium/windsurf/mcp_config.json" - chmod 600 "$HOME/.codeium/windsurf/mcp_config.json" - EOT + protocol = "windsurf" + config_folder = "$HOME/.codeium/windsurf" } output "windsurf_url" { diff --git a/registry/cytoshahar/modules/positron/main.tf b/registry/cytoshahar/modules/positron/main.tf index 9365b444..793014d1 100644 --- a/registry/cytoshahar/modules/positron/main.tf +++ b/registry/cytoshahar/modules/positron/main.tf @@ -54,8 +54,7 @@ data "coder_workspace" "me" {} data "coder_workspace_owner" "me" {} module "vscode-desktop-core" { - source = "registry.coder.com/coder/vscode-desktop-core/coder" - version = "1.0.0" + source = "git::https://github.com/coder/registry.git//registry/coder/modules/vscode-desktop-core?ref=phorcys/vscode-desktop-core-mcp" agent_id = var.agent_id @@ -67,7 +66,9 @@ module "vscode-desktop-core" { folder = var.folder open_recent = var.open_recent - protocol = "positron" + + protocol = "positron" + config_folder = "$HOME/.positron" # TODO: verify this } output "positron_url" {