sjswerdloff/pre-commit-mcp
3.1
If you are the rightful owner of pre-commit-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The Pre-commit MCP Server is designed to integrate pre-commit checks with Claude instances, ensuring code quality and consistency before changes are committed.
Pre-commit MCP Server
An MCP (Model Context Protocol) server that provides pre-commit integration for Claude instances.
Features
- Run pre-commit on staged files with structured output
- Token-efficient output format for Claude processing
- Proper error handling and timeout management
- Git repository detection with override capability
- Support for all standard pre-commit hooks
Installation
This project uses uv for package management:
uv sync
Usage
The server provides a single tool: pre_commit_run
Parameters
force_non_git(bool, optional): Override git repository requirement. Default: False
Output Format
The tool returns structured JSON with:
status: "success" | "hooks_failed" | "system_error" | "timeout"summary: Hook execution statisticsfailures: Detailed failure information grouped by hook typemodified_files: List of files modified by hooksexecution_time: Total execution time in seconds
Development
The project includes:
- Ruff for linting and formatting
- MyPy for type checking
- Pre-commit hooks for code quality
Run pre-commit to check code quality:
pre-commit run --all-files
Configuration
The server respects the standard .pre-commit-config.yaml configuration file in the project root.