mcp-server-zig
Provides Zig language intelligence including diagnostics, formatting, hover info, go-to-definition, references, completions, document symbols, and building.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-server-zig Show me the errors in src/main.zig"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-zig
MCP server that provides Zig language intelligence for Claude Code. Wraps ZLS (Zig Language Server) and exposes 8 tools for diagnostics, formatting, hover info, go-to-definition, references, completions, document symbols, and building.
Prerequisites
Node.js >= 18
Zig compiler on PATH (
zig version)ZLS on PATH (
zls --version)
# macOS
brew install zig zls
# Or download from:
# https://ziglang.org/download/
# https://github.com/zigtools/zls/releasesRelated MCP server: Zignet
Installation
Add to Claude Code:
claude mcp add --transport stdio mcp-server-zig -- npx -y mcp-server-zigOr from source:
git clone https://github.com/sadopc/mcp-server-zig.git
cd mcp-server-zig
pnpm install && pnpm build
claude mcp add --transport stdio zig -- node $(pwd)/build/index.jsTools
zig_diagnostics
Get errors and warnings for a Zig source file.
Parameter | Type | Description |
| string | Absolute path to the .zig file |
zig_format
Format Zig code using zig fmt.
Parameter | Type | Description |
| string? | Path to .zig file to format in-place |
| string? | Zig source code string to format |
Provide either file_path or code, not both.
zig_hover
Get type information and documentation for a symbol at a position.
Parameter | Type | Description |
| string | Absolute path to the .zig file |
| number | Zero-based line number |
| number | Zero-based character offset |
zig_definition
Go to definition — find where a symbol is defined.
Parameter | Type | Description |
| string | Absolute path to the .zig file |
| number | Zero-based line number |
| number | Zero-based character offset |
zig_references
Find all references to a symbol.
Parameter | Type | Description |
| string | Absolute path to the .zig file |
| number | Zero-based line number |
| number | Zero-based character offset |
zig_completions
Get completion suggestions at a position.
Parameter | Type | Description |
| string | Absolute path to the .zig file |
| number | Zero-based line number |
| number | Zero-based character offset |
| number? | Max completions to return (default: 20) |
zig_document_symbols
Get the document symbol outline (functions, structs, variables, etc.).
Parameter | Type | Description |
| string | Absolute path to the .zig file |
zig_build
Run zig build in a project directory.
Parameter | Type | Description |
| string | Path to project directory (containing build.zig) |
| string[]? | Additional args for |
How It Works
Claude Code ←(MCP/stdio)→ mcp-server-zig ←(LSP/stdio)→ ZLS subprocess
←(shell exec)→ zig fmt / zig buildZLS tools (diagnostics, hover, definition, references, completions, symbols): The server spawns ZLS as a subprocess, communicates via LSP over stdio. ZLS is started lazily on first tool call and auto-restarts on crash.
CLI tools (format, build): These call
zig fmtandzig builddirectly — no ZLS needed.
Troubleshooting
"ZLS spawn error" — ZLS is not installed or not on PATH. Run which zls to verify.
"zig fmt failed" — Zig compiler is not installed or not on PATH. Run which zig to verify.
Diagnostics are empty — ZLS needs time to analyze the file. The server waits 200ms by default. For large projects, diagnostics may take longer to appear.
Tools hang — Check that ZLS is compatible with your Zig version. ZLS and Zig versions should match.
License
MIT
Available Tools
8 toolszig_buildA
Run zig build in a project directory and return the build output
Inputs: project_path (required), args.
zig_completionsB
Get completion suggestions at a specific position in a Zig file via ZLS
Inputs: file_path (required), line (required), character (required), limit.
zig_definitionB
Go to definition — find where a symbol is defined in a Zig codebase via ZLS
Inputs: file_path (required), line (required), character (required).
zig_diagnosticsB
Get diagnostics (errors, warnings) for a Zig source file via ZLS
Inputs: file_path (required).
zig_document_symbolsA
Get the document symbol outline (functions, structs, variables) of a Zig file via ZLS
Inputs: file_path (required).
zig_formatA
Format Zig code using zig fmt. Provide either a file path to format in-place, or a code string to format and return.
Inputs: file_path, code.
zig_hoverA
Get type information and documentation for a symbol at a specific position in a Zig file via ZLS
Inputs: file_path (required), line (required), character (required).
zig_referencesB
Find all references to a symbol at a specific position in a Zig file via ZLS
Inputs: file_path (required), line (required), character (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool serves a clearly distinct purpose: building, formatting, and various LSP features like completions, definitions, diagnostics, document symbols, hover, and references. No two tools overlap in functionality.
All tools follow a consistent 'zig_<action>' pattern with snake_case, making it predictable and easy to understand the purpose from the name alone.
With 8 tools, the server covers the essential Zig development workflow (build, format, LSP features) without being bloated. The count is well-scoped for a language-specific MCP server.
The toolset covers core development tasks: building, formatting, and common LSP operations (completions, diagnostics, hover, definitions, references, document symbols). Minor gaps like renaming or code actions are absent but not critical for basic usage.
Related MCP Connectors
Small tools for agent builders: AI-writing tells, tools/list token cost, CLAUDE.md lint, and more.
Live SEO workflow tools for Claude Code, Codex, and AI agents.
Teamfight Tactics data & AI coaching for Claude and ChatGPT - 19 tools, built-in Riot key.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides Zig language tooling and code analysis, enhancing AI capabilities with Zig-specific functions like code optimization, compute unit estimation, code generation, and recommendations for best practices.752MIT
- AlicenseBqualityDmaintenanceEnables AI-powered Zig programming assistance through code generation, debugging, and documentation explanation. Uses local LLM models to provide idiomatic Zig code creation and analysis capabilities.413 npm11Do What The F*ck You Want To Public
- AlicenseAqualityBmaintenanceBridges Claude Code to Language Server Protocol (LSP) servers to enable semantic code intelligence features like navigation, refactoring, and real-time diagnostics. It supports multiple languages including TypeScript, Python, and Rust with multi-root workspace capabilities.193,815 npm23MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for Zig that connects AI coding assistants to ZLS (Zig Language Server) via LSP. Provides 16 tools for code intelligence (hover, go-to-definition, references, completions, diagnostics, rename, format) and build/test operations.7-