Get the FREE Ultimate OpenClaw Setup Guide →

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

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)

  1. Install Zig as per your platform (https://ziglang.org/download/).
  2. Clone the repository: git clone https://github.com/bkataru/zig-utcp.git cd zig-utcp
  3. Build the project and examples: zig build
  4. 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)

  1. Fetch the library: zig fetch --save git+https://github.com/bkataru/zig-utcp.git
  2. 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

  1. In your build.zig, add a path dependency to the zig-utcp module as shown in the Quick Start section of the README.
  2. 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

Sponsor this space

Reach thousands of developers