Thank you for your interest in contributing to the Apple Mail MCP Server! This document provides guidelines and instructions for contributing to this project.
- Getting Started
- Development Setup
- How to Contribute
- Code Standards
- Testing Requirements
- Pull Request Process
- Reporting Issues
- Getting Help
Contributions are welcome! Whether you're fixing bugs, adding features, improving documentation, or reporting issues, your help is appreciated.
Before contributing, ensure you have:
- macOS (required for development and testing)
- Go 1.21 or later
- Apple Mail.app installed and configured
- Git
- Basic familiarity with Go and AppleScript
-
Fork and clone the repository:
git clone https://github.com/YOUR_USERNAME/apple-mail-mcp.git cd apple-mail-mcp -
Install dependencies:
go mod download
-
Build the project:
make build
-
Run tests to ensure everything works:
make test
We welcome various types of contributions:
- Bug fixes: Fix issues and improve stability
- New features: Add new tools or enhance existing ones
- Documentation: Improve README, technical docs, or code comments
- Tests: Add test coverage or improve existing tests
- Performance: Optimize code or reduce resource usage
- Code quality: Refactoring, cleanup, or following best practices
-
Fork the repository on GitHub
-
Create a feature branch from
main:git checkout -b feature/your-feature-name
or
git checkout -b fix/your-bug-fix
-
Make your changes following the code standards below
-
Write or update tests for your changes
-
Run tests and quality checks:
make test make check -
Commit your changes with clear, descriptive messages:
git commit -m "Add feature: description of what you added" -
Push to your fork:
git push origin feature/your-feature-name
-
Open a Pull Request on GitHub with:
- Clear title and description
- Reference to any related issues
- Description of changes and why they're needed
- Test results and any manual testing performed
Follow standard Go conventions and best practices:
- Formatting: Use
gofmtormake fmtto format code - Naming: Use idiomatic Go naming conventions
- Exported names:
CamelCase - Unexported names:
camelCase - Acronyms:
HTTPServer, notHttpServer
- Exported names:
- Comments:
- Document all exported functions, types, and constants
- Use complete sentences with proper punctuation
- Start with the name being documented
- Error handling: Always check and handle errors appropriately
- Package organization: Keep related functionality together
- Linting: Code must pass
golangci-lintchecksmake lint
- Simplicity: Prefer clear, simple code over clever solutions
- Avoid premature optimization: Focus on correctness first
- Security: Always validate and sanitize inputs
- Logging: Use appropriate log levels (DEBUG, INFO, ERROR)
- AppleScript security: Always escape and validate parameters before executing AppleScript
- Input validation: Use the security package for all external inputs
- Error types: Use or extend existing error types from
internal/models/errors.go - Tool handlers: Follow the pattern established in
internal/mail/connector.go
All contributions must include appropriate tests:
- Target coverage: Aim for good test coverage for new code, especially in security-critical areas
- Current status: Security and utility packages have test coverage; contributions to expand test coverage are welcome
- Check coverage:
make test-coverage make coverage-html # View in browser
-
Unit tests: Test individual functions and methods
- Place tests in
*_test.gofiles alongside source - Use table-driven tests for multiple test cases
- Mock external dependencies (AppleScript, file system)
- Place tests in
-
Test naming: Use descriptive names
func TestValidateEmail_ValidAddress_ReturnsTrue(t *testing.T) { ... } func TestValidateEmail_InvalidFormat_ReturnsError(t *testing.T) { ... }
-
Test structure: Follow Arrange-Act-Assert pattern
// Arrange: Setup test data and conditions email := "test@example.com" // Act: Execute the function being tested result := ValidateEmail(email) // Assert: Verify the results assert.True(t, result)
# Run all tests
make test
# Run specific package tests
go test ./internal/security/...
# Run with race detection
go test -race ./...
# Run specific test
go test -run TestValidateEmail ./pkg/utils/- Code follows Go conventions and project guidelines
- All tests pass:
make test - Code is formatted:
make fmt - Linter passes:
make lint(if available) - Tests added for new functionality (especially security-critical code)
- Documentation is updated (README, TECHNICAL.md, code comments)
- Commit messages are clear and descriptive
## Description
Brief description of changes
## Type of Change
- [ ] Bug fix
- [ ] New feature
- [ ] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring
## Changes Made
- List of specific changes
## Testing
- How you tested the changes
- Test coverage results
## Related Issues
Fixes #(issue number)
## Checklist
- [ ] Tests pass
- [ ] Code is formatted
- [ ] Documentation updated- A maintainer will review your PR
- Address any requested changes
- Once approved, a maintainer will merge your PR
- Your contribution will be included in the next release
When reporting bugs, please include:
- Description: Clear description of the issue
- Environment:
- macOS version
- Go version
- Mail.app version
- Server version
- Steps to reproduce: Detailed steps to reproduce the issue
- Expected behavior: What you expected to happen
- Actual behavior: What actually happened
- Logs: Relevant error messages or debug logs
- Additional context: Screenshots, configuration, etc.
For feature requests, please describe:
- Use case: Why this feature is needed
- Proposed solution: How you envision it working
- Alternatives considered: Other approaches you've thought about
- Impact: Who would benefit from this feature
If you need help with your contribution:
- Check the README and TECHNICAL.md
- Review the Troubleshooting Guide
- Look at existing code and tests for examples
- Open a GitHub issue with the
questionlabel - Describe what you're trying to do and where you're stuck
Be respectful, constructive, and professional in all interactions. We aim to maintain a welcoming and inclusive environment for all contributors.
By contributing to this project, you agree that your contributions will be licensed under the MIT License.
Thank you for contributing to Apple Mail MCP Server! 🎉