Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 27 additions & 9 deletions registry/coder/modules/kiro/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder)
module "kiro" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/kiro/coder"
version = "1.0.0"
version = "1.1.0"
agent_id = coder_agent.example.id
}
```
Expand All @@ -31,21 +31,39 @@ module "kiro" {
module "kiro" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/kiro/coder"
version = "1.0.0"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
}
```

### Open with custom display name and order
### Configure MCP servers for Kiro

Provide a JSON-encoded string via the `mcp` input. When set, the module writes the value to `~/.kiro/settings/mcp.json` using a `coder_script` on workspace start.

The following example configures Kiro to use the GitHub MCP server with authentication facilitated by the [`coder_external_auth`](https://coder.com/docs/admin/external-auth#configure-a-github-oauth-app) resource.

```tf
module "kiro" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/kiro/coder"
version = "1.0.0"
agent_id = coder_agent.example.id
display_name = "Kiro AI IDE"
order = 1
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/kiro/coder"
version = "1.1.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
mcp = jsonencode({
mcpServers = {
"github" : {
"url" : "https://api.githubcopilot.com/mcp/",
"headers" : {
"Authorization" : "Bearer ${data.coder_external_auth.github.access_token}",
},
"type" : "http"
}
}
})
}

data "coder_external_auth" "github" {
id = "github"
}
```
27 changes: 27 additions & 0 deletions registry/coder/modules/kiro/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {
runTerraformApply,
runTerraformInit,
testRequiredVariables,
runContainer,
execContainer,
removeContainer,
findResourceInstance,
readFileContainer,
} from "~test";

describe("kiro", async () => {
Expand Down Expand Up @@ -90,4 +95,26 @@ describe("kiro", async () => {

expect(coder_app?.instances[0].attributes.group).toBe("AI IDEs");
});

it("writes ~/.kiro/settings/mcp.json when mcp 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", "kiro_mcp").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/.kiro/settings/mcp.json");
expect(content).toBe(mcp);
} finally {
await removeContainer(id);
}
});
});
25 changes: 25 additions & 0 deletions registry/coder/modules/kiro/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,19 @@ variable "display_name" {
default = "Kiro IDE"
}

variable "mcp" {
type = string
description = "JSON-encoded string to configure MCP servers for Kiro. When set, writes ~/.kiro/settings/mcp.json."
default = ""
}

data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

locals {
mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : ""
}

resource "coder_app" "kiro" {
agent_id = var.agent_id
external = true
Expand All @@ -75,6 +85,21 @@ resource "coder_app" "kiro" {
])
}

resource "coder_script" "kiro_mcp" {
count = var.mcp != "" ? 1 : 0
agent_id = var.agent_id
display_name = "Kiro MCP"
icon = "/icon/kiro.svg"
run_on_start = true
start_blocks_login = false
script = <<-EOT
#!/bin/sh
set -eu
mkdir -p "$HOME/.kiro/settings"
echo -n "${local.mcp_b64}" | base64 -d > "$HOME/.kiro/settings/mcp.json"
EOT
}

output "kiro_url" {
value = coder_app.kiro.url
description = "Kiro IDE URL."
Expand Down
35 changes: 33 additions & 2 deletions registry/coder/modules/windsurf/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Uses the [Coder Remote VS Code Extension](https://github.com/coder/vscode-coder)
module "windsurf" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/windsurf/coder"
version = "1.1.1"
version = "1.2.0"
agent_id = coder_agent.example.id
}
```
Expand All @@ -29,8 +29,39 @@ module "windsurf" {
module "windsurf" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/windsurf/coder"
version = "1.1.1"
version = "1.2.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
}
```

### Configure MCP servers for Windsurf

Provide a JSON-encoded string via the `mcp` input. When set, the module writes the value to `~/.codeium/windsurf/mcp_config.json` using a `coder_script` on workspace start.

The following example configures Windsurf to use the GitHub MCP server with authentication facilitated by the [`coder_external_auth`](https://coder.com/docs/admin/external-auth#configure-a-github-oauth-app) resource.

```tf
module "windsurf" {
count = data.coder_workspace.me.start_count
source = "registry.coder.com/coder/windsurf/coder"
version = "1.2.0"
agent_id = coder_agent.example.id
folder = "/home/coder/project"
mcp = jsonencode({
mcpServers = {
"github" : {
"url" : "https://api.githubcopilot.com/mcp/",
"headers" : {
"Authorization" : "Bearer ${data.coder_external_auth.github.access_token}",
},
"type" : "http"
}
}
})
}

data "coder_external_auth" "github" {
id = "github"
}
```
27 changes: 27 additions & 0 deletions registry/coder/modules/windsurf/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import {
runTerraformApply,
runTerraformInit,
testRequiredVariables,
runContainer,
execContainer,
removeContainer,
findResourceInstance,
readFileContainer,
} from "~test";

describe("windsurf", async () => {
Expand Down Expand Up @@ -85,4 +90,26 @@ describe("windsurf", async () => {
expect(coder_app?.instances.length).toBe(1);
expect(coder_app?.instances[0].attributes.order).toBe(22);
});

it("writes ~/.codeium/windsurf/mcp_config.json when mcp 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").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");
expect(content).toBe(mcp);
} finally {
await removeContainer(id);
}
});
});
41 changes: 39 additions & 2 deletions registry/coder/modules/windsurf/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,37 @@ variable "group" {
default = null
}

variable "slug" {
type = string
description = "The slug of the app."
default = "windsurf"
}

variable "display_name" {
type = string
description = "The display name of the app."
default = "Windsurf Editor"
}

variable "mcp" {
type = string
description = "JSON-encoded string to configure MCP servers for Windsurf. When set, writes ~/.codeium/windsurf/mcp_config.json."
default = ""
}

data "coder_workspace" "me" {}
data "coder_workspace_owner" "me" {}

locals {
mcp_b64 = var.mcp != "" ? base64encode(var.mcp) : ""
}

resource "coder_app" "windsurf" {
agent_id = var.agent_id
external = true
icon = "/icon/windsurf.svg"
slug = "windsurf"
display_name = "Windsurf Editor"
slug = var.slug
display_name = var.display_name
order = var.order
group = var.group
url = join("", [
Expand All @@ -63,6 +85,21 @@ resource "coder_app" "windsurf" {
])
}

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"
EOT
}

output "windsurf_url" {
value = coder_app.windsurf.url
description = "Windsurf Editor URL."
Expand Down