Forge
markdown4405de34
1# AgentClientProtocol for C#
2 Unofficial C# SDK for ACP (Agent Client Protocol) clients and agents
3
4[![NuGet](https://img.shields.io/nuget/v/AgentClientProtocol.svg)](https://www.nuget.org/packages/AgentClientProtocol)
5[![Releases](https://img.shields.io/github/release/nuskey8/acp-csharp.svg)](https://github.com/nuskey8/acp-csharp/releases)
6[![license](https://img.shields.io/badge/LICENSE-MIT-green.svg)](LICENSE)
7
8## What's Agent Client Protocol?
9
10Agent Client Protocol is a protocol proposed by Zed to standardize communication between code editors/IDEs and coding agents.
11
12> ACP solves this by providing a standardized protocol for agent-editor communication, similar to how the Language Server Protocol (LSP) standardized language server integration.
13
14Please refer to [the official documentation](https://agentclientprotocol.com/) for details.
15
16## Installation
17
18### .NET CLI
19
20```ps1
21dotnet add package AgentClientProtocol
22```
23
24### Package Manager
25
26```ps1
27Install-Package AgentClientProtocol
28```
29
30## Quick Start
31
32### Client
33
34```cs
35class ExampleClient : IAcpClient { ... }
36```
37
38```cs
39var client = new ExampleClient();
40
41using var conn = new ClientSideConnection( _ => client, reader, writer);
42
43conn.Open();
44
45var initResult = await conn.InitializeAsync(new InitializeRequest
46{
47 ProtocolVersion = 1,
48 ClientCapabilities = new ClientCapabilities
49 {
50 Fs = new FileSystemCapability
51 {
52 ReadTextFile = true,
53 WriteTextFile = true
54 }
55 }
56});
57
58Console.WriteLine($"Connected to agent (protocol v{initResult.ProtocolVersion})");
59```
60
61### Agent
62
63```cs
64class ExampleClient : IAcpAgent { ... }
65```
66
67```cs
68var agent = new ExampleAgent();
69using var conn = new AgentSideConnection(agent, reader, writer);
70conn.Open();
71
72await Task.Delay(-1);
73```
74
75## License
76
77This library is under the [MIT License](LICENSE).
View only · write via MCP/CIDE