Hooks MCP
HooksMCP is a tool that provides MCP access rights to coding agents through a YAML configuration file. It supports functions such as code inspection, testing, and formatting, simplifies the development process, and enhances security.
2.5 points
9.3K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

🚀 Give coding agents MCP access to linting, testing, formatting, and more.

Give coding agents MCP access to linting, testing, formatting, and more with just one YAML file. This project simplifies the setup, enhances security, and improves the efficiency of coding agents.

🚀 Quick Start

  1. Install with uv:
uv tool install hooks-mcp
  1. Create an file in your project root defining your tools. For example:
actions:
  - name: "all_tests"
    description: "Run all tests in the project"
    command: "uv run python -m pytest ./tests"
    
  - name: "check_format"
    description: "Check if the source code is formatted correctly"
    command: "uvx ruff format --check ."
    
  - name: "typecheck"
    description: "Typecheck the source code"
    command: "uv run pyright ."

  - name: "test_file"
    description: "Run tests in a specific file or directory"
    command: "python -m pytest $TEST_PATH"
    parameters:
      - name: "TEST_PATH"
        type: "project_file_path"
        description: "Path to test file or directory"
  1. Run the server:
uvx hooks-mcp

See running HooksMCP for more runtime options, including how to run in Cursor, Windsurf, etc.

✨ Features

  1. Simple setup: One YAML file is all it takes to create a custom MCP server for your coding agents. Similar to package.json scripts or Github Actions workflows, but commands are triggered by MCP functions. Add the YAML to your repo to share with your team.
  2. Tool discovery: Coding agents know which dev-tools are available and the exact arguments they require. No more guessing CLI strings.
  3. Improved security: Limit which commands agents can run. Validate the arguments agents generate (e.g. ensure a file path is inside the project).
  4. Works anywhere MCP works: Cursor, Windsurf, Cline, etc
  5. Speed: Using MCP unlocks parallel execution, requires fewer tokens for generating commands, and eliminates errors in commands requiring iteration.
  6. And more: Strip ANSI codes/control characters, .env file loading, define required secrets without checking them in, supports exit codes/stdout/stderr, etc

📚 Documentation

Configuration File Specification

The hooks_mcp.yaml file defines the tools that will be exposed through the MCP server. See this project's hooks_mcp.yaml as an example.

Top-level Fields

  • server_name (optional): Name of the MCP server (default: "HooksMCP")
  • server_description (optional): Description of the MCP server (default: "Project-specific development tools exposed via MCP")
  • actions (required): Array of action definitions

Action Fields

Each action in the actions array can have the following fields:

  • name (required): Unique identifier for the tool
  • description (required): Human-readable description of what the tool does
  • command (required): The CLI command to execute. May include dynamic parameters like $TEST_FILE_PATH.
  • parameters (optional): Definitions of each parameter used in the command.
  • run_path (optional): Relative path from project root where the command should be executed. Useful for mono-repos.
  • timeout (optional): Timeout in seconds for command execution (default: 60 seconds)

Parameter Fields

Each parameter in an action's parameters array can have the following fields:

  • name (required): The parameter name to substitute into the command. For example TEST_FILE_PATH.
  • type (required): One of the following parameter types:
    • project_file_path: A local path within the project, relative to project root. Validated to ensure it's within project boundaries and exists.
    • required_env_var: An environment variable that must be set before the server starts. Not specified by the calling model.
    • optional_env_var: An optional environment variable. Not specified by the calling model.
    • insecure_string: Any string from the model. No validation. Use with caution.
  • description (optional): Human-readable description of the parameter
  • default (optional): Default value for the parameter

Parameter Types Explained

project_file_path

This parameter type ensures security by validating that paths are within the project boundaries:

- name: "test_file"
  description: "Run tests in a specific file"
  command: "python -m pytest $TEST_FILE"
  parameters:
    - name: "TEST_FILE"
      type: "project_file_path"
      description: "Path to test file"
      default: "./tests"

The server will validate that TEST_FILE is within the project and exists.

required_env_var

These parameters must be set in the environment before starting the server. If they are not set, the server will fail on startup asking the user to set the variables.

- name: "deploy"
  description: "Deploy the application"
  command: "deploy-tool --key=$DEPLOY_KEY"
  parameters:
    - name: "DEPLOY_KEY"
      type: "required_env_var"
      description: "Deployment key for the service"

HooksMCP will load env vars from the environment, and any set in a .env file in your working directory.

optional_env_var

Similar to required_env_var but optional:

- name: "build"
  description: "Build the application"
  command: "build-tool"
  parameters:
    - name: "BUILD_FLAGS"
      type: "optional_env_var"
      description: "Additional build flags"

insecure_string

Allows any string input from the coding assistant without validation. Use with caution:

- name: "grep_code"
  description: "Search code for pattern"
  command: "grep -r $PATTERN src/"
  parameters:
    - name: "PATTERN"
      type: "insecure_string"
      description: "Pattern to search for"

