MCP Catalogs
首页mcp.zig screenshot

mcp.zig

by muhammad-fiaz·35·综合分 46

一个全面的 Zig MCP 库,支持服务端和客户端实现,符合协议规范。

developer-toolsai-llmother
8
Forks
2
活跃 Issue
本月
最近提交
2 天前
收录于

概述

mcp.zig 为 Zig 编程语言提供了高性能的原生 MCP 协议实现。该库同时提供服务端和客户端框架,支持工具、资源、提示、任务和富内容处理。它实现了 JSON-RPC 2.0,支持能力协商、STDIO 和 HTTP 传输,遵循 2025-11-25 版本的 MCP 规范。项目包含完整文档、示例、测试,并且有积极的维护活动,最近仍有提交。

试试问 AI

装完之后,这里有 5 个你可以让 AI 做的事:

:在 Zig 中构建 MCP 服务器,向 AI 应用程序暴露工具、资源和提示
:在 Zig 中创建 MCP 客户端,连接到任何兼容的 MCP 服务器
:利用 Zig 的安全特性开发高性能 AI 集成
:支持哪些 MCP 版本?
:我可以使用这个库同时创建服务器和客户端吗?

什么时候选它

当您需要 Zig 中的高性能 MCP 实现时,特别是在服务器开发中希望利用 Zig 的性能和安全特性时,选择 mcp.zig。

什么时候不要选它

如果您不使用 Zig 或需要仅存在于 Python/TypeScript MCP 实现中的广泛生态系统库,不要选择 mcp.zig。

此 server 暴露的工具

从 README 抽取出 4 个工具
  • greet

    Greet a user with a personalized message

  • search_files

    Search for files matching a pattern

  • calculate

    Perform arithmetic calculations

  • weather_info

    Get weather information for a location

说明: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.

可对比工具

modelcontextprotocolmcp-typescriptmcp-pythonmcp-go

安装

安装

使用 Zig 包管理器添加到您的项目:

# 最新开发分支
zig fetch --save git+https://github.com/muhammad-fiaz/mcp.zig.git

# Zig 0.16.x (推荐)
zig fetch --save https://github.com/muhammad-fiaz/mcp.zig/archive/refs/tags/0.0.4.tar.gz

然后在您的 build.zig 中:

const mcp_dep = b.dependency("mcp", .{
    .target = target,
    .optimize = optimize,
});
exe.root_module.addImport("mcp", mcp_dep.module("mcp"));

Claude Desktop 配置

添加到您的 Claude Desktop 配置:

{
  "mcpServers": {
    "zig-mcp": {
      "command": "zig",
      "args": ["run", "path/to/your/server.zig"]
    }
  }
}

FAQ

支持哪些 MCP 版本?
这个库实现了 MCP 协议版本 2025-11-25,兼容 2025-06-18、2025-03-26 和 2024-11-05 版本。
我可以使用这个库同时创建服务器和客户端吗?
是的,mcp.zig 包含了服务端框架(用于暴露工具、资源和提示)和客户端框架(用于连接到 MCP 服务器)。

mcp.zig 对比

GitHub →

最后更新于 · 由 README + GitHub 公开数据自动生成。