Edit MCP

Edit MCP

Edit MCP

Category
访问服务器

README

Edit-MCP: Model Context Protocol Server for Microsoft Edit

Edit-MCP is a Model Context Protocol (MCP) server that integrates with Microsoft's Edit tool to provide advanced file editing capabilities to AI systems. It follows a hybrid architecture that combines direct file system operations for performance with Microsoft Edit integration for complex editing tasks.

Overview

The Edit-MCP server acts as a sophisticated coordinator between AI systems and file editing operations. It exposes a standardized MCP interface that allows AI models to:

  • Read and write files
  • Search and replace text
  • Format code
  • Perform complex editing operations
  • Coordinate multi-file edits
  • And more...

Architecture

Edit-MCP follows a hybrid architecture with the following components:

1. Core MCP Server

  • Handles MCP protocol communication
  • Routes operations to appropriate subsystems
  • Manages file state and metadata
  • Coordinates between multiple Edit instances
  • Provides caching and optimization

2. File System Manager

  • Performs direct file operations for simple tasks
  • Handles basic CRUD operations
  • Provides text search and simple find/replace
  • Manages file metadata operations
  • Supports batch operations across multiple files

3. Edit Instance Manager

  • Manages Microsoft Edit processes for complex operations
  • Handles complex editing scenarios
  • Coordinates multi-file operations
  • Manages Edit's TUI interactions programmatically

4. Operation Router

  • Decides which subsystem handles each operation
  • Routes simple operations to File System Manager
  • Routes complex operations to Edit Instance Manager
  • Coordinates hybrid operations between both subsystems

Installation

Prerequisites

  • Node.js 16 or higher
  • Microsoft Edit installed and available in your PATH

Install from Source

# Clone the repository
git clone https://github.com/mixelpixx/edit-mcp.git
cd edit-mcp

# Install dependencies
npm install

# Build the project
npm run build

Usage

Starting the Server

You can start the Edit-MCP server using either stdio or HTTP transport:

# Start with stdio transport (for direct integration with AI systems)
npm run stdio

# Start with HTTP transport (for web-based integration)
npm run http

Command Line Options

Usage: edit-mcp [options]

Options:
  -V, --version                output the version number
  -p, --port <port>            Port to listen on for HTTP transport (default: "3000")
  -e, --edit-path <path>       Path to the Edit executable
  -m, --max-instances <number> Maximum number of Edit instances (default: "5")
  -t, --timeout <milliseconds> Timeout for Edit instances in milliseconds (default: "300000")
  -c, --config <path>          Path to configuration file
  -d, --debug                  Enable debug logging
  -s, --stdio                  Use stdio transport instead of HTTP
  -h, --help                   display help for command

Configuration

You can configure Edit-MCP using a JSON configuration file:

{
  "editExecutable": "/path/to/edit",
  "maxEditInstances": 5,
  "instanceTimeout": 300000,
  "simpleOperationThreshold": 1000,
  "complexityFactors": {
    "fileSize": 0.3,
    "operationType": 0.4,
    "contextRequirement": 0.3
  }
}

Available Tools

Edit-MCP provides the following tools:

File System Tools

  • read_file: Read the contents of a file
  • write_file: Write content to a file
  • list_files: List files in a directory
  • find_in_file: Find occurrences of a pattern in a file

Edit Tools

  • format_code: Format code in a file
  • complex_find_replace: Perform advanced find and replace operations
  • interactive_edit_session: Start an interactive editing session

Hybrid Tools

  • smart_refactor: Intelligently refactor code across multiple files
  • backup_and_edit: Create backups of files before editing them

HTTP Transport

Edit-MCP now supports HTTP transport in addition to stdio, allowing remote access and REST API endpoints.

Starting with HTTP Transport

# Start with default HTTP port (3000)
edit-mcp

# Start with custom port
edit-mcp --port 8080

# Start with configuration file
edit-mcp --config config.http.example.json

REST API Endpoints

Health Check

GET /health

JSON-RPC Endpoint

POST /jsonrpc
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "read_file",
    "arguments": {
      "path": "example.txt"
    }
  },
  "id": 1
}

REST API Endpoints

  • GET /api/tools - List available tools
  • POST /api/tools/:toolName - Call a specific tool
  • GET /api/files/:path - Read file content
  • PUT /api/files/:path - Write file content
  • GET /api/list/:directory - List files in directory
  • POST /api/search - Search for patterns in files
  • POST /api/format - Format code
  • POST /api/refactor - Refactor symbols across files
  • GET /api/docs - API documentation

Authentication

Enable API key authentication by setting authEnabled: true in your config:

{
  "authEnabled": true,
  "apiKey": "your-secure-api-key"
}

Include the API key in requests:

  • Header: X-API-Key: your-secure-api-key
  • Query parameter: ?apiKey=your-secure-api-key

CORS Configuration

Configure allowed origins in your config file:

{
  "corsOrigins": ["http://localhost:*", "https://yourdomain.com"]
}

Rate Limiting

Configure rate limiting to prevent abuse:

{
  "rateLimitWindowMs": 900000,  // 15 minutes
  "rateLimitMax": 100           // 100 requests per window
}

Development

Building the Project

# Build the project
npm run build

# Watch for changes and rebuild
npm run watch

Running in Development Mode

# Run with hot reloading
npm run dev

License

MIT

Acknowledgements

  • Microsoft for the Edit tool
  • The Model Context Protocol community

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选