zig-utcp
Universal Tool Calling Protocol (UTCP) implementation for Zig. A vendor-agnostic standard for LLM-tool integration supporting HTTP, CLI, MCP, SSE, WebSocket, and more
claude mcp add --transport stdio bkataru-zig-utcp zig build
How to use
zig-utcp provides a Universal Tool Calling Protocol (UTCP) implementation in Zig, with a focus on flexible transport layers (HTTP, CLI, MCP, SSE, WebSocket, and more) and tools loading via JSON or OpenAPI. The MCP component enables JSON-RPC style tool invocation over standard MCP channels (stdio or HTTP modes). You can use the included examples and transports to call tools, stream results, and apply post-processors, middleware, and rate limiting. The project emphasizes zero dependencies (pure Zig stdlib) and composable transports, so you can route tool calls through MCP for orchestration, or run a local MCP server that exposes your tools to clients via JSON-RPC.
To use the MCP capabilities, define your tools in UTCP format (id, name, description, and a transport-specific call_template) and then call them through the MCP transport. The repository provides example transports (HttpTransport, McpTransport, CliTransport, etc.) and utilities for streaming, post-processing, and middleware. If you want to experiment locally, the included MCP example demonstrates a JSON-RPC style flow over standard MCP channels and can be extended to fit your environment (e.g., running as a microservice behind an HTTP gateway or via a CLI tool for testing).
How to install
Prerequisites:
- Zig 0.15.2 or later installed on your system
Option A: Build from source (recommended for development)
- Install Zig as per your platform (https://ziglang.org/download/).
- Clone the repository: git clone https://github.com/bkataru/zig-utcp.git cd zig-utcp
- Build the project and examples: zig build
- Run examples to verify functionality (examples include MCP usage, HTTP, CLI, and streaming): zig build run-mcp zig build run-http zig build run-cli
Option B: Use Zig fetch (if you want to fetch as a dependency)
- Fetch the library: zig fetch --save git+https://github.com/bkataru/zig-utcp.git
- Integrate into a Zig project as a dependency via build.zig (see repository Quick Start for a template).
Option C: Local development with a local path dependency
- In your build.zig, add a path dependency to the zig-utcp module as shown in the Quick Start section of the README.
- Build and run your tool using the included examples as a reference.
Additional notes
Notes and tips:
- The MCP transport supports JSON-RPC style calls over standard MCP channels (stdio and HTTP modes).
- New in v0.2.0 includes CLI tool, middleware, circuit breaker, rate limiting, and post-processing features.
- The UTCP library emphasizes zero dependencies and composable transports; you can mix and match transports for different deployment scenarios.
- If you plan to expose MCP endpoints publicly, consider enabling authentication (API Key, Basic, Bearer, or OAuth2) via the Provider configuration.
- For testing tool definitions, the UTCP CLI tool (utcp) is available to load and inspect tools, and to exercise tool calls locally.
Related MCP Servers
Remote
A type-safe solution to remote MCP communication, enabling effortless integration for centralized management of Model Context.
git
An MCP (Model Context Protocol) server enabling LLMs and AI agents to interact with Git repositories. Provides tools for comprehensive Git operations including clone, commit, branch, diff, log, status, push, pull, merge, rebase, worktree, tag management, and more, via the MCP standard. STDIO & HTTP.
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
go-utcp
Official Go implementation of the UTCP
serper
A Serper MCP Server
agentman
Agentman: A tool for building and managing AI agents