Provides Zig language support through ZLS integration, offering code intelligence features such as hover information, definition lookup, reference finding, and formatting, along with tools for running Zig build, test, and check commands.
zig-mcp
MCP server for Zig that connects AI coding assistants to ZLS via the Language Server Protocol.
Works with Claude Code, Cursor, Windsurf, and any MCP-compatible client.
Requirements
Install
Claude Code plugin (recommended)
Install directly from the Claude Code interface — no manual build needed:
Or as a one-liner from the terminal:
The binary is built automatically on first use. Just make sure zig and zls are in your PATH.
Manual build
Binary is at zig-out/bin/zig-mcp.
Setup (manual install only)
If you installed via the plugin system, skip this section — everything is configured automatically.
Claude Code
Or edit ~/.claude/mcp_servers.json:
If you omit
--workspace, zig-mcp uses the current working directory.
Cursor
Add to .cursor/mcp.json in your project:
Windsurf
Add to ~/.codeium/windsurf/mcp_config.json:
Options
Tools
Code intelligence (via ZLS)
Tool | What it does |
| Type info and docs for a symbol |
| Go to definition |
| Find all references |
| Completion suggestions |
| Errors and warnings for a file |
| Format a file |
| Rename a symbol across the workspace |
| List all symbols in a file |
| Search symbols across the project |
| Quick fixes and refactors for a range |
| Function signature at cursor |
Build & run
Tool | What it does |
| Run |
| Run tests (whole project or single file, with optional filter) |
| Run |
| Show Zig and ZLS versions |
| Manage Zig versions via zvm |
How it works
zig-mcp spawns ZLS as a child process and talks to it over stdin/stdout using the LSP protocol (Content-Length framing). On the other side, it speaks MCP (newline-delimited JSON-RPC) to the AI assistant.
Three threads:
main -- reads MCP requests, dispatches tool calls, writes responses
reader -- reads LSP responses from ZLS, correlates by request ID
stderr -- forwards ZLS stderr to the server log
If ZLS crashes, zig-mcp automatically restarts it and re-opens all tracked documents.
Files are opened in ZLS lazily on first access -- no need to manage document state manually.
Development
License
MIT