mcp.zig
by muhammad-fiaz·★ 35·Score 46
A comprehensive MCP library for Zig that supports both server and client implementations with protocol compliance.
Overview
mcp.zig provides a native, high-performance implementation of the Model Context Protocol for the Zig programming language. The library offers both server and client frameworks with support for tools, resources, prompts, tasks, and rich content handling. It implements JSON-RPC 2.0 with capability negotiation, STDIO and HTTP transport options, and follows the MCP specification version 2025-11-25. The project includes comprehensive documentation, examples, tests, and is actively maintained with recent commits.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose mcp.zig when you need high-performance MCP implementations in Zig, especially for server development where Zig's performance and safety features are desired.
When NOT to choose this
Don't choose mcp.zig if you're not working with Zig or need extensive ecosystem libraries that only exist for Python/TypeScript MCP implementations.
Tools this server exposes
4 tools extracted from the READMEgreetGreet a user with a personalized message
search_filesSearch for files matching a pattern
calculatePerform arithmetic calculations
weather_infoGet weather information for a location
Note: Tool names were inferred from the examples and documentation sections. The README doesn't have a dedicated 'Tools' section but shows examples of how to implement and use tools with specific names.
Comparable tools
Installation
Installation
Add to your project using Zig's package manager:
# Latest development branch
zig fetch --save git+https://github.com/muhammad-fiaz/mcp.zig.git
# Zig 0.16.x (recommended)
zig fetch --save https://github.com/muhammad-fiaz/mcp.zig/archive/refs/tags/0.0.4.tar.gzThen in your build.zig:
const mcp_dep = b.dependency("mcp", .{
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("mcp", mcp_dep.module("mcp"));Claude Desktop Configuration
Add to your Claude Desktop configuration:
{
"mcpServers": {
"zig-mcp": {
"command": "zig",
"args": ["run", "path/to/your/server.zig"]
}
}
}FAQ
- What MCP versions are supported?
- This library implements MCP protocol version 2025-11-25, with compatibility for 2025-06-18, 2025-03-26, and 2024-11-05.
- Can I create both servers and clients with this library?
- Yes, mcp.zig includes both server framework for exposing tools, resources, and prompts, and client framework for connecting to MCP servers.
Compare mcp.zig with
Last updated · Auto-generated from public README + GitHub signals.