Thank you for your interest in contributing to Material Web MCP! This document provides guidelines and information for contributors.
- Getting Started
- Development Setup
- Making Changes
- Testing
- Documentation
- Submitting Changes
- Release Process
- Node.js >= 18.0.0
- npm or yarn
- Git
-
Fork and Clone
git clone https://github.com/YOUR_USERNAME/material-web-mcp.git cd material-web-mcp -
Install Dependencies
npm install
-
Run Tests
npm test -
Start Development Server
npm start
main: Production-ready codedevelop: Integration branch for featuresfeature/: Feature branches (e.g.,feature/add-new-tool)fix/: Bug fix branches (e.g.,fix/handle-error-cases)release/: Release preparation branches
-
Create Feature Branch
git checkout -b feature/your-feature-name
-
Make Changes
- Follow coding standards (see below)
- Write/update tests
- Update documentation
-
Test Your Changes
npm test npm run lint npm run coverage -
Commit Changes
git add . git commit -m "feat: add new MCP tool for component validation"
- ESLint: Follow the project's ESLint configuration
- Formatting: Use Prettier (configured in the project)
- Line Length: Maximum 80 characters
- Indentation: 2 spaces
- Use ES modules (
import/export) - Use meaningful variable and function names
- Add JSDoc comments for public APIs
- Handle errors gracefully
- Use async/await over callbacks
- Follow MCP specification
- Implement proper tool definitions
- Use Zod for input validation
- Handle errors with appropriate error codes
- Log appropriately for debugging
/**
* Description of what this tool does
* @param {Object} params - Parameters for the tool
* @param {string} params.input - Input description
* @returns {Promise<Object>} Result object
*/
export async function myTool({ input }) {
try {
// Implementation
const result = await processInput(input);
return {
content: [
{
type: "text",
text: JSON.stringify(result, null, 2),
},
],
};
} catch (error) {
throw new Error(`Tool execution failed: ${error.message}`);
}
}- Unit tests in
src/*.test.mjs - Integration tests for MCP protocol compliance
- End-to-end tests for complete workflows
import { myTool } from "../server.js";
describe("myTool", () => {
test("should process input correctly", async () => {
const result = await myTool({ input: "test data" });
expect(result.content).toBeDefined();
// More assertions...
});
});npm test # Run all tests
npm test -- --watch # Watch mode
npm run coverage # Generate coverage report- Document all MCP tools with JSDoc
- Include parameter types and descriptions
- Provide usage examples
- Update README.md for significant changes
- Update documentation in
ui-docs/directory - Follow markdown syntax guidelines
- Include code examples
- Test documentation links
# Tool Name
Brief description of what this tool does.
## Parameters
- `param1` (string): Description of param1
- `param2` (number, optional): Description of param2
## Returns
Object containing the tool results.
## Example
```json
{
"result": "example output"
}
```
## Submitting Changes
### Pull Request Process
1. **Before Submitting**
- [ ] Code follows style guidelines
- [ ] Tests pass locally
- [ ] Documentation is updated
- [ ] Commit messages follow conventions
2. **Creating PR**
- Fill out the PR template completely
- Link related issues
- Include screenshots for UI changes
- Request review from maintainers
3. **PR Review**
- Address feedback promptly
- Keep PR updated with main branch
- Ensure all CI checks pass
### Commit Message Convention
We use [Conventional Commits](https://conventionalcommits.org/):
type(scope): subject
body (optional)
footer (optional)
**Types:**
- `feat`: New feature
- `fix`: Bug fix
- `docs`: Documentation changes
- `style`: Code style changes
- `refactor`: Code refactoring
- `test`: Test additions/updates
- `chore`: Build process or auxiliary tool changes
**Examples:**
```bash
feat(mcp): add component validation tool
fix(server): handle missing parameters gracefully
docs(readme): update installation instructions
We use Semantic Versioning:
- Major (X.0.0): Breaking changes
- Minor (1.1.0): New features, backward compatible
- Patch (1.0.1): Bug fixes, backward compatible
-
Prepare Release
# Update version in package.json npm version 1.0.0 # Update CHANGELOG.md # Update documentation
-
Create Release PR
- Update version numbers
- Update changelog
- Update documentation
- Include release notes
-
Merge and Tag
git tag v1.0.0 git push origin main --tags
-
GitHub Actions
- Automated testing on main branch
- Automated release on tag creation
- NPM publication
- Documentation deployment
Releases are automated through GitHub Actions:
- Triggers: Tag push or manual workflow dispatch
- Process: Build, test, publish to NPM, create GitHub release
- Artifacts: Package distribution, release notes, documentation
- Use the bug report template
- Include steps to reproduce
- Provide environment details
- Include error logs
- Use the feature request template
- Describe the use case
- Consider implementation complexity
- Discuss alternatives
- Check existing documentation
- Search existing issues
- Join discussions
- Contact maintainers
Contributors are recognized in:
- README.md contributors section
- GitHub contributors page
- Release notes for significant contributions
- Annual contributor appreciation posts
If you have questions about contributing, please:
- Check this document and other documentation
- Search existing issues
- Open a new issue with the
questionlabel - Contact maintainers directly
Thank you for contributing to Material Web MCP!