Zig MCP Server

MCP server for Zig that connects AI coding assistants to [ZLS](https://github.com/zigtools/zls) via the Language Server Protocol.

Local serverstdio

What is the Zig MCP MCP server?

MCP server for Zig that connects AI coding assistants to ZLS via the Language Server Protocol. That is what the zig mcp mcp server brings to an AI assistant: the same capability, reachable through the Model Context Protocol rather than a separate app or dashboard.

The short version

There is no zig_build, zig_test, zig_format, zig_version, zig_check or zig_manage. They used to exist and wrapped zig build, zig test, zig fmt, zig version, zig ast-check and zvm — and a wrapper loses to the shell it wraps: no pipes, no redirection, no working directory of its own. Session transcripts settle it: 526 zig build invocations through the shell, zero calls to the tool. Run those with your shell.

The tools it exposes

The server publishes 14 tools. What each one is for:

  • zig_definition — The one true declaration, followed through imports and aliases. Takes symbol or file+line+character
  • zig_references — Real usages, scope-aware; skips same-named identifiers, comments and strings. symbol mode also searches through re-exports
  • zig_hover — The type after comptime evaluation and inference — invisible in the source text
  • zig_diagnostics — Errors for one file without building the project, re-synced against disk first
  • zig_workspace_symbols — Declarations by name, not every line mentioning it
  • zig_document_symbols — A file's outline: declarations, kinds, nesting
  • zig_completion — What can legally follow at a position, with types
  • zig_signature_help — The real signature, comptime and generic parameters included
  • zig_rename — Which files a rename touches, scope-aware
  • zig_code_action — Quick fixes ZLS offers for a range
  • zig_inlay_hints — Every inferred type in a file at once — nothing of this is in the source text
  • zig_type_definition — The declaration of a value's type, not of the value

Getting it running

Setup follows the usual MCP pattern — install or clone the server, register it in your client's configuration file, restart the client. The configuration blocks on this page cover the common clients.

What it needs from you

  • Zig 0.17.0-dev.1415+64dfaa568 or newer - ZLS (auto-detected from PATH, or specify with --zls-path)

How it compares

Plenty of developer tooling servers cover similar ground. The differences that matter in practice are scope of access and how much setup stands between you and a working tool call. Zig MCP's toolset — zig_definition, zig_references, zig_hover and 11 more — is a fair guide to whether it matches your workflow. It is maintained by nzrsky; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Things to watch

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • With 14 tools registered it takes up a noticeable share of the context window; turn it off in projects that never touch Zig MCP.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
zig_definitionThe one true declaration, followed through imports and aliases. Takes symbol or file+line+character
zig_referencesReal usages, scope-aware; skips same-named identifiers, comments and strings. symbol mode also searches through re-exports
zig_hoverThe type after comptime evaluation and inference — invisible in the source text
zig_diagnosticsErrors for one file without building the project, re-synced against disk first
zig_workspace_symbolsDeclarations by name, not every line mentioning it
zig_document_symbolsA file's outline: declarations, kinds, nesting
zig_completionWhat can legally follow at a position, with types
zig_signature_helpThe real signature, comptime and generic parameters included
zig_renameWhich files a rename touches, scope-aware
zig_code_actionQuick fixes ZLS offers for a range
zig_inlay_hintsEvery inferred type in a file at once — nothing of this is in the source text
zig_type_definitionThe declaration of a value's *type*, not of the value
zig_ast_queryCode by shape: empty catch {}, catch unreachable, undefined initializers, unreachable, @panic. Matched over the syntax tree, so comments and string literals never match and multi-line forms always do
zig_unused_privatePrivate declarations nothing refers to — exact, because a non-pub name cannot escape its file

How to install the Zig MCP MCP server

Or edit `~/.claude/mcp_servers.json`:

```json
{
  "mcpServers": {
    "zig-mcp": {
      "command": "/absolute/path/to/zig-mcp",
      "args": ["--workspace", "/path/to/your/zig/project"]
    }
  }
}

Configuration as documented by the project. Restart the client after saving.

Configuration

  • Zig 0.17.0-dev.1415+64dfaa568 or newer - ZLS (auto-detected from PATH, or specify with --zls-path)

Example prompts to try

  • Use Zig MCP to zig definition.
  • Use Zig MCP to zig references.
  • Use Zig MCP to zig hover.

Frequently asked questions

It connects Zig MCP to MCP-compatible AI assistants such as Claude and Cursor, exposing 14 tools (zig_definition, zig_references, zig_hover, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Zig MCP directly.