Zignet

Zignet

Enables 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.

Category
Visit Server

README

ZigNet

MCP Server for Zig โ€” Intelligent code analysis, validation, and documentation powered by a fine-tuned LLM

ZigNet integrates with Claude (and other MCP-compatible LLMs) to provide real-time Zig code analysis without leaving your chat interface.


๐ŸŽฏ Features

MCP Tools

<details> <summary><b>๐Ÿ” analyze_zig</b> โ€” Syntax and type checking with official Zig compiler</summary>

Analyze Zig code for syntax errors, type mismatches, and semantic issues using zig ast-check.

Example usage:

User: "Analyze this Zig code"
Claude: [calls analyze_zig tool]
Response: "โœ… Syntax: Valid | Type Check: PASS | Warnings: 0"

Capabilities:

  • Lexical analysis (tokenization)
  • Syntax parsing (AST generation)
  • Type checking and validation
  • Semantic error detection
  • Line/column error reporting

</details>

<details> <summary><b>โœจ compile_zig</b> โ€” Format and validate Zig code</summary>

Validate and format Zig code using zig fmt, generating clean, idiomatic output.

Example:

// Input (messy)
fn add(a:i32,b:i32)i32{return a+b;}

// Output (formatted)
fn add(a: i32, b: i32) i32 {
    return a + b;
}

Capabilities:

  • Code formatting (2-space indentation)
  • Syntax validation
  • Best practices enforcement
  • Preserves semantics

</details>

<details> <summary><b>๐Ÿ“– get_zig_docs</b> โ€” AI-powered documentation lookup (coming soon)</summary>

Retrieve Zig documentation and explanations for language features using a fine-tuned LLM.

Example:

Query: "comptime"
Response: "comptime enables compile-time evaluation in Zig..."

Powered by:

  • Fine-tuned Qwen2.5-Coder-7B model
  • 13,756 examples from Zig 0.13-0.15
  • Specialized on advanced Zig idioms (comptime, generics, error handling)

</details>

<details> <summary><b>๐Ÿ”ง suggest_fix</b> โ€” Intelligent error fix suggestions (coming soon)</summary>

Get intelligent code fix suggestions for Zig errors using AI-powered analysis.

Example:

// Error: "Type mismatch: cannot assign string to i32"
var x: i32 = "hello";

// Suggestions:
// Option 1: var x: []const u8 = "hello";  // If you meant string
// Option 2: var x: i32 = 42;              // If you meant integer

Features:

  • Context-aware suggestions
  • Multiple fix options
  • Explanation of the issue
  • Zig idiom recommendations

</details>


๐Ÿ“– Usage

ZigNet is an MCP server โ€” configure it once in your MCP client, then use it naturally in conversation.

<details> <summary><b>๐Ÿ–ฅ๏ธ Claude Desktop</b></summary>

Configuration file location:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add this:

{
  "mcpServers": {
    "zignet": {
      "command": "npx",
      "args": ["-y", "zignet"]
    }
  }
}

Then restart Claude Desktop and start using:

You: "Analyze this Zig code for errors"
     [paste code]

Claude: [uses analyze_zig tool]
        "Found 1 type error: variable 'x' expects i32 but got []const u8"

</details>

<details> <summary><b>๐Ÿ”ง VS Code (with GitHub Copilot)</b></summary>

Method 1: VS Code Marketplace (coming soon)

  1. Open VS Code Extensions (Ctrl+Shift+X / Cmd+Shift+X)
  2. Search for @mcp zignet
  3. Click Install
  4. Restart VS Code

Method 2: Manual configuration (available now)

  1. Install GitHub Copilot extension (if not already installed)
  2. Open Copilot settings
  3. Add to MCP servers config:
{
  "mcpServers": {
    "zignet": {
      "command": "npx",
      "args": ["-y", "zignet"]
    }
  }
}

Then restart VS Code and Copilot will have access to ZigNet tools.

</details>

What happens after configuration?

  1. First use: npx downloads and caches ZigNet automatically
  2. Zig compiler: Downloads on-demand (supports Zig 0.13, 0.14, 0.15)
  3. Tools available: analyze_zig, compile_zig (+ get_zig_docs, suggest_fix coming soon)
  4. Zero maintenance: Updates automatically via npx -y zignet

