Atif Ali d9b223ac3c
feat(zed): settings input and MCP servers example (#317)
This PR adds an optional `settings` input to the Zed module and updates
the README with an example for configuring MCP servers.

Changes:
- Add `settings` variable to modules/zed/main.tf
- Add `coder_script` to write/merge `~/.config/zed/settings.json`
(respects `$XDG_CONFIG_HOME` and merges with existing settings if `jq`
is available)
- Update README with a `settings` example configuring MCP context
servers and clarify default settings path

Test plan:
- Syntax-only: `bun test --filter zed` fails in CI without Terraform;
this change only adds inputs and a startup script. No behavior change to
existing outputs.

Co-authored-by: Atif Ali <10648092+matifali@users.noreply.github.com>

---------

Co-authored-by: blink-so[bot] <211532188+blink-so[bot]@users.noreply.github.com>
Co-authored-by: DevCats <christofer@coder.com>
2025-08-12 20:26:28 -05:00
..

display_name description icon verified tags
Zed Add a one-click button to launch Zed ../../../../.icons/zed.svg true
ide
zed
editor

Zed

Add a button to open any workspace with a single click in Zed.

Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Important

Zed needs you to either have Coder CLI installed with coder config-ssh run or Coder Desktop

module "zed" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/zed/coder"
  version  = "1.1.0"
  agent_id = coder_agent.example.id
}

Examples

Open in a specific directory

module "zed" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/zed/coder"
  version  = "1.1.0"
  agent_id = coder_agent.example.id
  folder   = "/home/coder/project"
}

Custom display name and order

module "zed" {
  count        = data.coder_workspace.me.start_count
  source       = "registry.coder.com/coder/zed/coder"
  version      = "1.1.0"
  agent_id     = coder_agent.example.id
  display_name = "Zed Editor"
  order        = 1
}

With custom agent name

module "zed" {
  count      = data.coder_workspace.me.start_count
  source     = "registry.coder.com/coder/zed/coder"
  version    = "1.1.0"
  agent_id   = coder_agent.example.id
  agent_name = coder_agent.example.name
}

Configure Zed settings including MCP servers

Zed stores settings at ~/.config/zed/settings.json by default. If XDG_CONFIG_HOME is set on Linux, settings will be at $XDG_CONFIG_HOME/zed/settings.json.

You can declaratively set/merge settings with the settings input. Provide a JSON string (e.g., via jsonencode(...)). For example, to configure MCP servers:

module "zed" {
  count    = data.coder_workspace.me.start_count
  source   = "registry.coder.com/coder/zed/coder"
  version  = "1.1.0"
  agent_id = coder_agent.example.id

  settings = jsonencode({
    context_servers = {
      your-mcp-server = {
        source  = "custom"
        command = "some-command"
        args    = ["arg-1", "arg-2"]
        env     = {}
      }
    }
  })
}

See Zeds settings files documentation: https://zed.dev/docs/configuring-zed#settings-files