DE

danielpodrazka/editor-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

14 stars 5 forks 품질 66 트렌드 20MIT

A Python-based text editor server built with FastMCP that provides tools for file operations. This server enables reading, editing, and managing text files through a standardized API.

개요

A Python-based text editor server built with FastMCP that provides powerful tools for file operations. This server enables reading, editing, and managing text files through a standardized API with a unique multi-step approach that significantly improves code editing accuracy and reliability for LLMs and AI assistants. - : Set a file to work with using absolute paths - : - Read entire files with line numbers using skim - Read specific line ranges with prefixed line numbers using read - Find specific text within files using find_line - Find and extract function definitions in Python and JavaScript/JSX files using find_function - : - Two-step editing process with diff preview - Select and overwrite text with ID verification - Clean editing workflow with select → overwrite → confirm/cancel pattern - Syntax checking for Python (.py) and JavaScript/React (.js, .

README

원문 README의 일부입니다. 원문 보기.

Editor MCP

A Python-based text editor server built with FastMCP that provides powerful tools for file operations. This server enables reading, editing, and managing text files through a standardized API with a unique multi-step approach that significantly improves code editing accuracy and reliability for LLMs and AI assistants.

Features

  • File Selection: Set a file to work with using absolute paths
  • Read Operations:
    • Read entire files with line numbers using skim
    • Read specific line ranges with prefixed line numbers using read
    • Find specific text within files using find_line
    • Find and extract function definitions in Python and JavaScript/JSX files using find_function
  • Edit Operations:
    • Two-step editing process with diff preview
    • Select and overwrite text with ID verification
    • Clean editing workflow with select → overwrite → confirm/cancel pattern
    • Syntax checking for Python (.py) and JavaScript/React (.js, .jsx) files
    • Create new files with content
  • File Management:
    • Create new files with proper initialization
    • Delete files from the filesystem
    • List directory contents with listdir
  • Testing Support:
    • Run Python tests with run_tests
    • Set Python paths for proper module resolution
  • Safety Features:
    • Content ID verification to prevent conflicts
    • Line count limits to prevent resource exhaustion
    • Syntax checking to maintain code integrity
    • Protected paths to restrict access to sensitive files

Security Risks

The editor-mcp includes powerful capabilities that come with certain security considerations:

  • Jailbreak Risk: The editor-mcp can potentially be jailbroken when reading a file that has harmful instructions embedded inside. Malicious content in files being edited could contain instructions that manipulate the AI assistant.
  • Arbitrary Code Execution: If running tests is enabled, there is a risk of arbitrary code execution through manipulated test files or malicious Python code.
  • Data Exposure: Access to file system operations could potentially expose sensitive information if proper path protections aren’t configured.

To mitigate these risks:

  1. Use the PROTECTED_PATHS environment variable to restrict access to sensitive files and directories.
  2. Disable test running capabilities in production environments unless absolutely necessary.
  3. Carefully review files before opening them, especially if they come from untrusted sources.
  4. Consider running the editor in a sandboxed environment with limited permissions.

Key Advantages For LLMs

This text editor’s unique design solves critical problems that typically affect LLM code editing:

GitHub에서 전체 README 보기

설치

uvx install git+https://github.com/danielpodrazka/mcp-text-editor.git
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →

설정

{ "mcpServers": { "text-editor": { "command": "editor-mcp", "env": { "MAX_SELECT_LINES": "100", "ENABLE_JS_SYNTAX_CHECK": "0", "FAIL_ON_PYTHON_SYNTAX_ERROR": "1", "FAIL_ON_JS_SYNTAX_ERROR": "0", "PROTECTED_PATHS": "*.env,.env*,config*.json,*secret*,/etc/passwd,/home/user/.ssh/id_rsa" } } } }