๐Ÿ—๏ธ Architecture

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Claude / MCP Client                                 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                     โ”‚ MCP Protocol (JSON-RPC)
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ ZigNet MCP Server (TypeScript)                      โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Tool Handlers                                โ”‚   โ”‚
โ”‚  โ”‚ - analyze_zig                                โ”‚   โ”‚
โ”‚  โ”‚ - compile_zig                                โ”‚   โ”‚
โ”‚  โ”‚ - get_zig_docs                               โ”‚   โ”‚
โ”‚  โ”‚ - suggest_fix                                โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Zig Compiler Integration                     โ”‚   โ”‚
โ”‚  โ”‚ - zig ast-check (syntax + type validation)   โ”‚   โ”‚
โ”‚  โ”‚ - zig fmt (official formatter)               โ”‚   โ”‚
โ”‚  โ”‚ - Auto-detects system Zig installation       โ”‚   โ”‚
โ”‚  โ”‚ - Falls back to downloading if needed        โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ”‚                โ–ผ                                    โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
โ”‚  โ”‚ Fine-tuned LLM (Qwen2.5-Coder-7B)            โ”‚   โ”‚
โ”‚  โ”‚ - Documentation lookup                       โ”‚   โ”‚
โ”‚  โ”‚ - Intelligent suggestions                    โ”‚   โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Why this architecture?

  • Official Zig compiler (100% accurate, always up-to-date) instead of custom parser
  • System integration (uses existing Zig installation if available)
  • LLM-powered suggestions (get_zig_docs, suggest_fix) for intelligence
  • No external API calls (local inference via node-llama-cpp)
  • Fast (< 100ms for validation, < 2s for LLM suggestions)

Note: When Zig releases a new version (e.g., 0.16.0), ZigNet will need to re-train the LLM model on updated documentation and examples.


๐Ÿงช Development Status

Component Status Notes
Zig Compiler Wrapper โœ… Complete ast-check + fmt integration
System Zig Detection โœ… Complete Auto-detects installed Zig versions
Multi-version Cache โœ… Complete Downloads Zig 0.13-0.15 on demand
MCP Server โœ… Complete All 4 tools fully implemented
LLM Fine-tuning โœ… Complete Trained on 13,756 Zig examples
get_zig_docs โœ… Complete LLM-powered documentation lookup
suggest_fix โœ… Complete LLM-powered intelligent suggestions
GGUF Conversion โœ… Complete Q4_K_M quantized (4.4GB)
E2E Testing โœ… Complete 27/27 tests passing (8.7s)
Claude Integration โณ Planned Final deployment to Claude Desktop

Current Phase: Ready for deployment - All core features complete


๐Ÿงช Testing

Running Tests

# Run all tests (unit + E2E)
pnpm test

# Run only E2E tests
pnpm test tests/e2e/mcp-integration.test.ts

# Run deterministic tests only (no LLM required)
SKIP_LLM_TESTS=1 pnpm test tests/e2e

# Watch mode for development
pnpm test:watch

Test Coverage

E2E Test Suite: 27 tests covering all MCP tools

Tool Tests Type Pass Rate
analyze_zig 4 Deterministic 100%
compile_zig 3 Deterministic 100%
get_zig_docs 5 LLM-powered 100%
suggest_fix 5 LLM-powered 100%
Integration 3 Mixed 100%
Performance 3 Stress tests 100%
Edge Cases 4 Error paths 100%

Execution time: 8.7 seconds (without LLM model, deterministic only)
With LLM model: ~60-120 seconds (includes model loading + inference)

Test Behavior

  • Deterministic tests (12 tests): Always run, use Zig compiler directly
  • LLM tests (15 tests): Auto-skip if model not found, graceful degradation
  • CI/CD ready: Runs on GitHub Actions without GPU requirements

For detailed testing guide, see tests/e2e/README.md


๐Ÿ“ฆ Project Structure

