HiveLLM.Umicp
0.2.2
dotnet add package HiveLLM.Umicp --version 0.2.2
NuGet\Install-Package HiveLLM.Umicp -Version 0.2.2
<PackageReference Include="HiveLLM.Umicp" Version="0.2.2" />
<PackageVersion Include="HiveLLM.Umicp" Version="0.2.2" />
<PackageReference Include="HiveLLM.Umicp" />
paket add HiveLLM.Umicp --version 0.2.2
#r "nuget: HiveLLM.Umicp, 0.2.2"
#:package HiveLLM.Umicp@0.2.2
#addin nuget:?package=HiveLLM.Umicp&version=0.2.2
#tool nuget:?package=HiveLLM.Umicp&version=0.2.2
๐ UMICP C# SDK
Production-Ready C# bindings for the Universal Matrix Intelligent Communication Protocol (UMICP) with MCP-compatible tool discovery
๐ What is UMICP?
UMICP enables efficient inter-model communication between AI systems with:
- ๐ High Performance: Sub-millisecond latency, >10,000 msg/sec throughput
- ๐ Secure: Envelope-based secure communication with capability negotiation
- ๐ฆ Efficient: Binary protocol with optional compression
- โก Real-time: WebSocket transport with HTTP support
- ๐ค Peer-to-Peer: True multiplexed architecture - each peer is server AND client
- ๐ง Tool Discovery: MCP-compatible automatic tool introspection with JSON Schema
๐ ๏ธ Installation
NuGet Package (Coming Soon)
dotnet add package Umicp
Build from Source
git clone https://github.com/hivellm/umicp.git
cd umicp/bindings/csharp
dotnet build
dotnet test
๐ Quick Start
๐ Custom Endpoint Support (v0.2.2)
using Umicp.Core.Transport;
// C# HttpClient supports custom endpoints via method parameters
var client = new HttpClient("http://localhost:8000");
// Send to Vectorizer endpoint
var response = await client.PostAsync<Envelope>("/umicp", envelope);
// Send to standard UMICP endpoint
var response2 = await client.PostAsync<Envelope>("/message", envelope);
๐ง Tool Discovery (v0.2.0)
using Umicp.Core.ToolDiscovery;
using System.Text.Json;
// Implement discoverable service
public class MyService : IDiscoverableService
{
public List<OperationSchema> ListOperations()
{
return new List<OperationSchema>
{
new OperationSchema(
"search_vectors",
JsonDocument.Parse(@"{
""type"": ""object"",
""properties"": {
""query"": {""type"": ""string""},
""limit"": {""type"": ""integer"", ""default"": 10}
},
""required"": [""query""]
}").RootElement
)
.WithTitle("Search Vectors")
.WithDescription("Search for semantically similar content")
.WithAnnotations(JsonDocument.Parse(@"{""read_only"": true}").RootElement)
};
}
public ServerInfo GetServerInfo()
{
return new ServerInfo("my-service", "1.0.0", "UMICP/0.2")
.WithFeatures(new List<string> { "discovery", "search" })
.WithMcpCompatible(true);
}
}
// Use discovery helpers
var service = new MyService();
var operationsResponse = DiscoveryHelpers.GenerateOperationsResponse(service);
var schemaResponse = DiscoveryHelpers.GenerateSchemaResponse(service, "search_vectors");
var infoResponse = DiscoveryHelpers.GenerateServerInfoResponse(service);
Basic Envelope Creation
using Umicp.Core;
using Umicp.Core.Types;
// Create an envelope
var envelope = new Envelope(
fromId: "client-001",
toId: "server-001",
operation: OperationType.Data
);
// Serialize to JSON
var json = envelope.ToJson();
Console.WriteLine(json);
// Using builder pattern
var builtEnvelope = new EnvelopeBuilder()
.FromId("client-001")
.ToId("server-001")
.Operation(OperationType.Request)
.Capability("version", "1.0.0")
.Build();
Matrix Operations (SIMD Accelerated)
using Umicp.Core;
// Dot product
var a = new float[] { 1.0f, 2.0f, 3.0f };
var b = new float[] { 4.0f, 5.0f, 6.0f };
var result = Matrix.DotProduct(a, b); // 32.0
// Cosine similarity
var similarity = Matrix.CosineSimilarity(a, b);
// Matrix operations
var sum = Matrix.Add(a, b);
var scaled = Matrix.Scale(a, 2.0f);
var distance = Matrix.EuclideanDistance(a, b);
WebSocket Client
using Umicp.Core.Transport;
using Umicp.Core.Events;
// Create WebSocket client
using var client = new WebSocketClient("ws://localhost:8080");
// Subscribe to events
client.Events.On(EventType.Connect, evt =>
{
Console.WriteLine("Connected!");
});
client.Events.On(EventType.DataReceived, evt =>
{
var data = evt.Data["data"];
Console.WriteLine($"Received: {data}");
});
// Connect and send data
await client.ConnectAsync();
await client.SendTextAsync("Hello, UMICP!");
Multiplexed Peer
using Umicp.Core.Peer;
// Create a peer
var peer = new MultiplexedPeer(
localId: "peer-001",
capabilities: new Dictionary<string, object>
{
["version"] = "1.0.0",
["features"] = new[] { "chat", "file-transfer" }
}
);
// Add another peer
var peerInfo = new PeerInfo("peer-002", "ws://localhost:8081");
await peer.AddPeerAsync(peerInfo);
// Send message to specific peer
var message = new EnvelopeBuilder()
.FromId(peer.LocalId)
.ToId("peer-002")
.Operation(OperationType.Data)
.Capability("message", "Hello!")
.Build();
await peer.SendToPeerAsync("peer-002", message);
// Broadcast to all peers
await peer.BroadcastAsync(message);
Service Discovery
using Umicp.Core.Discovery;
// Create service discovery
using var discovery = new ServiceDiscovery(
heartbeatInterval: TimeSpan.FromSeconds(10),
serviceTimeout: TimeSpan.FromSeconds(30)
);
// Register a service
var service = new ServiceInfo
{
Id = "service-001",
Name = "API Gateway",
Type = "gateway",
Endpoint = "http://localhost:3000"
};
discovery.RegisterService(service);
// Find services
var gateways = discovery.FindByType("gateway");
var healthyServices = discovery.FindHealthyServices();
// Heartbeat
discovery.Heartbeat("service-001");
Connection Pool
using Umicp.Core.Pool;
// Create connection pool
var config = new PoolConfig
{
MinConnections = 2,
MaxConnections = 10,
ConnectionTimeout = TimeSpan.FromSeconds(30)
};
using var pool = new ConnectionPool("ws://localhost:8080", config);
await pool.InitializeAsync();
// Execute with pooled connection
await pool.ExecuteAsync(async connection =>
{
await connection.SendTextAsync("Hello from pool!");
});
Console.WriteLine($"Pool stats:");
Console.WriteLine($" Total: {pool.TotalConnections}");
Console.WriteLine($" Available: {pool.AvailableConnections}");
Console.WriteLine($" Active: {pool.ActiveConnections}");
๐ฆ Features
โ Core Features
- Protocol: Binary envelope-based communication with capability negotiation
- Transport: WebSocket client/server, HTTP client/server
- Multiplexed Architecture: Each peer functions as server AND client simultaneously
- Message Types: CONTROL, DATA, ACK, ERROR, REQUEST, RESPONSE operations
- Payload Types: Vector, Text, Metadata, Binary, JSON, Matrix data support
- Matrix Operations: SIMD-accelerated dot product, cosine similarity, matrix multiplication
- Compression: Gzip and Deflate compression with automatic detection and efficiency metrics
- Event-Driven API: Observer pattern with EventEmitter
- Peer Discovery: Automatic handshake (HELLO โ ACK) with metadata exchange
- Service Discovery: Automatic service registration and discovery with health checks
- Connection Pooling: Efficient connection management with automatic scaling
- Server Support: Production-ready WebSocket and HTTP servers with multi-client handling
๐ฏ Feature Matrix
| Feature | Status |
|---|---|
| Envelope/Frame | โ |
| Serialization (JSON) | โ |
| Message Types | โ |
| Payload Types | โ |
| Matrix Operations | โ (SIMD) |
| WebSocket Client | โ |
| HTTP Client | โ |
| WebSocket Server | โ |
| HTTP Server | โ |
| Multiplexed Peer | โ |
| Event System | โ |
| Service Discovery | โ |
| Connection Pooling | โ |
| Compression | โ (Gzip/Deflate) |
| Security/Encryption | ๐ |
Legend: โ Implemented | ๐ง In Progress | ๐ Planned
๐ Documentation
Comprehensive documentation and review reports are available in the docs directory:
- Executive Summary - High-level overview for stakeholders
- Technical Report - Detailed technical implementation
- Implementation Review - Comprehensive code review
- Test Coverage Report - Testing analysis and coverage
- Final Report - Consolidated evaluation
- Second Review - Risk assessment and recommendations
- Third Review - Developer experience and NuGet readiness
๐ Examples
Check the Examples directory for comprehensive examples:
- 01_BasicEnvelope.cs - Envelope creation and serialization
- 02_MatrixOperations.cs - SIMD-accelerated matrix operations
- 03_WebSocketClient.cs - WebSocket client usage
- 04_MultiplexedPeer.cs - Peer-to-peer communication
- 05_ServiceDiscovery.cs - Service registration and discovery
- 06_Compression.cs - Data compression with Gzip and Deflate
- 07_WebSocketServer.cs - Multi-client WebSocket server
- 08_HttpServer.cs - HTTP server with routing
Run examples:
cd Umicp.Examples
dotnet run
๐งช Testing
Run unit tests:
cd Umicp.Tests
dotnet test
Run with coverage:
dotnet test /p:CollectCoverage=true /p:CoverletOutputFormat=opencover
๐ Performance
- SIMD Acceleration: Matrix operations use
System.Numerics.Vectorsfor hardware acceleration - Zero-Copy: Efficient memory management with minimal allocations
- Async/Await: Full async support throughout the API
- Connection Pooling: Reduces connection overhead with intelligent pooling
๐๏ธ Architecture
Umicp.Core/
โโโ Types/ # Core type definitions
โ โโโ OperationType.cs
โ โโโ PayloadType.cs
โ โโโ EncodingType.cs
โ โโโ ConnectionState.cs
โ โโโ PayloadHint.cs
โ โโโ TransportStats.cs
โโโ Exceptions/ # Exception classes
โ โโโ UmicpException.cs
โโโ Events/ # Event system
โ โโโ EventEmitter.cs
โโโ Transport/ # Transport layer
โ โโโ ITransport.cs
โ โโโ WebSocketClient.cs
โ โโโ HttpClient.cs
โโโ Peer/ # Peer-to-peer
โ โโโ MultiplexedPeer.cs
โ โโโ PeerConnection.cs
โ โโโ PeerInfo.cs
โ โโโ HandshakeProtocol.cs
โโโ Discovery/ # Service discovery
โ โโโ ServiceDiscovery.cs
โ โโโ ServiceInfo.cs
โโโ Pool/ # Connection pooling
โ โโโ ConnectionPool.cs
โ โโโ PoolConfig.cs
โโโ Envelope.cs # Core envelope class
โโโ Matrix.cs # Matrix operations
๐ Part of HiveLLM Ecosystem
UMICP is a core component of the HiveLLM ecosystem, providing high-performance binary protocol for agent-to-agent communication:
- Vectorizer: Semantic search and vector database
- Task Queue: Workflow orchestration
- Agent Framework: Multi-language agent platform
- Voxa: Voice AI assistant
๐ค Contributing
Contributions are welcome! Please see CONTRIBUTING.md for details.
๐ License
MIT License - See LICENSE file for details.
๐ Links
- Main Repository: https://github.com/hivellm/umicp
- Documentation: https://github.com/hivellm/umicp/tree/main/docs
- BIP-05 Specification: https://github.com/hivellm/hive-gov/tree/main/bips/BIP-05
- Issues: https://github.com/hivellm/umicp/issues
๐ Support
- Open an issue on GitHub
- Join our Discord community
- Email: team@hivellm.org
BIP: BIP-05 - Universal Matrix Intelligent Communication Protocol Status: โ Production Ready (C# v0.2.2) Repository: HiveLLM UMICP C# Implementation
๐ Version 0.2.2 Release Notes
This release focuses on SDK consistency and custom endpoint support:
- โ All SDKs aligned to version 0.2.2 for easier cross-language compatibility
- โ
Custom endpoint support - compatible with Vectorizer (
/umicp) and standard servers (/message) - โ No breaking changes - fully backward compatible
- โ Comprehensive documentation with examples for all languages
- โ Integration tests for Vectorizer service
See CHANGELOG.md for detailed changes.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | 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 was computed. 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 was computed. 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. |
-
net8.0
- System.IO.Compression (>= 4.3.0)
- System.Numerics.Vectors (>= 4.6.1)
- System.Text.Json (>= 9.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v0.2.2: Custom Endpoint Support. Features: Configurable endpoint paths for compatibility with different servers (e.g., Vectorizer uses /umicp). All SDKs updated to 0.2.2. No breaking changes - backward compatible with defaults.