
Claude 内置文本编辑器工具的开源实现
概览
Claude 内置文本编辑器工具的开源实现,作为模型上下文协议(MCP)服务器。该软件包提供与 Claude 内置文本编辑器工具相同的功能,允许您通过标准化 API 查看、编辑和创建文本文件。 - : 实现了与 Claude 内置文本编辑器工具完全相同的界面 - : 遵循 Model Context Protocol 标准进行 AI 工具集成 - : - 查看文件内容并可选行范围指定 - 创建新文件 - 替换现有文件中的文本 - 在特定行号处插入文本 - 撤销之前的编辑 该软件包实现了与内置 Claude 文本编辑器版本相当的工具: - text_editor_20241022(克洛德3.5十四行诗)- text_editor_20250124(克洛德3.7十四行诗) 但使用工具名称“text_editor”是为了避免与内置 Claude 工具的名称冲突。 查看文件或目录的内容。 创建一个包含指定内容的新文件。
概述(AI 翻译)
Claude 内置文本编辑器工具的开源实现,作为模型上下文协议(MCP)服务器。该软件包提供与 Claude 内置文本编辑器工具相同的功能,允许您通过标准化 API 查看、编辑和创建文本文件。
特色
- 与 Claude 的文本编辑器相同的 API:实现了与 Claude 内置文本编辑器工具完全相同的界面
- MCP 服务器实现:遵循模型上下文协议标准进行 AI 工具集成
- 文件操作:
- 查看文件内容,可选线范围指定
- 创建新文件
- 替换现有文件中的文本
- 在特定行号处插入文本
- 撤销之前的编辑
支持的 Claude 文本编辑器版本
该软件包实现了与内置 Claude 文本编辑器版本相当的工具:
text_editor_20241022(克洛德3.5十四行诗)text_editor_20250124(克洛德3.7十四行诗)
但使用工具名称“text_editor”是为了避免与内置 Claude 工具的名称冲突。
安装
用途
启动服务器
在 Claude Desktop 中配置
工具指令
视图
查看文件或目录的内容。
创造
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Claude Text Editor MCP Server
An open-source implementation of the Claude built-in text editor tool as a Model Context Protocol (MCP) server. This package provides the same functionality as Claude’s built-in text editor tool, allowing you to view, edit, and create text files through a standardized API.
Features
- Identical API to Claude’s Text Editor: Implements the exact same interface as Claude’s built-in text editor tool
- MCP Server Implementation: Follows the Model Context Protocol standard for AI tool integration
- File Operations:
- View file contents with optional line range specification
- Create new files
- Replace text in existing files
- Insert text at specific line numbers
- Undo previous edits
Supported Claude Text Editor Versions
This package implements an equivalent tool to the built-in Claude text editor tool versions:
text_editor_20241022(Claude 3.5 Sonnet)text_editor_20250124(Claude 3.7 Sonnet)
But using the tool name ‘text_editor’ to avoid name conflicts with built-in Claude tools.
Installation
# Install from npm
npm install mcp-server-text-editor
# Or with pnpm
pnpm add mcp-server-text-editor
Usage
Starting the Server
# Using npx
npx -y mcp-server-text-editor
# Or if installed globally
mcp-server-text-editor
Configuring in Claude Desktop
{
"mcpServers": {
"textEditor": {
"command": "npx",
"args": ["-y", "mcp-server-text-editor"]
}
}
}
Tool Commands
View
View the contents of a file or directory.
{
"command": "view",
"path": "/path/to/file.js",
"view_range": [1, 10] // Optional: Show lines 1-10 only
}
Create
Create a new file with the specified content.
{
"command": "create",
"path": "/path/to/file.js",
"file_text": "console.log('Hello, world!');"
}
String Replace
Replace text in a file.
{
"command": "str_replace",
"path": "/path/to/file.js",
"old_str": "console.log('Hello, world!');",
"new_str": "console.log('Hello, Claude!');"
}
Insert
Insert text at a specific line.
{
"command": "insert",
安装
npx -y mcp-server-text-editor配置
{
"mcpServers": {
"textEditor": {
"command": "npx",
"args": ["-y", "mcp-server-text-editor"]
}
}
}