Thank you for your interest in contributing to the DIY Tools MCP Server! This guide will help you get started with contributing to this project.
By participating in this project, you agree to abide by our code of conduct: be respectful, inclusive, and constructive in all interactions. We welcome contributors from all backgrounds and skill levels.
Before creating a new issue, please:
- Check existing issues - Search through open and closed issues to avoid duplicates
- Use issue templates when available for consistency
- Provide detailed information including:
- Clear description of the problem or feature request
- Steps to reproduce (for bugs)
- Expected vs actual behavior
- System information (OS, Node.js version)
- Relevant logs or error messages
- Code samples or screenshots if applicable
- Check the roadmap in README.md to see if the feature is already planned
- Open a discussion first for major features to gather feedback
- Provide clear use cases and examples of how the feature would be used
- Consider backward compatibility and potential breaking changes
- Fork the repository and create your own copy
- Create a feature branch from
develop:git checkout -b feature/amazing-feature
- Make your changes following the code style guidelines
- Write or update tests for any new functionality
- Update documentation if your changes affect user-facing features
- Commit your changes using conventional commit messages
- Push to your fork and create a pull request
- Fill out the PR template with:
- Clear title and description
- Link to related issue(s)
- Screenshots or examples if applicable
- Testing instructions for reviewers
- Node.js 18.0.0 or higher (check with
node --version) - npm package manager
- Git for version control
# Clone your fork
git clone https://github.com/YOUR_USERNAME/diy-tools-mcp.git
cd diy-tools-mcp
# Install dependencies
npm install
# Build the project
npm run build
# Run the development server with auto-reload
npm run dev
# Run tests to ensure everything is working
npm testSee DEVELOPMENT.md for a complete list of available npm scripts and their usage.
See PROJECT-STRUCTURE.md for detailed information about the codebase organization and architecture.
This project uses TypeScript with strict type checking and follows consistent coding standards:
- TypeScript for all source code
- ES2022 features and modules
- Node.js runtime environment
- Semicolons: Always use semicolons
- Quotes: Single quotes for strings
- Indentation: 2 spaces, no tabs
- Line length: Maximum 100 characters
- Trailing commas: Use ES5-style trailing commas
- Meaningful names: Use descriptive variable and function names
- Small functions: Keep functions focused and small
- Type safety: Avoid
anytypes when possible - Error handling: Handle errors gracefully with proper error messages
- Documentation: Add JSDoc comments for public APIs
- Testing: Write tests for new features and bug fixes
The project uses automated tools to maintain code quality:
- ESLint: Linting with TypeScript-specific rules
- Prettier: Code formatting
- TypeScript: Static type checking
- Jest: Testing framework
- Husky & lint-staged: Pre-commit hooks for automatic code quality checks
This project uses pre-commit hooks to automatically ensure code quality before each commit. When you commit changes, the following checks will run automatically on staged files:
- ESLint: Automatically fixes and checks for linting errors
- Prettier: Formats your code consistently
- TypeScript: Runs type checking to catch type errors
These hooks are managed by Husky and lint-staged, and will be automatically set up when you run npm install.
If the pre-commit hooks fail, your commit will be blocked. Fix the reported issues and try committing again.
All code quality checks must pass before merging:
# Run all quality checks manually
npm run lint
npm run format:check
npm run typecheck
npm testWe use conventional commits for clear and consistent commit messages:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
feat:- New feature for usersfix:- Bug fixdocs:- Documentation changesstyle:- Code style changes (formatting, missing semicolons, etc.)refactor:- Code changes that neither fix bugs nor add featurestest:- Adding or modifying testschore:- Build process, tooling, or dependency updates
feat: add configurable entry points for file-based functions
fix: resolve path traversal vulnerability in file validation
docs: update README with new security features
test: add integration tests for Python function execution
chore: update ESLint configuration for TypeScript 5.0Include a scope to specify the area of change:
feat(executor): add timeout configuration for function execution
fix(security): prevent access to system directories
docs(api): update function registration examples- Write tests for all new features and bug fixes
- Update existing tests when modifying functionality
- Aim for high coverage - the CI pipeline reports coverage metrics
- Test edge cases and error conditions
- Unit tests: Test individual functions and modules
- Integration tests: Test component interactions and workflows
- Security tests: Validate security measures and protections
See DEVELOPMENT.md for testing commands and guidelines.
- Descriptive test names: Clearly describe what is being tested
- Arrange-Act-Assert: Structure tests with clear setup, execution, and verification
- Mock external dependencies: Use Jest mocks for external services and file system operations
- Test both success and failure cases: Include error scenarios and edge cases
- JSDoc comments for public functions, classes, and interfaces
- Inline comments for complex logic or business rules
- Type annotations for better code understanding
- Update README.md for user-facing changes
- Include examples for new features
- Update function specifications if changing APIs
/**
* Validates and registers a new custom tool.
*
* @param toolSpec - The tool specification including code and parameters
* @param options - Optional configuration for registration
* @returns Promise resolving to the registered tool metadata
* @throws {ValidationError} When tool specification is invalid
* @throws {SecurityError} When file-based code fails security checks
*/
async function registerTool(toolSpec: ToolSpec, options?: RegisterOptions): Promise<ToolMetadata>All pull requests must pass automated checks:
- Linting: ESLint checks for code quality
- Formatting: Prettier checks for consistent formatting
- Type checking: TypeScript compiler validates types
- Tests: Jest runs all test suites
- Coverage: Coverage reports are generated and uploaded
- Automated checks must pass before human review
- Maintainer review - At least one project maintainer must approve
- Address feedback - Respond to comments and make requested changes
- Re-review - Additional review cycles as needed
- Approval and merge - Maintainer merges after approval
The project uses GitHub Actions for continuous integration:
- Node.js versions: Tests run on Node.js 18.x and 20.x
- Operating system: Tests run on Ubuntu latest
- Automated reporting: Coverage reports are uploaded to Codecov
- Main branch:
main- Production-ready code - Development branch:
develop- Integration branch for features - Feature branches:
feature/description- Individual features - Bug fix branches:
fix/description- Bug fixes
- Create feature branch from
develop - Implement changes with tests and documentation
- Commit frequently with clear messages
- Push to your fork regularly
- Create pull request when ready
- Address review feedback as needed
- Merge after approval
See SECURITY.md for detailed security reporting procedures.
- Validate all inputs from external sources
- Sanitize file paths to prevent directory traversal
- Limit resource usage to prevent denial of service
- Review dependencies for known vulnerabilities
- Follow principle of least privilege in code design
- GitHub Discussions: For general questions and feature discussions
- Issues: For bug reports and specific problems
- Code comments: For clarification on specific code sections
- README.md: Project overview and usage instructions
- DEVELOPMENT.md: Available scripts and commands
- PROJECT-STRUCTURE.md: Codebase organization
- SECURITY.md: Security policies and procedures
- Examples directory: Sample functions and usage patterns
- Tests: Examples of expected behavior and usage
Contributors will be recognized in:
- Git history: Your commits will be preserved with proper attribution
- Release notes: Significant contributions will be mentioned
- Documentation: Major contributors may be listed in project docs
Thank you for contributing to the DIY Tools MCP Server! Your contributions help make this project better for everyone.