dotacp.protocol
0.1.0-alpha.1
See the version list below for details.
dotnet add package dotacp.protocol --version 0.1.0-alpha.1
NuGet\Install-Package dotacp.protocol -Version 0.1.0-alpha.1
<PackageReference Include="dotacp.protocol" Version="0.1.0-alpha.1" />
<PackageVersion Include="dotacp.protocol" Version="0.1.0-alpha.1" />
<PackageReference Include="dotacp.protocol" />
paket add dotacp.protocol --version 0.1.0-alpha.1
#r "nuget: dotacp.protocol, 0.1.0-alpha.1"
#:package dotacp.protocol@0.1.0-alpha.1
#addin nuget:?package=dotacp.protocol&version=0.1.0-alpha.1&prerelease
#tool nuget:?package=dotacp.protocol&version=0.1.0-alpha.1&prerelease
dotacp - Agent Client Protocol .NET SDK
A comprehensive .NET implementation of the Agent Client Protocol (ACP), enabling seamless communication between code editors/IDEs and AI coding agents.
What is ACP?
The Agent Client Protocol is a standardized protocol for communication between code editors/IDEs and AI coding agents, similar to how the Language Server Protocol (LSP) standardized language server integration.
ACP solves the interoperability problem in AI-assisted coding:
- For Agents: Implement once, work with any compatible editor
- For Editors: Support any ACP-compatible agent without custom integrations
- For Developers: Choose the best combination of tools for your workflow
Key Benefits
- π Protocol Standardization: No more custom integrations per agent-editor pair
- ποΈ Decoupled Architecture: Agents and editors innovate independently
- π Local & Remote Support: Works with local subprocess agents and cloud-hosted services
- π¦ MCP Integration: Compatible with Model Context Protocol (MCP) for enhanced tool capabilities
Project Structure
This repository contains a complete .NET SDK implementation with the following components:
Core Projects
protocol/- Protocol definitions and data models- Auto-generated schema from the ACP specification (v0.10.8)
- Type-safe representations of all protocol messages
- Support for JSON-RPC communication patterns
- Contains type aliases, enums, request/response models, and content types
client/- Client library for implementing ACP clientsIAcpClient.cs- Core client interface definitionsConnection.cs- Connection management and lifecycleClientRpcTarget.cs- RPC message routing- Handles authentication, session management, and bidirectional communication
clientcli/- Example CLI client implementation- Demonstrates how to use the SDK to build an ACP client
- Reference implementation for developers
unittest/- Comprehensive test suite- Protocol conformance tests
- Integration tests
- Examples and usage patterns
generator/- Code generation utilities- Maintains type-safe protocol models
- Supports schema updates and evolution
Quick Start
Prerequisites
- .NET Framework: 4.7.2 or higher
- .NET Standard: 2.0 compatible
- Dependencies:
Newtonsoft.Jsonfor JSON serialization
Installation
Add the NuGet package to your project:
dotnet add package dotacp.protocol
dotnet add package dotacp.client
Or manually reference the project:
<ItemGroup>
<ProjectReference Include="path/to/client/client.csproj" />
<ProjectReference Include="path/to/protocol/protocol.csproj" />
</ItemGroup>
Basic Usage
1. Connect to Agent
// start the agent process
var process = ...
// connect
var connection = Connection.ConnectToAgent(
client,
process.StandardInput.BaseStream,
process.StandardOutput.BaseStream);
2. Initialize a Session
using dotacp.protocol;
using dotacp.client;
// Create a new session
var request = new NewSessionRequest
{
Cwd = "/path/to/project",
McpServers = new McpServer[] { }
};
var response = await client.NewSessionAsync(request);
var sessionId = response.SessionId;
3. Send a User Prompt
var promptRequest = new PromptRequest
{
SessionId = sessionId,
Prompt = new ContentBlock[]
{
new TextContent
{
Text = "Help me refactor this function to use async/await"
}
}
};
await client.PromptAsync(promptRequest);
3. Handle Session Updates
// Session notify through IAcpClient.SessionUpdateAsync
{
switch (notification.Update)
{
case Plan plan:
Console.WriteLine($"Agent plan: {plan.Entries.Length} tasks");
break;
case ToolCall toolCall:
Console.WriteLine($"Tool executing: {toolCall.Title}");
Console.WriteLine($"Status: {toolCall.Status}");
break;
case SessionUpdateAgentMessageChunk chunk:
Console.WriteLine($"Agent: {chunk.Content.Text}");
break;
// handle other update notification
}
};
4. Cancel Operations
var cancelNotification = new CancelNotification
{
SessionId = sessionId
};
await connection.CancelAsync(cancelNotification);
Architecture
Connection Lifecycle
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β Client Application β
ββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ
β
ββββββββΌβββββββ
β IAcpClient β
ββββββββ¬βββββββ
β
ββββββββββββββββββββΌβββββββββββββββββββ
β β β
ββββββΌβββββ βββββββΌββββββ ββββββΌβββββ
βSession β βConnection β β RPC β
βMgmt β βManagement β β Routing β
ββββββ¬βββββ βββββββ¬ββββββ ββββββ¬βββββ
β β β
ββββββββββββββββββββΌβββββββββββββββββββ
β
ββββββββββββΌββββββββββββ
β JSON-RPC Transport β
β(stdio/HTTP/WebSocket)β
ββββββββββββ¬ββββββββββββ
β
ββββββββΌβββββββ
β ACP Agent β
βββββββββββββββ
Message Flow
- Initialization: Client sends
initializerequest, agent responds with capabilities - Session Creation: Client creates session with
session/new - User Input: Client sends prompts via
session/prompt - Real-time Updates: Agent streams
session/updatenotifications - Tool Execution: Agent executes tools, client may request permissions
- Session Termination: Client cancels or closes session
Examples
Example 1: Interactive Chat Client
See clientcli/Client.cs for a complete example of building an interactive ACP client.
Contributing
Contributions are welcome! Please ensure:
- Code follows the existing style conventions
- All tests pass:
dotnet test - Changes maintain protocol compliance
- XML documentation is updated
Development
Build from Source
# Clone the repository
git clone https://github.com/timxx/dotacp.git
cd dotacp
# Build the solution
dotnet build
# Run tests
dotnet test
# Build release package
dotnet pack -c Release
Schema Generation
The protocol types are generated from the official ACP schema. To update:
# Generate from current schema
pwsh ./scripts/gen-schema.ps1
# Update to latest schema
pwsh ./scripts/gen-schema.ps1 -Version main -Force
Local CI-Style Build
For testing the CI build locally (with modern target frameworks), use the helper script:
# Build and test with modern TFMs enabled (default)
pwsh ./scripts/build-ci.ps1
# Debug build variant
pwsh ./scripts/build-ci.ps1 -Configuration Debug
# Disable modern TFMs (local dev mode)
pwsh ./scripts/build-ci.ps1 -EnableModernTargetFrameworks:$false
Target Frameworks
- Local/VS2019 default:
netstandard2.0;net472(unchanged, no new SDK required) - CI builds: Adds
net10.0;net9.0;net8.0forclientandprotocolonly - Activation: Set
/p:EnableCiTargetFrameworks=truein MSBuild or use the script above
References
- Agent Client Protocol Official Documentation
- Protocol Specification
- ACP GitHub Repository
- Model Context Protocol
License
This project is licensed under the MIT License. See LICENSE file for details.
Support
- π Documentation: https://agentclientprotocol.com/
- π Issues: https://github.com/timxx/dotacp/issues
Made with β€οΈ for the AI-assisted coding community
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 is compatible. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETFramework 4.7.2
- Newtonsoft.Json (>= 13.0.4)
-
.NETStandard 2.0
- Newtonsoft.Json (>= 13.0.4)
-
net10.0
- Newtonsoft.Json (>= 13.0.4)
-
net8.0
- Newtonsoft.Json (>= 13.0.4)
-
net9.0
- Newtonsoft.Json (>= 13.0.4)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on dotacp.protocol:
| Package | Downloads |
|---|---|
|
dotacp.client
This package provides the tools needed to integrate Agent Client Protocol (ACP) agent support into editors, IDEs, and other client applications. |
|
|
dotacp.agent
This package provides the tools needed to build Agent Client Protocol (ACP) agent implementations in .NET. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.5.10 | 187 | 5/10/2026 |
| 2026.3.18 | 181 | 3/18/2026 |
| 2026.3.12-beta.1 | 70 | 3/12/2026 |
| 0.1.0-beta.2 | 65 | 3/9/2026 |
| 0.1.0-beta.1 | 66 | 3/5/2026 |
| 0.1.0-alpha.4 | 63 | 3/3/2026 |
| 0.1.0-alpha.3 | 67 | 3/2/2026 |
| 0.1.0-alpha.2 | 66 | 3/2/2026 |
| 0.1.0-alpha.1 | 65 | 3/1/2026 |