Patch File MCP
@PyneSys
About Patch File MCP
An MCP Server to patch existing files using block format
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"patch-file-mcp": {
"command": "python",
"args": [
"-m",
"venv",
"venv"
]
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is Patch File MCP?
Patch File MCP is an MCP server that enables AI agents (like Claude) to make precise changes to files in projects using a block-based patch format. It provides a single tool for applying targeted edits without rewriting entire files, with built-in safety through exact text matching and uniqueness verification.
How to use Patch File MCP?
Install with uvx or from source, then configure your MCP client (e.g., Claude Desktop) by adding a "patch-file" entry in the mcpServers JSON config with the command and --allowed-dir arguments. The server starts automatically when the client uses it; no manual launch is needed. Use the patch_file tool with a file path and patch content formatted in SEARCH/REPLACE blocks.
Key features of Patch File MCP
- Applies multiple search-replace blocks in a single request.
- Verifies each search text appears exactly once in the file.
- Restricts file operations to allowed directories only.
- Provides clear error messages when a patch cannot be applied.
- Designed as a safer alternative to
edit_blockfromdesktop-commander.
Use cases of Patch File MCP
- An AI agent refactoring a function inside a source code file without touching other parts.
- Applying a series of configuration changes to a project file in one chat turn.
- Fixing a bug by replacing specific lines inside a large log or data file.
- Updating documentation snippets across multiple files in a codebase.
FAQ from Patch File MCP
How does Patch File MCP differ from the edit_block tool?
Patch File MCP supports multiple blocks in one operation, offers stronger safety checks (exact match, uniqueness), and gives more detailed error feedback, making it a better choice for most file editing tasks.
What are the runtime requirements?
Python 3.11 or higher, the fastmcp package (version >=2.2.0, <3.0.0), and optionally uvx from the uv Python package manager for the no-install method.
Which directories can the server access?
Access is limited to directories specified via the --allowed-dir argument (can be used multiple times). Subdirectories are also allowed. If no directory is specified, only the user's home directory is accessible.
What happens if a search block doesn't match or matches multiple times?
The tool returns an error. Each search text must appear exactly once in the file for the patch to be applied; otherwise, no changes are made and a descriptive error is reported.
Frequently asked questions
How does Patch File MCP differ from the `edit_block` tool?
Patch File MCP supports multiple blocks in one operation, offers stronger safety checks (exact match, uniqueness), and gives more detailed error feedback, making it a better choice for most file editing tasks.
What are the runtime requirements?
Python 3.11 or higher, the `fastmcp` package (version >=2.2.0, <3.0.0), and optionally `uvx` from the `uv` Python package manager for the no-install method.
Which directories can the server access?
Access is limited to directories specified via the `--allowed-dir` argument (can be used multiple times). Subdirectories are also allowed. If no directory is specified, only the user's home directory is accessible.
What happens if a search block doesn't match or matches multiple times?
The tool returns an error. Each search text must appear exactly once in the file for the patch to be applied; otherwise, no changes are made and a descriptive error is reported.
Basic information
More Other MCP servers
MCP Go 🚀
mark3labsA Go implementation of the Model Context Protocol (MCP), enabling seamless integration between LLM applications and external data sources and tools.
Activepieces
activepiecesAI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents
Reactive Resume
amruthpillaiA one-of-a-kind resume builder that keeps your privacy in mind. Completely secure, customizable, portable, open-source and free forever. Try it out today!
Unity MCP ✨
justinpbarnettUnity MCP acts as a bridge between AI assistants and your Unity Editor. Give your LLM tools to manage assets, control scenes, edit scripts, and automate tasks within Unity.
MCP Toolbox for Databases
googleapisMCP Toolbox for Databases is an open source MCP server for databases.
Comments