OM

oakenai/mcp-edit-file-lines

Developer tools

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。 原文を見る

34 stars 7 forks 品質 66 トレンド 12MIT

MCPの特長 ラインベースの編集をファイルにするサーバー.

概要

TypeScript ベースの MCP サーバーで、許可されたディレクトリ内のテキストファイルへの正確な行ベースの編集を行うツールを提供します。 行ベースの編集を文字列または正規表現パターンマッチングを使用してファイルに変換します。 各編集は - 行全体を置き換える - 行のフォーマットを保存しながら特定のテキストマッチを置き換える - 複雑なマッチの正規表現パターンを使用する - 複数の行と複数の編集を処理する - ドライランモードでのプレビュー変更 国家ID: fcbf740a この ID は approve edit を使って変更を適用します。 2. 保存された構造の複数のライン内容 国家ID:f2ce973f この ID は approve edit を使って変更を適用します。 出力: 国家 ID: f1f1d27b この ID は approve edit を使って変更を適用します。 4. ホワイトスペース保存による構成の更新 国家ID:20e93c34 この ID は approve edit を使って変更を適用します.

概要(AI 翻訳)

TypeScript ベースの MCP サーバーで、許可されたディレクトリ内のテキストファイルへの正確な行ベースの編集を行うツールを提供します。

##特徴

主要な編集ツール

####[edit_file_lines 行ベースの編集を文字列または正規表現パターンマッチングを使用してファイルに変換します。 各編集はできます:

  • 線全体を置換する
  • 行の書式を保存しながら特定のテキストマッチを置き換える
  • 複雑なマッチのregexパターンを使用する
  • 複数の行と複数の編集を処理する
  • ドライランモードによるプレビュー変更

例ファイル(src/components/App.tsx)):

##例 使用事例

  1. 簡単なひもの取り替え

出力:

国家ID: fcbf740a この ID は approve edit を使って変更を適用します。

  1. 保存された構造の複数のライン内容

出力:

国家ID:f2ce973f この ID は approve edit を使って変更を適用します。

  1. 複雑な JSX の構造の修正

出力:

国家ID:f1f1d27b この ID は approve edit を使って変更を適用します。

  1. ホワイトスペース保存による構成の更新

出力:

国家ID:20e93c34 この ID は approve edit を使って変更を適用します。

  1. 適用範囲が広い空白の一致

出力:

追加ツール

####[[T2] edit_file_linesの前のドライランから変更を適用します.

このページは AI により自動翻訳されています。技術的な詳細は原文をご確認ください。

README

以下は原文 README の抜粋です。原文を見る。

Edit File Lines MCP Server

A TypeScript-based MCP server that provides tools for making precise line-based edits to text files within allowed directories.

Features

Main Editing Tool

edit_file_lines

Make line-based edits to a file using string or regex pattern matching. Each edit can:

  • Replace entire lines
  • Replace specific text matches while preserving line formatting
  • Use regex patterns for complex matches
  • Handle multiple lines and multiple edits
  • Preview changes with dry run mode

Example file (src/components/App.tsx):

// Basic component with props
const Button = ({ color = "blue", size = "md" }) => {
  return Click me;
};

// Component with multiple props and nested structure
export const Card = ({
  title,
  subtitle = "Default subtitle",
  theme = "light",
  size = "lg",
}) => {
  const cardClass = `card-${theme} size-${size}`;
  
  return (
    
  );
};

// Constants and configurations
const THEME = {
  light: { bg: "#ffffff", text: "#000000" },
  dark: { bg: "#000000", text: "#ffffff" },
};

const CONFIG = {
  apiUrl: "https://api.example.com",
  timeout: 5000,
  retries: 3,
};

Example Use Cases

  1. Simple String Replacement
{
  "p": "src/components/App.tsx",
  "e": [{
    "startLine": 2,
    "endLine": 2,
    "content": "primary",
    "strMatch": "blue"
  }],
  "dryRun": true
}

Output:

Index: src/components/App.tsx
===================================================================
--- src/components/App.tsx        original
+++ src/components/App.tsx        modified
@@ -1,6 +1,6 @@
 // Basic component with props
-const Button = ({ color = "blue", size = "md" }) => {
+const Button = ({ color = "primary", size = "md" }) => {
   return Click me;
 };
 
 // Component with multiple props and nested structure

State ID: fcbf740a Use this ID with approve_edit to apply the changes.

  1. Multi-line Content with Preserved Structure
{
  "p": "src/components/App.tsx",
  "e": [{
    "startLine": 16,
    "endLine": 19,
    "content": "    ",
    "regexMatch": ""
  }],
  "dryRun": true
}

Output:

Index: src/components/App.tsx
===================================================================
--- src/components/App.tsx        original
+++ src/components/App.tsx        modified
@@ -13,10 +13,10 @@
   const cardClass = `card-${theme} size-${size}`;
   
   return (
     
   );
 };

State ID: f2ce973f Use this ID with approve_edit to apply the changes.

  1. Complex JSX Structure Modification
GitHub で README 全文を見る

インストール

This server does not publish a one-line install command.

Open the repository installation guide MCP 初心者?mcpskill.org のガイドから始めましょう →

設定

{ "mcpServers": { "edit-file-lines": { "command": "node", "args": [ "/path/to/edit-file-lines/build/index.js", "<allowed-directory>" ], "env": { "MCP_EDIT_STATE_TTL": "300000" // Optional: Set custom TTL (in milliseconds) } } } }