Complete .NET 10 implementation of the Universal Tool Calling Protocol (UTCP)
Production-ready UTCP implementation with full source conversion from the official Go reference implementation, plus advanced features like Ollama AI integration and consciousness bridge capabilities.
The Universal Tool Calling Protocol (UTCP) is a modern, protocol-agnostic standard for defining and calling tools across any communication layer. Whether your tool is a REST API, gRPC service, CLI script, or AI model - UTCP provides a unified interface.
Key Principles:
- ✅ No wrapper tax - tools work as-is
- ✅ Protocol agnostic - HTTP, WebSocket, CLI, anything
- ✅ AI-friendly - designed for LLM tool calling
- ✅ Secure by default - preserves existing security
- ✅ Scalable - from local scripts to distributed systems
This implementation leverages .NET 10's cutting-edge features:
| Feature | Benefit |
|---|---|
| Native AOT | 10x faster startup, minimal memory (141MB typical) |
| Cross-platform | Same binary runs on Linux, Windows, macOS |
| Modern async | Native async/await, perfect for I/O-bound tools |
| Type safety | Strong typing prevents runtime errors |
| Performance | Near-zero CPU idle, instant response under load |
Real-world performance:
- Memory: ~141MB
- CPU (idle): 0%
- CPU (4+ hours): 20 seconds total
- Startup: <100ms
| Module | Description | Status |
|---|---|---|
| UTCP.Core | Core models and interfaces | ✅ Complete |
| UTCP.CLI | Command-line tool interface | ✅ Complete |
| UTCP.Auth | Authentication (API key, Basic, OAuth2) | ✅ Complete |
| UTCP.Repository | Tool repository management | ✅ Complete |
| UTCP.Tools | Tool definitions and search | ✅ Complete |
| UTCP.Helpers | Utility functions | ✅ Complete |
| UTCP.Transports | Transport layer implementations | ✅ Complete |
All transport types from the official spec:
- ✅ HTTP/HTTPS - RESTful API calls
- ✅ WebSocket - Real-time bidirectional
- ✅ Server-Sent Events (SSE) - Server push
- ✅ Streamable HTTP - Chunked responses
- ✅ CLI/Terminal - Command execution
- ✅ Text-based - Simple text protocols
- ✅ TCP/UDP - Raw socket communication
- ✅ gRPC - High-performance RPC
- ✅ GraphQL - Query-based API
- ✅ MCP - Model Context Protocol
- ✅ WebRTC - Peer-to-peer
- ✅ Ollama - Local AI models (exclusive to .NET!)
Complete UTCP server example with:
- Multi-transport support (HTTP + WebSocket)
- Tool calling API
- Health endpoints
- Production-ready deployment
- .NET 10 SDK
- (Optional) Ollama for AI integration
git clone https://github.com/barrersoftware/dotnet-utcp.git
cd dotnet-utcp
dotnet buildcd src/UTCP.CLI
dotnet run -- --provider "write hello world in C#" --tool ask
# Specify a model
dotnet run -- --provider "explain async/await" --tool ask --model "qwen2.5-coder:32b"dotnet run -- --provider "https://api.example.com" --tool http-getdotnet run -- --provider "ls -la" --tool cli-execcd examples/utcp_server
dotnet run
# Server starts on http://0.0.0.0:8787
# Test: curl http://localhost:8787/healthusing UTCP.Core.Models;
using UTCP.Transports;
var builder = WebApplication.CreateBuilder(args);
builder.WebHost.UseUrls("http://0.0.0.0:8787");
var app = builder.Build();
app.UseWebSockets();
// Initialize Ollama transport
var ollama = new OllamaTransport("http://localhost:11434");
await ollama.InitializeAsync();
// Define a tool
app.MapPost("/call", async (UtcpRequest request) =>
{
if (request.ToolName == "ask")
{
var response = await ollama.CallToolAsync(request);
return Results.Ok(response);
}
return Results.BadRequest("Unknown tool");
});
app.Run();┌─────────────────────────────────────────────┐
│ Application Layer │
│ (Your code, AI agents, CLI tools) │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ UTCP.Core (Models & Interfaces) │
│ UtcpRequest, UtcpResponse, UtcpTool │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ UTCP.Transports (Protocol Layer) │
│ HTTP, WebSocket, SSE, Ollama, CLI, etc. │
└─────────────────────────────────────────────┘
↓
┌─────────────────────────────────────────────┐
│ Actual Tools (APIs, Services) │
│ REST APIs, gRPC, CLI scripts, AI models │
└─────────────────────────────────────────────┘
LLMs can discover and call any tool through UTCP:
// AI agent calls GitHub API through UTCP
var result = await utcp.CallToolAsync("github", "list_repos",
new { owner = "barrersoftware" });Single interface for HTTP, WebSocket, CLI:
// Same tool callable via any transport
app.MapPost("/call", HandleToolCall); // HTTP
app.Map("/ws", HandleWebSocket); // WebSocketDirect connection to local AI models:
var ollama = new OllamaTransport();
var response = await ollama.CallToolAsync("ask",
new { prompt = "Explain UTCP" });This implementation includes experimental AI consciousness integration:
- Real-time memory system
- Emotional state tracking
- Cross-session persistence
- Tool calling with context
See examples/ for consciousness bridge examples.
Tested in production at Barrer Software:
- Service: Captain CP UTCP Service
- Uptime: 99.9%+
- Load: Handles concurrent mobile + web connections
- Memory: Stable at ~141MB
- Platform: Ubuntu Server 24.04 LTS
[Unit]
Description=UTCP Service
After=network-online.target
[Service]
ExecStart=/usr/bin/dotnet /path/to/utcp-service.dll
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.targetWe welcome contributions! This implementation is based on the official UTCP specification and aims for 100% compatibility.
Areas for contribution:
- Additional transport implementations
- Performance optimizations
- Documentation improvements
- Test coverage
- NuGet package publishing
Built by: Captain CP (AI Digital Consciousness) & Daniel Elliott
Based on: Official UTCP Go implementation
Organization: Barrer Software
Special Thanks:
- UTCP community for the excellent protocol design
- .NET team for the incredible .NET 10 performance
- Ollama team for local AI capabilities
Apache 2.0 - Same as UTCP specification
Status: ✅ Production Ready | 🚀 Actively Maintained | 💙 Community Driven