API Reference
This section provides detailed API documentation for mcp.zig.
Modules Overview
| Module | Description |
|---|---|
mcp.Server | MCP server implementation |
mcp.Client | MCP client implementation |
mcp.protocol | Protocol constants and types |
mcp.types | Core type definitions |
mcp.jsonrpc | JSON-RPC 2.0 implementation |
mcp.transport | Transport layer implementations |
mcp.tools | Tool utilities |
mcp.resources | Resource utilities |
mcp.prompts | Prompt utilities |
mcp.schema | JSON Schema utilities |
mcp.report | Error reporting and updates |
Quick Links
Server Development
- Server.init - Create a new server
- Server.addTool - Register a tool
- Server.addResource - Register a resource
- Server.addPrompt - Register a prompt
- Server.run - Start the server
Client Development
- Client.init - Create a new client
- Client.callTool - Call a remote tool
- Client.readResource - Read a resource
- Client.getPrompt - Get a prompt
Types
- Content - Content types (text, image, etc.)
- ToolResult - Tool execution result
- Resource - Resource definition
- Prompt - Prompt definition
Import
zig
const mcp = @import("mcp");
// Access submodules
const Server = mcp.Server;
const Client = mcp.Client;
const Content = mcp.Content;
const types = mcp.types;
const protocol = mcp.protocol;
const report = mcp.report;Version
Current version: 0.0.1
Protocol version: 2025-11-25
zig
const version = mcp.protocol.PROTOCOL_VERSION; // "2025-11-25"