Thank you for your interest in contributing to Prometheus MCP Server! We welcome contributions from the community and are grateful for your support.
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Coding Standards
- Testing Guidelines
- Pull Request Process
- Release and Versioning
- Community and Support
This project adheres to a code of conduct that all contributors are expected to follow. By participating, you are expected to uphold this code. Please be respectful, inclusive, and considerate in all interactions.
Before creating bug reports, please check the issue tracker to avoid duplicates. When you create a bug report, include as many details as possible:
- Use the bug report template - Fill in the template
- Use a clear and descriptive title - Summarize the issue in the title
- Describe the exact steps to reproduce - Be specific about what you did
- Provide specific examples - Include code samples or configuration files
- Describe the behavior you observed - Explain what actually happened
- Explain the expected behavior - What you expected to happen instead
- Include screenshots - If applicable, add screenshots to help explain your problem
- Specify your environment:
- OS version
- Python version
- Prometheus version
- MCP client being used
Feature suggestions are tracked as GitHub issues. When creating a feature suggestion:
- Use the feature request template - Fill in the template
- Use a clear and descriptive title - Summarize the feature in the title
- Provide a detailed description - Explain the feature and its benefits
- Describe the current behavior - If applicable, describe what currently happens
- Describe the proposed behavior - Explain how the feature would work
- Explain why this would be useful - Describe the use cases and benefits
- List alternatives considered - If you've thought of other solutions, mention them
We actively welcome your pull requests! Here's how to contribute code:
- Fork the repository and create your branch from
main - Make your changes following our coding standards
- Add tests for any new functionality
- Ensure all tests pass and maintain or improve code coverage
- Update documentation if you've changed functionality
- Submit a pull request with a clear description of your changes
This project uses uv for dependency management. Follow these steps to set up your development environment:
- Python 3.10 or higher
- A running Prometheus server (for testing)
- Git
-
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh -
Clone your fork:
git clone https://github.com/YOUR_USERNAME/prometheus-mcp-server.git cd prometheus-mcp-server -
Create and activate a virtual environment:
uv venv source .venv/bin/activate # On Unix/macOS .venv\Scripts\activate # On Windows
-
Install dependencies:
# Install the package in editable mode with dev dependencies uv pip install -e ".[dev]"
-
Set up environment variables:
cp .env.template .env # Edit .env with your Prometheus URL and credentials
Please follow these guidelines when writing code:
- Follow PEP 8 style guide
- Use meaningful variable and function names
- Write docstrings for all public modules, functions, classes, and methods
- Keep functions focused and single-purpose
- Maximum line length: 100 characters (when practical)
- Place new functionality in appropriate modules
- Keep related code together
- Avoid circular dependencies
- Use type hints where appropriate
- Update the README.md if you change functionality
- Add docstrings to new functions and classes
- Comment complex logic or non-obvious implementations
- Keep comments up-to-date with code changes
Write clear, concise commit messages:
- Use the present tense ("Add feature" not "Added feature")
- Use the imperative mood ("Move cursor to..." not "Moves cursor to...")
- Limit the first line to 72 characters or less
- Reference issues and pull requests when relevant
- For example:
feat: add support for custom headers in Prometheus requests - Adds PROMETHEUS_CUSTOM_HEADERS environment variable - Updates documentation with usage examples - Includes tests for header validation Fixes #106
All contributions must include appropriate tests. We use pytest for testing.
# Run all tests
pytest
# Run with coverage report
pytest --cov=src --cov-report=term-missing
# Run specific test file
pytest tests/test_specific.py
# Run tests matching a pattern
pytest -k "test_pattern"- Write tests for new features - All new functionality must have corresponding tests
- Maintain code coverage - Aim for 80%+ code coverage (enforced by CI)
- Test edge cases - Consider error conditions and boundary cases
- Use meaningful test names - Test names should describe what they're testing
- Keep tests isolated - Tests should not depend on each other
- Mock external dependencies - Use
pytest-mockfor mocking Prometheus API calls
def test_feature_description():
"""Test that feature does what it should."""
# Arrange - Set up test conditions
# Act - Execute the functionality being tested
# Assert - Verify the results-
Update your fork with the latest changes from
main:git fetch upstream git rebase upstream/main
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the guidelines above
-
Run tests locally:
pytest --cov=src --cov-report=term-missing
-
Push to your fork:
git push origin feature/your-feature-name
-
Create a Pull Request with:
- A clear title describing the change
- A detailed description of what changed and why
- References to related issues (e.g., "Fixes #123")
- Screenshots or examples if applicable
-
Address review feedback - Be responsive to comments and suggestions
-
Wait for CI/CD checks - All automated checks must pass:
- Tests must pass
- Code coverage must meet minimum threshold (80%)
- No security vulnerabilities detected
Before submitting, ensure your PR:
- Follows the coding standards
- Includes tests for new functionality
- All tests pass locally
- Maintains or improves code coverage
- Updates documentation as needed
- Has a clear and descriptive title
- Includes a detailed description
- References any related issues
Important: Releases and versioning are managed exclusively by repository administrators. Contributors should not:
- Modify version numbers in
pyproject.toml - Create release tags
- Update changelog entries for releases
The maintainers will handle:
- Version bumping according to Semantic Versioning
- Creating and publishing releases
- Updating changelogs
- Publishing to package registries
- Building and pushing Docker images
If you believe a release should be created, please open an issue to discuss it with the maintainers.
- Questions: Use the question template
- Discussions: Check existing issues for similar questions
- Documentation: Review the README for comprehensive documentation
Contributors are recognized in:
- Commit history and pull request comments
- GitHub's contributor graph
- Release notes for significant contributions
Thank you for contributing to Prometheus MCP Server! Your efforts help make this project better for everyone.