Edit File Lines

MCP Server to make line-based edits to a file.
  • typescript

31

GitHub Stars

typescript

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "oakenai-mcp-edit-file-lines": {
      "command": "node",
      "args": [
        "/path/to/edit-file-lines/build/index.js",
        "<allowed-directory>"
      ],
      "env": {
        "MCP_EDIT_STATE_TTL": "300000"
      }
    }
  }
}

You can run and manage precise line-based edits to text files within allowed directories using a TypeScript MCP server. It exposes tools to modify file contents by lines, patterns, or regular expressions, with safety features like dry-run previews and controlled edit approvals. This guide walks you through using the server, installing it, and configuring it for reliable file-edit automation.

How to use

Set up your MCP client to connect to the edit-file-lines server. You will typically interact with the tools to perform exact line edits, using either direct line specifications or pattern-based matches. Use dry-run mode first to preview changes, then approve edits to apply them. You can issue multiple edits in a single operation or across multiple files, while preserving line formatting and structure.

How to install

Prerequisites: ensure you have Node.js installed on your system. You will also need an environment capable of running MCP stdio-based servers.

# Install dependencies for the MCP server locally
npm install

# Build the server
npm run build

# Develop with automatic rebuilds
npm run watch

Additional notes

Configuration for local hosting of the server as an MCP endpoint is shown here. This example runs the server as a local stdio process and exposes a directory you are allowed to edit. The environment variable MCP_EDIT_STATE_TTL controls how long edit states remain valid.

{
  "mcpServers": {
    "edit-file-lines": {
      "command": "node",
      "args": [
        "/path/to/edit-file-lines/build/index.js",
        "<allowed-directory>"
      ],
      "env": {
        "MCP_EDIT_STATE_TTL": "300000"
      }
    }
  }
}

Available tools

edit_file_lines

Main tool to Make line-based edits to a file using string or regex patterns. Supports replacing entire lines, preserving formatting, multiple edits, and dry-run previews.

approve_edit

Two-step workflow tool to apply dry-run edits by providing the resulting state ID from a prior edit.

get_file_lines

Inspect specific lines in a file with optional context to verify line content before edits.

search_file

Search a file for text patterns or regular expressions to locate line numbers and surrounding context.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational