Back to Home
nobita5609 icon

mcp.zig

by nobita5609

Overview

Provides a Model Context Protocol (MCP) library in Zig, enabling AI applications to connect to external systems by exposing tools, resources, and prompts through a standardized protocol.

Installation

Run Command
./zig-out/bin/example-server

Security Notes

The example code for handling resources and tools (`processFileHandler` in `docs/guide/error-handling.md`) directly uses an unsanitized `path` argument from client input with `std.fs.cwd().readFileAlloc`. This is a critical path traversal vulnerability, allowing a malicious client to read arbitrary files outside the intended working directory (e.g., `../../../../etc/passwd`). While there's an `accessAbsolute` check, it's insufficient to prevent this specific `readFileAlloc` vulnerability. This indicates a significant security risk in how tool/resource handlers might be implemented based on the provided guidance, or a lack of built-in sanitization within the library itself for such common operations. No other immediate malicious patterns, hardcoded secrets, or `eval` usage were found.

Similar Servers

Stats

Interest Score0
Security Score3
Cost ClassLow
Avg Tokens100
Stars0
Forks0
Last Update2026-01-19

Tags

mcpzigaiprotocolserver