Contributing
Thank you for your interest in contributing to mcp.zig! We welcome contributions from the community.
Ways to Contribute
- 🐛 Report Bugs - Found a bug? Open an issue!
- 💡 Suggest Features - Have an idea? Let us know!
- 📝 Improve Documentation - Help make docs better
- 🔧 Submit Pull Requests - Fix bugs or add features
Getting Started
1. Fork and Clone
bash
git clone https://github.com/YOUR_USERNAME/mcp.zig.git
cd mcp.zig2. Build the Project
bash
zig build3. Run Tests
bash
zig build test4. Make Your Changes
Create a new branch for your changes:
bash
git checkout -b feature/my-new-featureCode Guidelines
Style
- Follow Zig's official style guide
- Use meaningful variable and function names
- Add documentation comments for public APIs
- Keep functions focused and small
Documentation
zig
/// Brief description of the function.
///
/// More detailed description if needed.
///
/// ## Parameters
/// - `param1`: Description of param1
/// - `param2`: Description of param2
///
/// ## Returns
/// Description of the return value.
///
/// ## Errors
/// - `error.SomeError`: When this error occurs
pub fn myFunction(param1: Type1, param2: Type2) !ReturnType {
// ...
}Testing
- Add tests for new functionality
- Ensure all existing tests pass
- Use
std.testing.allocatorin tests
zig
test "my feature works" {
const allocator = std.testing.allocator;
// Test implementation
try std.testing.expect(result == expected);
}Pull Request Process
- Update Documentation - Update docs if needed
- Add Tests - Add tests for new features
- Run Tests - Ensure all tests pass
- Create PR - Submit your pull request
- Describe Changes - Clearly describe what you changed
PR Title Format
type(scope): description
Examples:
feat(server): add resource templates support
fix(jsonrpc): handle null request IDs
docs(guide): add advanced usage section
test(client): add connection testsTypes
feat- New featurefix- Bug fixdocs- Documentationtest- Testsrefactor- Code refactoringchore- Maintenance
Development Setup
Prerequisites
- Zig 0.15.0+
- Git
- (Optional) Node.js 20+ for docs
Building Documentation
bash
cd docs
npm install
npm run docs:devProject Structure
mcp.zig/
├── src/
│ ├── mcp.zig # Main entry point
│ ├── protocol/ # Protocol implementation
│ ├── server/ # Server implementation
│ ├── client/ # Client implementation
│ └── transport/ # Transport implementations
├── examples/ # Example code
├── docs/ # VitePress documentation
└── build.zig # Build configurationCode of Conduct
- Be respectful and inclusive
- Welcome newcomers
- Accept constructive criticism
- Focus on what's best for the community
Questions?
- Open a Discussion
- Check existing Issues
License
By contributing, you agree that your contributions will be licensed under the MIT License.