Thank you for your interest in contributing to mcpstat! This document provides guidelines and instructions for contributing.
- Code of Conduct
- Getting Started
- Development Setup
- Coding Standards
- Submitting Changes
- Reporting Issues
Please read and follow our Code of Conduct.
- Fork the repository
- Clone your fork:
git clone https://github.com/YOUR_USERNAME/mcpstat.git cd mcpstat - Create a virtual environment and install dependencies:
python3 -m venv venv source venv/bin/activate # Linux/macOS # or: venv\Scripts\activate # Windows pip install -e ".[dev]"
# Run all tests with coverage (configured in pyproject.toml)
pytest
# Run specific test file
pytest tests/test_mcpstat.py
# Run without coverage
pytest tests/ --no-covmypy mcpstat/# Ruff (primary linter)
ruff check .
# Ruff with auto-fix
ruff check . --fix- Follow PEP 8 for Python code
- Use snake_case for functions and variables
- Use CamelCase for class names
- Maximum line length: 127 characters
Install pre-commit hooks to automatically check code quality before commits:
# Install pre-commit
pip install pre-commit
# Install the git hooks
pre-commit install
# Run all hooks manually (optional)
pre-commit run --all-filesThe pre-commit configuration includes:
- Ruff: Fast Python linting and formatting
- Mypy: Static type checking
- Bandit: Security vulnerability scanning
- Standard hooks: Trailing whitespace, YAML/TOML/JSON validation
# Full check suite (before PR)
ruff check .
mypy mcpstat/
pytest tests/ -v
# Format code
ruff format .- Add docstrings to all public methods and classes
- Follow Google-style docstrings
- Update README.md if adding user-facing features
- Use type hints for function parameters and return values
- Use
TYPE_CHECKINGfor import-only type hints
from typing import TYPE_CHECKING
if TYPE_CHECKING:
from mcp.types import ToolFollow conventional commit format:
type(scope): short description
Longer description if needed.
Fixes #123
Types: feat, fix, docs, style, refactor, test, chore
- Create a feature branch:
git checkout -b feature/your-feature-name
- Make your changes with clear, descriptive commits
- Ensure all checks pass:
pytest tests/ mypy mcpstat/ ruff check . - Push to your fork and create a pull request
- Tests pass locally
- Code follows style guidelines (ruff, mypy clean)
- Documentation updated (if applicable)
- CHANGELOG.md updated under
[Unreleased] - Commits are clean and well-described
Include:
- mcpstat version (
pip show mcpstat) - Python version (
python --version) - Operating system
- Minimal reproducible example
- Expected vs actual behavior
- Error messages or logs
Include:
- Clear description of the feature
- Use case / motivation
- Possible implementation approach (optional)
- Open a GitHub Discussion
- Check existing issues
Thank you for contributing to mcpstat! 🎉