Running HooksMCP

We recommend running HooksMCP with uvx:

# Install
uv tool install hooks-mcp
# Run
uvx hooks-mcp 

Optional command line arguments include:

  • --working-directory/-wd: Typically the path to your project root. Set if not running from project root.
  • The last argument is the path to the hooks_mcp.yaml file, if not using the default ./hooks_mcp.yaml

Running with Coding Assistants

Cursor

Install MCP Server

Or open this cursor deeplink.

Windsurf/VSCode/etc

Most other IDEs use a variant of mcp.json. Create an entry for HooksMCP.

Note: Be sure it's run from the root of your project, or manually pass the working directory on startup:

{
  "HooksMCP": {
    "command": "uvx",
    "args": [
      "hooks-mcp",
      "--working-directory",
      "."
    ]
  }
}

🔧 Technical Details

Security Features

Security Benefits

HooksMCP implements several security measures to help improve security of giving agents access to terminal commands:

  1. Allow List of Commands: Your agents can only run the commands you give it access to in your hooks_mcp.yaml, not arbitrary terminal commands.
  2. Path Parameter Validation All project_file_path parameters are validated to ensure they:
    • Are within the project directory
    • Actually exist in the project
  3. Environment Variable Controls:
    • required_env_var and optional_env_var parameters are managed by the developer, not the coding assistant. This prevents coding assistants from accessing sensitive variables.
  4. Safe Command Execution:
    • Uses Python subprocess.run with shell=False to prevent shell injection
    • Uses shlex.split to properly separate command arguments
    • Implements timeouts to prevent infinite running commands

Security Risks

There are some risks to using HooksMCP:

  1. If your agent can edit your hooks_mcp.yaml, it can add commands which it can then run via MCP
  2. If your agent can add code to your project and any of your actions will invoke arbitrary code (like a test runner), the agent can use this pattern to run arbitrary code
  3. HooksMCP may contain bugs or security issues

We don't promise it's perfect, but it's probably better than giving an agent unfettered terminal access. Running inside a container is always recommended for agents.

Origin Story

I built this for my own use building Kiln. The first draft was written by Qwen-Coder-405b, and then it was edited by me. See the initial commit for the prompt.

📄 License

MIT

Alternatives

R
Rsdoctor
Rsdoctor is a build analysis tool specifically designed for the Rspack ecosystem, fully compatible with webpack. It provides visual build analysis, multi - dimensional performance diagnosis, and intelligent optimization suggestions to help developers improve build efficiency and engineering quality.
TypeScript
8.7K
5 points
N
Next Devtools MCP
The Next.js development tools MCP server provides Next.js development tools and utilities for AI programming assistants such as Claude and Cursor, including runtime diagnostics, development automation, and document access functions.
TypeScript
8.4K
5 points
T
Testkube
Testkube is a test orchestration and execution framework for cloud-native applications, providing a unified platform to define, run, and analyze tests. It supports existing testing tools and Kubernetes infrastructure.
Go
6.2K
5 points
M
MCP Windbg
An MCP server that integrates AI models with WinDbg/CDB for analyzing Windows crash dump files and remote debugging, supporting natural language interaction to execute debugging commands.
Python
8.6K
5 points
R
Runno
Runno is a collection of JavaScript toolkits for securely running code in multiple programming languages in environments such as browsers and Node.js. It achieves sandboxed execution through WebAssembly and WASI, supports languages such as Python, Ruby, JavaScript, SQLite, C/C++, and provides integration methods such as web components and MCP servers.
TypeScript
6.5K
5 points
N
Netdata
Netdata is an open-source real-time infrastructure monitoring platform that provides second-level metric collection, visualization, machine learning-driven anomaly detection, and automated alerts. It can achieve full-stack monitoring without complex configuration.
Go
9.6K
5 points
M
MCP Server
The Mapbox MCP Server is a model context protocol server implemented in Node.js, providing AI applications with access to Mapbox geospatial APIs, including functions such as geocoding, point - of - interest search, route planning, isochrone analysis, and static map generation.
TypeScript
7.7K
4 points
U
Uniprof
Uniprof is a tool that simplifies CPU performance analysis. It supports multiple programming languages and runtimes, does not require code modification or additional dependencies, and can perform one-click performance profiling and hotspot analysis through Docker containers or the host mode.
TypeScript
8.3K
4.5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
18.9K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
32.2K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
21.7K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
63.1K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
27.0K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
57.6K
4.5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
19.9K
4.5 points
C
Context7
Context7 MCP is a service that provides real-time, version-specific documentation and code examples for AI programming assistants. It is directly integrated into prompts through the Model Context Protocol to solve the problem of LLMs using outdated information.
TypeScript
85.3K
4.7 points
AIBase
Zhiqi Future, Your AI Solution Think Tank
© 2026AIBase