Thank you for your interest in contributing to the Metasploit MCP Server! This document provides guidelines and information for contributors.
This project adheres to a code of conduct that we expect all contributors to follow:
- Be respectful and inclusive
- Focus on constructive feedback
- Help others learn and grow
- Maintain professionalism in all interactions
- Python 3.8 or higher
- Poetry for dependency management
- Git for version control
- Metasploit Framework (for testing with real backend)
-
Fork and Clone
git clone https://github.com/your-username/MetasploitMCP.git cd MetasploitMCP -
Install Dependencies
poetry install poetry shell
-
Verify Setup
poetry run pytest
Before creating an issue, please:
- Search existing issues to avoid duplicates
- Use the issue template if available
- Provide clear reproduction steps
- Include relevant system information
- Clear description of the problem
- Steps to reproduce the issue
- Expected vs actual behavior
- Environment details (OS, Python version, Poetry version)
- Relevant log output
- Metasploit version (if applicable)
- Clear description of the proposed feature
- Use case and motivation
- Possible implementation approach
- Any breaking changes considerations
- Create an issue to discuss major changes
- Fork the repository and create a feature branch
- Write tests for new functionality
- Update documentation as needed
- Ensure all tests pass
-
Create a Feature Branch
git checkout -b feature/your-feature-name
-
Make Your Changes
- Follow the existing code style
- Add tests for new functionality
- Update documentation if needed
-
Test Your Changes
# Run all tests poetry run pytest # Run specific tests poetry run pytest tests/test_your_feature.py -v
-
Commit Your Changes
git add . git commit -m "feat: add your feature description"
-
Push and Create PR
git push origin feature/your-feature-name
- All tests pass (
poetry run pytest) - Code is formatted (
make format, or CI'sblack --checkwill fail) - SBOM is in sync if dependencies changed (
make sbomthen commit; CI's SBOM freshness check will fail otherwise) - New functionality has tests
- Documentation updated (if applicable)
- CHANGELOG.md updated
- Commit messages follow conventional format
- No merge conflicts with main branch
- Follow PEP 8 Python style guidelines
- Format with black — run
make formatbefore committing (CI enforcesblack --check) - Use type hints where appropriate (
make type-checkrunsmypy; currently advisory in CI) - Write docstrings for public functions and classes
- Keep functions focused and reasonably sized
- Use meaningful names for variables and functions
- Regenerate the SBOM after any dependency change —
make sbom(CI's SBOM freshness check enforces this)
- Unit Tests: Test individual functions (
test_helpers.py) - Integration Tests: Test tool workflows (
test_tools_integration.py) - Feature Tests: Test specific features (
test_ip_validation.py)
import pytest
from unittest.mock import Mock, patch
class TestYourFeature:
"""Test suite for your feature."""
def test_success_case(self):
"""Test the happy path."""
# Arrange
input_data = {"key": "value"}
# Act
result = your_function(input_data)
# Assert
assert result["status"] == "success"
def test_error_case(self):
"""Test error handling."""
with pytest.raises(ValueError):
your_function(invalid_input)- Use descriptive test names
- Follow AAA pattern (Arrange, Act, Assert)
- Mock external dependencies
- Test both success and error cases
- Use appropriate fixtures from
conftest.py
- Docstrings: Use Google-style docstrings
- Type hints: Include for function parameters and returns
- Comments: Explain complex logic, not obvious code
def validate_bind_address(bind_address: str) -> Tuple[bool, str]:
"""
Validate that a bind address is either a wildcard or locally configured.
Args:
bind_address: IP address to validate
Returns:
Tuple of (is_valid, error_message)
Raises:
ValueError: If address format is invalid
"""- Update
README.mdfor user-facing changes - Update
docs/API.mdfor new tools or parameters - Update
docs/DEVELOPMENT.mdfor development process changes - Update
CHANGELOG.mdfor all changes
Use Conventional Commits format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
feat:New featuresfix:Bug fixesdocs:Documentation changestest:Test additions/changesrefactor:Code refactoringchore:Maintenance tasksci:CI/CD changes
feat: add bind address validation for listeners
fix: resolve FastMCP HTTP transport configuration issue
docs: update API documentation for new parameters
test: add integration tests for payload generation
This project follows Semantic Versioning:
- MAJOR: Breaking changes
- MINOR: New features (backward compatible)
- PATCH: Bug fixes (backward compatible)
- Update version in
pyproject.toml - Update
CHANGELOG.mdwith release notes - Ensure all tests pass
- Create release branch
- Tag release
- Update documentation
- Documentation: Check
docs/directory - Issues: Search existing GitHub issues
- Discussions: Use GitHub Discussions for questions
- GitHub Issues: For bugs and feature requests
- GitHub Discussions: For questions and general discussion
- Pull Requests: For code contributions
Contributors will be recognized in:
CHANGELOG.mdfor significant contributions- GitHub contributors list
- Release notes for major contributions
Thank you for contributing to the Metasploit MCP Server! 🚀