mcp -zig
MCP server for Zig language intelligence — diagnostics, formatting, hover, go-to-definition, references, completions, symbols, and build via ZLS
claude mcp add --transport stdio sadopc-mcp-server-zig node build/index.js
How to use
This MCP server provides Zig language intelligence for Claude Code by wrapping the Zig Language Server (ZLS). It exposes eight tools that leverage ZLS for diagnostics, formatting, hover information, go-to-definition, references, completions, and document symbols, along with a dedicated build command. The server communicates with Claude Code via standard IO and lazily starts ZLS on first tool usage, automatically restarting ZLS if it crashes. CLI tools for formatting and building Zig code are also supported, executing zig fmt and zig build directly when needed.
How to install
Prerequisites:
- Node.js >= 18
- Zig compiler available on PATH (zig version)
- ZLS available on PATH (zls --version)
Install options:
Option 1: Run from npm/npx (recommended for quick start)
- The MCP server is published as an npm package named mcp-server-zig. You can run it via npx when installing into Claude Code: claude mcp add --transport stdio mcp-server-zig -- npx -y mcp-server-zig
Option 2: Build from source (requires git and PNPM)
- Clone the repository: git clone https://github.com/sadopc/mcp-server-zig.git
- Enter the directory: cd mcp-server-zig
- Install and build: pnpm install pnpm build
Usage after build (Node.js server):
- In Claude Code, register the server with a path to the built entrypoint: claude mcp add --transport stdio zig -- node $(pwd)/build/index.js
Prerequisites verification:
- Ensure Zig is installed and accessible: zig version
- Ensure ZLS is installed and accessible: zls --version
- Ensure Zig fmt and Zig build tools work when invoking CLI tools
Additional notes
Notes and tips:
- ZLS is started lazily on first tool call and is restarted automatically if it crashes; this helps maintain responsiveness in long-running sessions.
- If you encounter issues with diagnostics not appearing immediately, wait a moment or increase diagnostic debounce time in Claude Code; the server may still be analyzing a large file.
- Ensure ZLS compatibility with your Zig version to prevent tool hangs or errors.
- If you prefer using the npx entrypoint, ensure the npm package mcp-server-zig is accessible in your environment or install it locally in your Claude Code environment.
- The server relies on standard IO communication; any path or permission issues can affect file operations (formatting, building).
- For Zig formatting, make sure zig fmt is functioning by running zig fmt --version or simply zig fmt yourfile.zig to verify behavior.
Related MCP Servers
swiftlens
SwiftLens is a Model Context Protocol (MCP) server that provides deep, semantic-level analysis of Swift codebases to any AI models. By integrating directly with Apple's SourceKit-LSP, SwiftLens enables AI models to understand Swift code with compiler-grade accuracy.
ummon
The semantic layer for software engineering: Connect code to meaning, build on understanding
mcp-jest
Automated testing for Model Context Protocol servers. Ship MCP Servers with confidence.
fastmcp-builder
A comprehensive Claude Code skill for building production-ready MCP servers using FastMCP. Includes reference guides, runnable examples, and a complete implementation with OAuth, testing, and best practices.
kortx
Kortx: MCP server for AI-powered consultation. GPT-5 strategic planning, Perplexity real-time search, GPT Image visual creation, with intelligent context gathering
Mira
Local MCP server that gives Claude Code persistent context, code intelligence, and background analysis. Runs on your machine, stored in SQLite.