Provides AI-powered tools for Zig programming language development including code generation from natural language descriptions, code debugging and analysis, and explanations of language features and standard library documentation.
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
Analyze Zig code for syntax errors, type mismatches, and semantic issues using zig ast-check.
Example usage:
Capabilities:
Lexical analysis (tokenization)
Syntax parsing (AST generation)
Type checking and validation
Semantic error detection
Line/column error reporting
Validate and format Zig code using zig fmt, generating clean, idiomatic output.
Example:
Capabilities:
Code formatting (2-space indentation)
Syntax validation
Best practices enforcement
Preserves semantics
Retrieve Zig documentation and explanations for language features using a fine-tuned LLM.
Example:
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)
Get intelligent code fix suggestions for Zig errors using AI-powered analysis.
Example:
Features:
Context-aware suggestions
Multiple fix options
Explanation of the issue
Zig idiom recommendations
š Usage
ZigNet is an MCP server ā configure it once in your MCP client, then use it naturally in conversation.
Configuration file location:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonLinux:
~/.config/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add this:
Then restart Claude Desktop and start using:
Method 1: VS Code Marketplace (coming soon)
Open VS Code Extensions (
Ctrl+Shift+X/Cmd+Shift+X)Search for
@mcp zignetClick Install
Restart VS Code
Method 2: Manual configuration (available now)
Install GitHub Copilot extension (if not already installed)
Open Copilot settings
Add to MCP servers config:
Then restart VS Code and Copilot will have access to ZigNet tools.
What happens after configuration?
First use:
npxdownloads and caches ZigNet automaticallyZig compiler: Downloads on-demand (supports Zig 0.13, 0.14, 0.15)
Tools available:
analyze_zig,compile_zig(+get_zig_docs,suggest_fixcoming soon)Zero maintenance: Updates automatically via
npx -y zignet
āļø Configuration
GPU Selection (Multi-GPU Systems)
If you have multiple GPUs (e.g., AMD + NVIDIA), you can control which GPU ZigNet uses via environment variables.
Windows (PowerShell):
macOS/Linux:
VS Code MCP Configuration with GPU selection:
Claude Desktop configuration with GPU selection:
macOS/Linux (~/.config/Claude/claude_desktop_config.json):
Windows (%APPDATA%\Claude\claude_desktop_config.json):
GPU Device Values:
"0"- Use first GPU only (e.g., RTX 4090)"1"- Use second GPU only"0,1"- Use both GPUsNot set - Use all available GPUs (default)
Identify your GPUs:
Advanced Configuration
All configuration options can be set via environment variables:
Variable | Default | Description |
| auto | GPU device selection (CUDA_VISIBLE_DEVICES) |
| 35 | Number of model layers on GPU (0=CPU only) |
|
| Custom model path |
| true | Auto-download model from HuggingFace |
| 4096 | LLM context window size |
| 0.7 | LLM creativity (0.0-1.0) |
| 0.9 | LLM sampling parameter |
| 0.13.0,0.14.0,0.15.2 | Supported Zig versions |
| 0.15.2 | Default Zig version |
See .env.example for detailed examples.
šļø Architecture
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
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
š¤ 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
š¤ 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)