zignet/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ config.ts             # Environment-based configuration
โ”‚   โ”œโ”€โ”€ mcp-server.ts         # MCP protocol handler
โ”‚   โ”œโ”€โ”€ zig/
โ”‚   โ”‚   โ”œโ”€โ”€ manager.ts        # Multi-version Zig download/cache
โ”‚   โ”‚   โ””โ”€โ”€ executor.ts       # zig ast-check + fmt wrapper
โ”‚   โ”œโ”€โ”€ llm/
โ”‚   โ”‚   โ”œโ”€โ”€ model-downloader.ts  # Auto-download GGUF from HuggingFace
โ”‚   โ”‚   โ””โ”€โ”€ session.ts           # node-llama-cpp integration
โ”‚   โ””โ”€โ”€ tools/
โ”‚       โ”œโ”€โ”€ analyze.ts        # analyze_zig tool (COMPLETE)
โ”‚       โ”œโ”€โ”€ compile.ts        # compile_zig tool (COMPLETE)
โ”‚       โ”œโ”€โ”€ docs.ts           # get_zig_docs tool (COMPLETE)
โ”‚       โ””โ”€โ”€ suggest.ts        # suggest_fix tool (COMPLETE)
โ”œโ”€โ”€ scripts/
โ”‚   โ”œโ”€โ”€ train-qwen-standard.py   # Fine-tuning script (COMPLETE)
โ”‚   โ”œโ”€โ”€ scrape-zig-repos.js      # Dataset collection
โ”‚   โ”œโ”€โ”€ install-zig.js           # Zig version installer
โ”‚   โ””โ”€โ”€ test-config.cjs          # Config system tests
โ”œโ”€โ”€ data/
โ”‚   โ”œโ”€โ”€ training/             # 13,756 examples (train/val/test)
โ”‚   โ””โ”€โ”€ zig-docs/             # Scraped documentation
โ”œโ”€โ”€ models/
โ”‚   โ””โ”€โ”€ zignet-qwen-7b/       # Fine-tuned model + LoRA adapters
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ *.test.ts             # Unit tests (lexer, parser, etc.)
โ”‚   โ””โ”€โ”€ e2e/
โ”‚       โ”œโ”€โ”€ mcp-integration.test.ts  # 27 E2E tests
โ”‚       โ””โ”€โ”€ README.md               # Testing guide
โ”œโ”€โ”€ docs/
โ”‚   โ”œโ”€โ”€ AGENTS.md             # Detailed project spec
โ”‚   โ”œโ”€โ”€ DEVELOPMENT.md        # Development guide
โ”‚   โ””โ”€โ”€ TESTING.md            # Testing documentation
โ””โ”€โ”€ README.md                 # This file

๐Ÿค– Model Details

Base Model: Qwen/Qwen2.5-Coder-7B-Instruct
Fine-tuning: QLoRA (4-bit) on 13,756 Zig examples
Dataset: 97% real-world repos (Zig 0.13-0.15), 3% documentation
Training: RTX 3090 (24GB VRAM), 3 epochs, ~8 hours
Output: fulgidus/zignet-qwen2.5-coder-7b (HuggingFace)
Quantization: Q4_K_M (~4GB GGUF for node-llama-cpp)

Why Qwen2.5-Coder-7B?

  • Best Zig syntax understanding (benchmarked vs 14 models)
  • Modern idioms (comptime, generics, error handling)
  • Fast inference (~15-20s per query post-quantization)

๐Ÿ“Š Benchmarks

Model Pass Rate Avg Time Quality Notes
Qwen2.5-Coder-7B 100% 29.58s โญโญโญโญโญ SELECTED - Best idioms
DeepSeek-Coder-6.7B 100% 27.86s โญโญโญโญโญ Didactic, verbose
Llama3.2-3B 100% 12.27s โญโญโญโญ Good balance
CodeLlama-7B 100% 24.61s โญโญโญ Confuses Zig/Rust
Qwen2.5-Coder-0.5B 100% 3.94s โŒ Invents syntax

Full benchmarks: scripts/test-results/


๐Ÿ› ๏ธ Development

# Run tests
pnpm test

# Run specific component tests
pnpm test -- lexer
pnpm test -- parser
pnpm test -- type-checker

# Watch mode
pnpm test:watch

# Linting
pnpm lint
pnpm lint:fix

# Build
pnpm build

๐Ÿค Contributing

See AGENTS.md for detailed project specification and development phases.

Current needs:

  • Testing on diverse Zig codebases
  • Edge case discovery (parser/type-checker)
  • Performance optimization
  • Documentation improvements

๐Ÿ“„ License

WTFPL v2 โ€” Do What The Fuck You Want To Public License


๐Ÿ”— Links

  • Repository: https://github.com/fulgidus/zignet
  • Model (post-training): https://huggingface.co/fulgidus/zignet-qwen2.5-coder-7b
  • MCP Protocol: https://modelcontextprotocol.io
  • Zig Language: https://ziglang.org

Status: โœ… Phase 4 Complete - Ready for deployment (fine-tuning complete, E2E tests passing)

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured