MCP server connecting AI assistants to the Zig Language Server (ZLS)

MCP server connecting AI assistants to the Zig Language Server (ZLS)

zig-mcp•bynzrsky

An MCP server that spawns ZLS and bridges its Language Server Protocol responses to MCP clients, exposing Zig semantic analysis tools for AI coding assistants.

License: MIT•Runtime: Awaiting documentation review•Category: developer tools

WHAT IT DOES

  • •Provides semantic navigation tools such as go-to-definition, references, hover types and workspace/document symbols answered from ZLS's semantic model.
  • •Offers completion, signature help, rename, code actions, inlay hints and type definition tools.
  • •Includes an AST-based code query and unused private declaration detection.
  • •Automatically restarts ZLS if it crashes and re-opens tracked documents, and re-syncs files when their contents change on disk.

BEST FOR

  • •AI coding assistants working on Zig projects that need accurate declarations, references and inferred types beyond text search.
  • •Locating pattern-shaped code such as empty catch blocks, unreachable, or @panic across a Zig codebase.
  • •Safely renaming symbols and finding unused private declarations in Zig files.

ABOUT ZIG-MCP

MCP server connecting AI assistants to the Zig Language Server (ZLS) is cataloged as an MCP server attributed to nzrsky. An MCP server that spawns ZLS and bridges its Language Server Protocol responses to MCP clients, exposing Zig semantic analysis tools for AI coding assistants. It is categorized under developer tools. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

能力检查器

能力定义尚未审核。未核验的采集内容不会作为可信接口展示。

Tools (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Resources (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

Prompts (0)

暂无可展示的已审核记录。这不表示上游不支持此能力。

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server connecting AI assistants to the Zig Language Server (ZLS) are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

FREQUENTLY ASKED QUESTIONS

What does zig-mcp use to answer its tools?

It answers from ZLS's semantic model, which covers information a shell or text search cannot reach.

Does zig-mcp wrap build, test or format commands?

No. Those wrapper tools were deliberately removed because they lose to the shell, which offers pipes, redirection and its own working directory.

上游原版 README

在 GitHub 查看同一版本原文

README.md · 0b1eb1f1de0b · 采集于 2026-11-13 10:27:33 UTC

保留上游原文,不做 AI 改写。为安全起见过滤脚本、表单和不安全链接。

当前显示最后一次成功采集的文档快照,请以来源页面为准。

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.

AI assistant  <--(MCP stdio)-->  zig-mcp  <--(LSP pipes)-->  ZLS
                                    |
                             zig build / test / check

Requirements

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

Install

Install directly from the Claude Code interface — no manual build needed:

# 1. Add the marketplace
/plugin marketplace add nzrsky/zig-mcp

# 2. Install the plugin
/plugin install zig-mcp@zig

Or as a one-liner from the terminal:

claude plugin marketplace add nzrsky/zig-mcp && claude plugin install zig-mcp@zig

The binary is built automatically on first use. Just make sure zig and zls are in your PATH.

Manual build

git clone https://github.com/nzrsky/zig-mcp.git
cd zig-mcp
zig build -Doptimize=ReleaseFast

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

# add globally
claude mcp add zig-mcp -- /absolute/path/to/zig-mcp --workspace /path/to/your/zig/project

# add for current project only
claude mcp add --scope project zig-mcp -- /absolute/path/to/zig-mcp --workspace /path/to/your/zig/project

Or edit ~/.claude/mcp_servers.json:

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

If you omit --workspace, zig-mcp uses the current working directory.

Cursor

Add to .cursor/mcp.json in your project:

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

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

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

Options

--workspace, -w <path>   Project root directory (default: cwd)
--zls-path <path>        Path to ZLS binary (default: auto-detect from PATH)
--help, -h               Show help
--version                Show version

Tools

All of these answer from ZLS's semantic model — the part a shell and a text search cannot reach.

ToolWhat it knows that grep does not
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

What is deliberately absent

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.

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, and re-synced (didChange) whenever their contents change on disk -- no need to manage document state manually.

Development

# build
zig build

# run tests (162 unit tests, including a fake-ZLS harness)
zig build test

# quality gates: lint, coverage, dead code, mutants
make lint cov deadcode mutants

# run manually
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"capabilities":{}}}' | \
  zig-out/bin/zig-mcp --workspace . 2>/dev/null

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server connecting AI assistants to the Zig Language Server (ZLS) from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/zig-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

下载与拉取统计

来源、范围和时段分别列出;不相加,不代表安装人数、活跃用户或安全审核。

尚无已审核的包 / 镜像标识,暂不展示下载统计。

Related developer tools MCP Servers

Alternative and complementary servers in the same category

View all in developer tools →
Postbye
postbye-mcp•postbye-team

A directory listing describing a cancellation-letter and mailing-address service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools
Singapore Proxy MCP
singapore-proxy-mcp•Xavierfok

A hosted MCP service for browsing and searching through Singapore mobile-network proxies.

0
Developer Tools

A directory listing describing a Markdown-to-PDF service. The configured public GitHub repository returned 404 during source verification.

Repository stats unavailable
Developer Tools