Get the FREE Ultimate OpenClaw Setup Guide →

mcp -zig

MCP server for Zig language intelligence — diagnostics, formatting, hover, go-to-definition, references, completions, symbols, and build via ZLS

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
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)

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

Sponsor this space

Reach thousands of developers