Skip to main content
Glama

mcp-server-text-editor

by bhouston

Claude 文本编辑器 MCP 服务器

Claude 内置文本编辑器工具的开源实现,作为模型上下文协议(MCP) 服务器。此软件包提供与Claude 内置文本编辑器工具相同的功能,允许您通过标准化 API 查看、编辑和创建文本文件。

特征

  • 与 Claude 文本编辑器相同的 API :实现与 Claude 内置文本编辑器工具完全相同的界面
  • MCP 服务器实现:遵循 AI 工具集成的模型上下文协议标准
  • 文件操作
    • 使用可选的行范围规范查看文件内容
    • 创建新文件
    • 替换现有文件中的文本
    • 在特定行号处插入文本
    • 撤消之前的编辑

支持的 Claude 文本编辑器版本

该软件包实现了与内置 Claude 文本编辑器工具版本等效的工具:

  • text_editor_20241022 (克劳德 3.5 十四行诗)
  • text_editor_20250124 (克劳德 3.7 十四行诗)

但使用工具名称“text_editor”可以避免与内置的Claude工具发生名称冲突。

安装

# Install from npm npm install mcp-server-text-editor # Or with pnpm pnpm add mcp-server-text-editor

用法

启动服务器

# Using npx npx -y mcp-server-text-editor # Or if installed globally mcp-server-text-editor

在 Claude Desktop 中配置

{ "mcpServers": { "textEditor": { "command": "npx", "args": ["-y", "mcp-server-text-editor"] } } }

工具命令

看法

查看文件或目录的内容。

{ "command": "view", "path": "/path/to/file.js", "view_range": [1, 10] // Optional: Show lines 1-10 only }
创造

创建具有指定内容的新文件。

{ "command": "create", "path": "/path/to/file.js", "file_text": "console.log('Hello, world!');" }
字符串替换

替换文件中的文本。

{ "command": "str_replace", "path": "/path/to/file.js", "old_str": "console.log('Hello, world!');", "new_str": "console.log('Hello, Claude!');" }
插入

在特定行插入文本。

{ "command": "insert", "path": "/path/to/file.js", "insert_line": 5, "new_str": "// This line was inserted by Claude" }
撤消编辑

恢复对文件所做的最后编辑。

{ "command": "undo_edit", "path": "/path/to/file.js" }

发展

先决条件

  • Node.js 18+
  • 下午

设置

# Clone the repository git clone https://github.com/bhouston/mcp-server-text-editor.git cd mcp-server-text-editor # Install dependencies pnpm install # Build the project pnpm build

脚本

  • pnpm build :构建 TypeScript 项目
  • pnpm lint :运行带有自动修复功能的 ESLint
  • pnpm format :使用 Prettier 格式化代码
  • pnpm clean :删除构建工件
  • pnpm clean:all :删除构建工件和 node_modules
  • pnpm test :运行测试
  • pnpm test:coverage :运行带有覆盖率报告的测试

测试

本项目采用Vitest进行测试。

运行测试:

# Run all tests pnpm test # Run tests with coverage report pnpm test:coverage

测试覆盖率报告将在coverage目录中生成。

执照

麻省理工学院

贡献

欢迎贡献代码!欢迎提交 Pull 请求。

  1. 分叉存储库
  2. 创建你的功能分支( git checkout -b feature/amazing-feature
  3. 提交您的更改( git commit -m 'Add some amazing feature'
  4. 推送到分支( git push origin feature/amazing-feature
  5. 打开拉取请求
-
security - not tested
A
license - permissive license
-
quality - not tested

local-only server

The server can only run on the client's local machine because it depends on local resources.

Claude内置文本编辑器工具版本的开源实现:

text_editor_20241022(克劳德 3.5 十四行诗)text_editor_20250124(克劳德 3.7 十四行诗)

  1. 特征
    1. 支持的 Claude 文本编辑器版本
      1. 安装
        1. 用法
          1. 启动服务器
          2. 在 Claude Desktop 中配置
          3. 工具命令
        2. 发展
          1. 先决条件
          2. 设置
          3. 脚本
          4. 测试
        3. 执照
          1. 贡献

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              A line-oriented text file editor. Optimized for LLM tools with efficient partial file access to minimize token usage.
              Last updated -
              6
              92
              Python
              MIT License
              • Apple
              • Linux
            • A
              security
              A
              license
              A
              quality
              Leverages Vim's native text editing commands and workflows, which Claude already understands, to create a lightweight code assistance layer.
              Last updated -
              8
              130
              164
              TypeScript
              MIT License
            • -
              security
              A
              license
              -
              quality
              A server that connects Claude to your documentation via Inkeep's API, enabling AI-powered interactions with your documentation content.
              Last updated -
              5
              Python
              MIT License
              • Apple
              • Linux
            • -
              security
              A
              license
              -
              quality
              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 following a multi-step process.
              Last updated -
              2
              Python
              MIT License
              • Linux
              • Apple

            View all related MCP servers

            MCP directory API

            We provide all the information about MCP servers via our MCP API.

            curl -X GET 'https://glama.ai/api/mcp/v1/servers/bhouston/mcp-server-text-editor'

            If you have feedback or need assistance with the MCP directory API, please join our Discord server