feat: Adds support for Cursor provider and other ACP backends
Summary
- While ACP is already supported for custom IDE integrations (
IDE/ACP-> OpenCode -> LLM), this adds support to use ACP as a backend LLM provider (OpenCode -> ACP) - Enables OpenCode to consume tokens from Cursor CLI for example while still using the regular OpenCode TUI.
- This is useful for folks who have Cursor subscriptions for example, but want to use OpenCode's (amazing!) TUI
- By enabling ACP as a backend provider, we don't need a uniq translation layer for OpenCode to multiple CLI backends
Resolves
- Closes #3735 - CLI Providers feature request
- Closes #2072 - Support for Cursor CLI
- Closes #402 - Gemini CLI support for free tier access
- Closes #5182
Implementation Details
Core Components
-
ACPClient (
client.ts) - Manages subprocess lifecycle and ACP protocol communication -
ACPLanguageModel (
model.ts) - Implements LanguageModelV2 interface with streaming support -
Message Converters (
converters.ts) - Bidirectional conversion between Vercel AI SDK and ACP message formats -
MCP Converter (
mcp-converter.ts) - Converts OpenCode MCP configurations to ACP format -
Provider Factory (
factory.ts) - Creates ACP provider instances from configuration
Key Features
- Full streaming support for real-time responses
- Tool execution, passes along MCP servers, which are executed by the ACP
- MCP server integration - OpenCode MCP servers exposed to ACP backends
- Proper subprocess lifecycle management and cleanup
- Comprehensive error handling
Testing
- Tested with cursor-agent integration
- Verified streaming responses
- Confirmed MCP server exposure to ACP backend
Documentation
- Added comprehensive README.md with setup instructions
- Includes configuration examples for cursor-agent, goose, and gemini-cli
- Documents architecture and design decisions
we already have acp support, whats this for
we already have acp support, whats this for
This is for an ACP backend provider. For example, if you have a cursor account, and you want to use Opencode TUI's interface, but you want it to use cursor CLI agent as it's backend LLM:
Right now we have: IDE via ACP -> OpenCode -> LLM Provider
With this change you can now do: OpenCode -> Cursor CLI via ACP
The ACP becomes the LLM provider as apposed to the frontend interface.
This is useful for folks who want to use OpenCode but already have a subscription for cursor.
They can now use OpenCode while comsuming their tokens from Cursor
okay i see
okay i see
Been using this all morning. It's pretty awesome to be able to use my Cursor subscription with OpenCode's best-in-class TUI!
Any chance this is something we can merge @rekram1-node?