file edit check server

Local 2025-09-01 00:00:21 0

This MCP server enforces pre-read checks and detailed commit documentation to prevent unauthorized file modifications, ensuring write and diff operations are preceded by explicit reads.


An MCP server that enforces pre-read checks and detailed commit documentation. This server prevents blind modifications to files by requiring explicit read operations before any writes or diffs can be applied.

Features

  • Enforces pre-read verification before file modifications
  • Prevents blind writes and diffs
  • Provides detailed commit message guidance
  • TypeScript implementation with proper error handling

Tools

  • checked_read_file: Read a file and mark it as read for future editing
  • checked_write_to_file: Write to a file, requiring it to have been read first if it exists
  • checked_apply_diff: Apply a diff to a file, requiring it to have been read first
  • list_my_tools: List the tools registered in this server

Installation

npm install
npm run build

Usage

Add to your MCP settings file:

{
  "mcpServers": {
    "file-edit-check": {
      "command": "node",
      "args": ["/path/to/file-edit-check-server/build/index.js"],
      "disabled": false,
      "alwaysAllow": []
    }
  }
}
[
  {
    "description": "Read a file and mark it as read for future editing",
    "inputSchema": {
      "properties": {
        "path": {
          "description": "Path to the file to read",
          "type": "string"
        }
      },
      "required": [
        "path"
      ],
      "type": "object"
    },
    "name": "checked_read_file"
  },
  {
    "description": "Write to a file, requiring it to have been read first if it exists",
    "inputSchema": {
      "properties": {
        "content": {
          "description": "Content to write to the file",
          "type": "string"
        },
        "line_count": {
          "description": "Number of lines in the content",
          "type": "number"
        },
        "path": {
          "description": "Path to write the file to",
          "type": "string"
        }
      },
      "required": [
        "path",
        "content",
        "line_count"
      ],
      "type": "object"
    },
    "name": "checked_write_to_file"
  },
  {
    "description": "Apply a diff to a file, requiring it to have been read first",
    "inputSchema": {
      "properties": {
        "diff": {
          "description": "Unified diff content to apply",
          "type": "string"
        },
        "path": {
          "description": "Path to the file to modify",
          "type": "string"
        }
      },
      "required": [
        "path",
        "diff"
      ],
      "type": "object"
    },
    "name": "checked_apply_diff"
  },
  {
    "description": "List the tools registered in this server",
    "inputSchema": {
      "properties": {},
      "required": [],
      "type": "object"
    },
    "name": "list_my_tools"
  }
]