A collection of minimal, production-ready templates for building MCP (Model Context Protocol) servers in different languages.
This repository contains reference implementations of MCP servers that demonstrate best practices for building tools that integrate with Claude and other MCP-compatible clients. Each template implements a dice rolling tool as a working example.
Language: Zig 0.15.1 Dependencies: None (uses only Zig standard library) Build System: zig build
A minimal MCP server implementation in modern Zig, showcasing memory-safe systems programming.
- ✅ Zero external dependencies
- ✅ Fast compilation
- ✅ Type-safe JSON handling
- ✅ Comprehensive test suite
Language: C++20 Dependencies: RapidJSON (header-only) Build System: Make
A clean, object-oriented MCP server implementation using modern C++20 features.
- ✅ Modern C++ features (designated initializers, std::optional)
- ✅ RapidJSON for fast JSON parsing
- ✅ RAII and smart pointers
- ✅ Simple Makefile build
cd zig-mcp-template
zig build
./zig-out/bin/zig-mcp-templatecd cpp20-mcp-template
make
./build/cpp20-mcp-templateBoth templates include test scripts:
# Zig
cd zig-mcp-template && ./test_server.sh
# C++
cd cpp20-mcp-template && ./test_server.shAdd to your Claude Desktop configuration (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):
{
"mcpServers": {
"zig-dice": {
"command": "/path/to/LabMCP/zig-mcp-template/zig-out/bin/zig-mcp-template"
},
"cpp-dice": {
"command": "/path/to/LabMCP/cpp20-mcp-template/build/cpp20-mcp-template"
}
}
}All templates implement:
- MCP Protocol: Full JSON-RPC 2.0 implementation
- Tool System: Extensible tool registration and execution
- Dice Roller: Example tool accepting notation like "3d8"
- Error Handling: Proper error codes and messages
- stdio Transport: Standard input/output communication
- Testing: Integration test scripts included
LabMCP/
├── README.md # This file
├── zig-mcp-template/
│ ├── README.md
│ ├── PLAN.md
│ ├── STATUS.md
│ ├── build.zig
│ ├── src/
│ └── test_server.sh
└── cpp20-mcp-template/
├── README.md
├── PLAN.md
├── STATUS.md
├── Makefile
├── src/
├── third-party/
└── test_server.sh
Both templates are designed to be starting points:
- Clone or copy a template
- Modify the tool implementation in
src/tools/ - Update the tool registration
- Build and test
- Deploy with Claude Desktop
| Feature | Zig | C++20 |
|---|---|---|
| Build Speed | ⚡ Very Fast | 🚀 Fast |
| Dependencies | None | RapidJSON only |
| Memory Safety | ✅ Built-in | Manual (RAII) |
| Learning Curve | Moderate | Moderate-High |
| Maturity | Emerging | Mature |
| Performance | Excellent | Excellent |
Each template is self-contained and can be used independently. Feel free to:
- Fork and modify for your needs
- Add new tool implementations
- Submit improvements
- Create templates in other languages
MIT License - see individual template directories for details.
For questions or issues:
- Check individual template README files
- Review the PLAN.md files for architecture details
- Check STATUS.md files for current state
Built with: Zig 0.15.1 | C++20 | RapidJSON Protocol: MCP 2024-11-05 Status: ✅ Production Ready