acp.mdx 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. ---
  2. title: ACP Support
  3. description: Use OpenCode in any ACP-compatible editor.
  4. ---
  5. OpenCode supports the [Agent Client Protocol](https://agentclientprotocol.com) or (ACP), allowing you to use it directly in compatible editors and IDEs.
  6. :::tip
  7. For a list of editors and tools that support ACP, check out the [ACP progress report](https://zed.dev/blog/acp-progress-report#available-now).
  8. :::
  9. ACP is an open protocol that standardizes communication between code editors and AI coding agents.
  10. ---
  11. ## Configure
  12. To use OpenCode via ACP, configure your editor to run the `opencode acp` command.
  13. The command starts OpenCode as an ACP-compatible subprocess that communicates with your editor over JSON-RPC via stdio.
  14. Below are examples for popular editors that support ACP.
  15. ---
  16. ### Zed
  17. Add to your [Zed](https://zed.dev) configuration (`~/.config/zed/settings.json`):
  18. ```json title="~/.config/zed/settings.json"
  19. {
  20. "agent_servers": {
  21. "OpenCode": {
  22. "command": "opencode",
  23. "args": ["acp"]
  24. }
  25. }
  26. }
  27. ```
  28. To open it, use the `agent: new thread` action in the **Command Palette**.
  29. You can also bind a keyboard shortcut by editing your `keymap.json`:
  30. ```json title="keymap.json"
  31. [
  32. {
  33. "bindings": {
  34. "cmd-alt-o": [
  35. "agent::NewExternalAgentThread",
  36. {
  37. "agent": {
  38. "custom": {
  39. "name": "OpenCode",
  40. "command": {
  41. "command": "opencode",
  42. "args": ["acp"]
  43. }
  44. }
  45. }
  46. }
  47. ]
  48. }
  49. }
  50. ]
  51. ```
  52. ---
  53. ### Avante.nvim
  54. Add to your [Avante.nvim](https://github.com/yetone/avante.nvim) configuration:
  55. ```lua
  56. {
  57. acp_providers = {
  58. ["opencode"] = {
  59. command = "opencode",
  60. args = { "acp" }
  61. }
  62. }
  63. }
  64. ```
  65. If you need to pass environment variables:
  66. ```lua {6-8}
  67. {
  68. acp_providers = {
  69. ["opencode"] = {
  70. command = "opencode",
  71. args = { "acp" },
  72. env = {
  73. OPENCODE_API_KEY = os.getenv("OPENCODE_API_KEY")
  74. }
  75. }
  76. }
  77. }
  78. ```
  79. ---
  80. ## Support
  81. OpenCode works the same via ACP as it does in the terminal. All features are supported:
  82. :::note
  83. Some built-in slash commands like `/undo` and `/redo` are currently unsupported.
  84. :::
  85. - Built-in tools (file operations, terminal commands, etc.)
  86. - Custom tools and slash commands
  87. - MCP servers configured in your OpenCode config
  88. - Project-specific rules from `AGENTS.md`
  89. - Custom formatters and linters
  90. - Agents and permissions system