# MCP.zig > Model Context Protocol for Zig The first comprehensive MCP library for Zig — build AI-ready servers and clients with native performance ## Table of Contents ### Introduction - [What is MCP?](/mcp.zig/guide/what-is-mcp.md): Learn about the Model Context Protocol (MCP), an open standard for connecting AI applications to external systems like tools, resources, and prompts. - [Architecture](/mcp.zig/guide/architecture.md): Understand the MCP architecture including clients, servers, transports, and how components communicate via JSON-RPC. - [Protocol Version](/mcp.zig/guide/protocol-version.md): MCP protocol version support including 2026-07-28, 2025-11-25, and earlier versions with stateless per-request model. - [Getting Started](/mcp.zig/guide/getting-started.md): Get started with MCP.zig — install the library, create your first MCP server, and connect to AI applications in minutes. - [Installation](/mcp.zig/guide/installation.md): Install MCP.zig in your Zig project using zig fetch for Zig 0.16.x or 0.15.x compatibility. ### MCP Concepts - [Server Concepts](/mcp.zig/guide/server-concepts.md): Core MCP server concepts: tools, resources, prompts, and how servers expose capabilities to AI applications. - [Client Concepts](/mcp.zig/guide/client-concepts.md): Core MCP client concepts: connecting to servers, discovery, and invoking tools, resources, and prompts. - [Authorization](/mcp.zig/guide/authorization.md): MCP authorization with OAuth 2.1, Bearer tokens, and secure transport authentication. - [Inspector](/mcp.zig/guide/inspector.md): Use the MCP Inspector to test and debug your MCP servers with interactive tool calls and resource reads. ### Zig API - [Server API](/mcp.zig/guide/server.md): MCP Server API reference — create servers, register tools/resources/prompts, and run with STDIO or HTTP transport. - [Client API](/mcp.zig/guide/client.md): MCP Client API reference — connect to servers, discover capabilities, call tools, read resources, and fetch prompts. - [Tools](/mcp.zig/guide/tools.md): Define and use MCP tools — functions that AI can call to perform actions with typed inputs and outputs. - [Resources](/mcp.zig/guide/resources.md): Define and use MCP resources — read-only data sources that AI can access for context and information. - [Prompts](/mcp.zig/guide/prompts.md): Define and use MCP prompts — reusable templates for structuring AI interactions and workflows. - [Transport](/mcp.zig/guide/transport.md): MCP transport layer — STDIO, HTTP, and custom transports for client-server communication. ### Advanced - [JSON-RPC Protocol](/mcp.zig/guide/jsonrpc.md): MCP uses JSON-RPC 2.0 for communication — understand requests, responses, notifications, and batch operations. - [Schema Validation](/mcp.zig/guide/schema.md): JSON Schema validation for MCP tool inputs — build schemas with InputSchemaBuilder for type-safe arguments. - [Error Handling](/mcp.zig/guide/error-handling.md): MCP error handling — handle transport errors, JSON-RPC errors, and tool execution errors gracefully. ### API Reference - [API Reference](/mcp.zig/api.md): MCP.zig API reference — complete documentation for Server, Client, Protocol, and Types modules. - [Server API Reference](/mcp.zig/api/server.md): Complete API reference for mcp.Server — initialization, configuration, tools, resources, prompts, and transport. - [Client API Reference](/mcp.zig/api/client.md): Complete API reference for mcp.Client — connection, discovery, tools, resources, prompts, and capabilities. - [Protocol API Reference](/mcp.zig/api/protocol.md): MCP protocol API reference — JSON-RPC message types, serialization, and protocol constants. - [Types Reference](/mcp.zig/api/types.md): MCP type definitions — ContentBlock, Tool, Resource, Prompt, InputSchema, and all protocol types. ### Code Examples - [Code Examples](/mcp.zig/examples.md): MCP.zig code examples — complete working servers and clients for learning and reference. - [Simple Server Example](/mcp.zig/examples/simple-server.md): Build a simple MCP server with tools, resources, and prompts using MCP.zig. - [Simple Client Example](/mcp.zig/examples/simple-client.md): Connect to an MCP server with a simple client using STDIO transport. - [Weather Server Example](/mcp.zig/examples/weather-server.md): Build an MCP weather server with forecast and alert tools using MCP.zig. - [Calculator Server Example](/mcp.zig/examples/calculator-server.md): Build an MCP calculator server with arithmetic operations using MCP.zig. - [Advanced Server Example](/mcp.zig/examples/advanced-server.md): Advanced MCP server with JSON Schema, icons, task support, and structured output using MCP.zig. - [Filesystem Server Example](/mcp.zig/examples/filesystem-server.md): Build an MCP filesystem server for reading files and directories using MCP.zig. - [Notes Server Example](/mcp.zig/examples/notes-server.md): Build an MCP notes server with create, list, and manage operations using MCP.zig. - [HTTP Server Example](/mcp.zig/examples/http-server.md): Run an MCP server over HTTP with SSE support using MCP.zig. - [Middleware Server Example](/mcp.zig/examples/middleware-server.md): Build an MCP server with logging and authentication middleware using MCP.zig. - [Batch Client Example](/mcp.zig/examples/batch-client.md): Send multiple JSON-RPC requests as a batch using MCP.zig client. - [Health Check Example](/mcp.zig/examples/health-check-example.md): Demonstrate the built-in health check endpoint for MCP servers using MCP.zig. - [Graceful Shutdown Example](/mcp.zig/examples/shutdown-example.md): Demonstrate graceful shutdown of an MCP server using MCP.zig. - [Validator Example](/mcp.zig/examples/validator-example.md): Build an MCP server with request validation for tool arguments using MCP.zig. - [Rate Limiter Example](/mcp.zig/examples/rate-limiter-example.md): Build an MCP server with rate limiting for tool calls using MCP.zig. ### Other - [Contributing](/mcp.zig/contributing.md): Contribute to MCP.zig — report bugs, suggest features, improve documentation, and submit pull requests.