npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mcp-pre-commit

v1.0.0

Published

MCP tool server for managing git repositories and pre-commit hooks

Readme

MCP Pre-commit Manager

A Model Context Protocol (MCP) tool server that helps LLM agents manage git repositories and pre-commit hooks automatically.

Features

This MCP server provides tools to:

  • 🔍 Detect project type (Python, JavaScript, or TypeScript)
  • 📦 Check if a directory is a git repository
  • 🪝 Verify if pre-commit hooks are installed
  • 🚀 Initialize git repositories automatically
  • ⚙️ Set up pre-commit hooks based on project type

Prerequisites

  • Node.js 18 or higher
  • Git installed on your system
  • pre-commit installed (for hook installation)
    • For macOS: brew install pre-commit
    • For Python users: pip install pre-commit

Installation

Via npm (Recommended)

npm install -g mcp-pre-commit

From Source

  1. Clone or download this repository
  2. Install dependencies:
npm install
  1. Build the TypeScript code:
npm run build

Usage

Running the Server

Start the MCP server:

npm start

Or run in development mode with auto-rebuild:

npm run watch

Configuring with MCP Clients

Add this server to your MCP client configuration.

For Global npm Installation:

macOS/Linux: ~/Library/Application Support/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "pre-commit-manager": {
      "command": "mcp-pre-commit"
    }
  }
}

Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "pre-commit-manager": {
      "command": "mcp-pre-commit"
    }
  }
}

For Source Installation:

{
  "mcpServers": {
    "pre-commit-manager": {
      "command": "node",
      "args": ["/absolute/path/to/mcp-pre-commit/dist/index.js"]
    }
  }
}

For Other MCP Clients:

Refer to your MCP client's documentation for configuration instructions. The command is mcp-pre-commit (for npm installation) or node /path/to/dist/index.js (for source installation).

Available Tools

1. check_project_setup

Analyzes a repository and returns its setup status.

Parameters:

  • repo_path (optional): Path to the repository (defaults to current directory)

Returns:

{
  "repository_path": "/path/to/repo",
  "project_type": "python",
  "is_git_repository": true,
  "has_precommit_hooks": false,
  "status": "⚠️ Git repository exists but pre-commit hooks are not installed"
}

Example usage in LLM conversation:

Check the project setup for /Users/john/my-project

2. setup_git_and_precommit

Initializes git repository and sets up pre-commit hooks based on detected project type.

Parameters:

  • repo_path (optional): Path to the repository (defaults to current directory)
  • force_project_type (optional): Force specific project type (python, javascript, or typescript)

Returns: Status messages about git initialization and pre-commit hook setup.

Example usage in LLM conversation:

Set up git and pre-commit hooks for /Users/john/my-project

Pre-commit Hook Configurations

Python Projects

  • Trailing whitespace removal
  • End-of-file fixer
  • YAML, JSON, TOML checkers
  • Black code formatter
  • Flake8 linter
  • isort import sorter

JavaScript/TypeScript Projects

  • Trailing whitespace removal
  • End-of-file fixer
  • YAML, JSON checkers
  • ESLint with TypeScript support
  • Prettier code formatter

Unknown/Other Projects

  • Basic pre-commit hooks (whitespace, file fixes, YAML/JSON validation)

Development

Project Structure

mcp-pre-commit/
├── src/
│   └── index.ts          # Main server implementation
├── dist/                 # Compiled JavaScript (generated)
├── package.json          # Dependencies and scripts
├── tsconfig.json         # TypeScript configuration
└── README.md            # This file

Build Commands

  • npm run build - Compile TypeScript to JavaScript
  • npm run dev - Build and run once
  • npm run watch - Watch mode for development

How It Works

  1. Project Type Detection: Scans for common configuration files:

    • Python: setup.py, pyproject.toml, requirements.txt, etc.
    • TypeScript: tsconfig.json
    • JavaScript: package.json
  2. Git Repository Check: Uses git rev-parse --is-inside-work-tree to verify git status

  3. Pre-commit Hook Detection: Checks for:

    • .pre-commit-config.yaml configuration file
    • Actual hook file in .git/hooks/pre-commit
  4. Automatic Setup:

    • Initializes git if needed (git init)
    • Creates appropriate .pre-commit-config.yaml based on project type
    • Runs pre-commit install to activate hooks

Error Handling

The server provides clear error messages for common issues:

  • Missing pre-commit installation
  • Permission errors
  • Invalid repository paths
  • Undetectable project types (use force_project_type parameter)

Badges

npm version License: MIT Node.js Version

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for details on:

  • Reporting bugs
  • Suggesting enhancements
  • Submitting pull requests
  • Code style guidelines

Feel free to extend this server with additional features:

  • Support for more project types (Go, Rust, etc.)
  • Custom hook configurations
  • Additional git operations
  • Pre-commit hook testing

Changelog

See CHANGELOG.md for a list of changes in each version.

Support

If you encounter any issues or have questions:

  • Open an issue on GitHub Issues
  • Check existing issues for solutions
  • Review the FAQ section

License

MIT - see LICENSE file for details