MCP server for applying block-format patches to files

MCP server for applying block-format patches to files

patch-file-mcp•bypynesys

An MCP server that lets AI agents modify existing files by applying SEARCH/REPLACE block patches, with exact-match and uniqueness checks.

License: MIT•Runtime: Awaiting documentation review•Category: file systems-docs

WHAT IT DOES

  • •Exposes a patch_file tool that takes a file path and block-format patch content.
  • •Supports applying multiple search-replace blocks to a file in a single request.
  • •Verifies each search text appears exactly once, reporting an error otherwise.
  • •Restricts file operations to allowed directories, defaulting to the user's home directory.

BEST FOR

  • •Making targeted edits to specific parts of files without rewriting entire content.
  • •Enabling AI agents like Claude to modify project files conversationally.
  • •Applying several changes to one file in a single tool call.

ABOUT PATCH-FILE-MCP

MCP server for applying block-format patches to files is cataloged as an MCP server attributed to pynesys. An MCP server that lets AI agents modify existing files by applying SEARCH/REPLACE block patches, with exact-match and uniqueness checks. It is categorized under file systems-docs. See the capability inspector for recorded interfaces and their independent review status; consult upstream documentation for the current interface.

HOW TO INSTALL

Installation configuration is not reviewed. No executable setup is offered for this entry; inspect the source repository before proceeding.

LICENSE

Catalog license label: MIT. Check the source repository's current license and terms before using, modifying or distributing this software.

Capability inspector

Capability definitions are not reviewed. Unreviewed imports are not exposed as trusted interfaces.

Tools (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Resources (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

Prompts (0)

No reviewed records to display. This does not establish that upstream lacks this capability.

NEWSLETTER - COMING LATER

Newsletter subscriptions are not open yet

Email delivery is not connected. This page does not collect email addresses or create subscriptions.

Browse the registry for current listings instead.

Community Reviews

Coming later

Reviews for MCP server for applying block-format patches to files are not available yet

Review publishing and storage are not connected. This page does not collect or publish ratings or comments, including after sign-in.

Upstream README

View this exact version on GitHub

README.md · f62a0d579fc1 · Fetched 2026-11-13 13:42:55 UTC

Original upstream text, without AI rewriting. Scripts, forms and unsafe links are filtered for safety.

Showing the last retrieved documentation snapshot; check the source for current changes.

Patch File MCP

An MCP Server to patch existing files using block format. This allows AI agents (like Claude) to make precise changes to files in your projects.

Overview

Patch File MCP provides a simple way to modify files by applying patches in block format. The key benefits include:

  • Makes targeted changes to specific parts of files without rewriting the entire content
  • Supports multiple patches to the same file in a single request
  • Ensures safety through exact text matching and uniqueness verification
  • Better alternative to the edit_block tool from desktop-commander for most file editing tasks

Installation

Using uvx

This method uses uvx (from the uv Python package manager) to run the server without permanent installation:

Prerequisites

Install uvx from uv if you don't have it already.

Set up MCP Client (Claude Desktop, Cursor, etc.)

Merge the following config with your existing config file (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "patch-file": {
      "command": "uvx",
      "args": [
        "patch-file-mcp",
        "--allowed-dir", "/Users/your-username/projects",
        "--allowed-dir", "/Users/your-username/Documents/code"
      ]
    }
  }
}

Note: Replace /Users/your-username with the actual path to your own projects and code directories.

Install from Source

Prerequisites

  • Python 3.11 or higher
  • Pip package manager

Clone the repository

git clone https://github.com/your-username/patch-file-mcp.git
cd patch-file-mcp
python -m venv venv
source venv/bin/activate
pip install -e .

Set up MCP Client (Claude Desktop, Cursor, etc.)

Merge the following config with your existing config file (e.g. claude_desktop_config.json):

{
  "mcpServers": {
    "patch-file": {
      "command": "path/to/your/venv/bin/patch-file-mcp",
      "args": [
        "--allowed-dir", "/Users/your-username/projects",
        "--allowed-dir", "/Users/your-username/Documents/code"
      ]
    }
  }
}

Note: Replace /Users/your-username with the actual path to your own projects and code directories.

Arguments

The --allowed-dir argument is used to specify the directories that the server has access to. You can use it multiple times to allow access to multiple directories. All directories inside the allowed directories are also allowed. It is optional. If not provided, the server will only have access to the home directory of the user running the server.

Usage

The MCP server is started by the client (e.g., Claude Desktop) based on the configuration you provide. You don't need to start the server manually.

Tools

Patch File MCP provides one main tool:

patch_file

Update the file by applying a patch/edit to it using block format.

patch_file(file_path: str, patch_content: str)
  • file_path: Path to the file to be patched.
  • patch_content: Content to search and replace in the file using block format with SEARCH/REPLACE markers. Multiple blocks are supported.

The patch content must have the following format:

<<<<<<< SEARCH
Text to find in the file
=======
Text to replace it with
>>>>>>> REPLACE

You can include multiple search-replace blocks in a single request:

<<<<<<< SEARCH
First text to find
=======
First replacement
>>>>>>> REPLACE
<<<<<<< SEARCH
Second text to find
=======
Second replacement
>>>>>>> REPLACE

This tool verifies that each search text appears exactly once in the file to ensure the correct section is modified. If a search text appears multiple times or isn't found, it will report an error.

Example Workflow

  1. Begin a conversation with Claude about modifying a file in your project
  2. Claude generates a block format patch that makes the desired changes
  3. Claude uses patch_file to apply these changes to your file
  4. If the patch fails, Claude provides detailed error information to help you fix the issue

Security Considerations

  • All file operations are restricted to allowed directories
  • Search texts must appear exactly once in the file to ensure correct targeting
  • Detailed error reporting helps identify and fix issues
  • Each patch operation is validated before being applied

Advantages over similar tools

  • Multiple blocks in one operation: Can apply several changes in a single call
  • Safety checks: Ensures the correct sections are modified through exact matching
  • Detailed errors: Provides clear feedback when patches can't be applied

Dependencies

  • fastmcp (>=2.2.0, <3.0.0)

License

MIT

Install configuration

Are you the maintainer?

Claim this server with your GitHub account to request manual ownership verification.

README Embed Badge
Markdown

Link to the catalog listing for MCP server for applying block-format patches to files from your README. This badge does not certify ownership, compatibility or security.

[![MCP catalog listing](https://img.shields.io/badge/MCP-awesome--mcp-orange?style=flat-square)](https://awesome-mcp.com/servers/patch-file-mcp)

REPOSITORY STATS

GitHub StarsUnavailable
ForksUnavailable

Public repository statistics could not be verified. Check the configured source address; unavailable counts are not zero.

Downloads and pulls

Separate sources, scopes and periods. Never combined or treated as installations, active users or security reviews.

No reviewed package or image identity; download statistics are not listed yet.

Related file systems-docs MCP Servers

Alternative and complementary servers in the same category

View all in file systems-docs →

A Model Context Protocol server for global law with read-only tools to find and read provisions by date, trace the law behind each word, search text and changes, and check cases or briefs against law in force.

Repository stats unavailable
Files & Documentation
LoreKeeper MCP server
lorekeeper-rpg-lorekeeper-com•lore-keeper

Hosted MCP server for tabletop RPG worlds that organizes messy notes and documents into a private store and lets MCP apps search lore, read documents, find characters, and optionally generate character or world pictures.

Repository stats unavailable
Files & Documentation

An MCP server that gives AI assistants scoped file system operations inside a project directory, with read-only reference projects plus git and GitHub tools.

Repository stats unavailable
Files & Documentation