file_utils MCP

file_utils MCP

An MCP server for reading and editing large text files using content-addressed anchors that survive line shifts, providing tools like read_file_range, edit_file_range, insert_at, prepend_to_file, and append_to_file.

Category
访问服务器

README

file_utils MCP

An anchor-based file reading and editing MCP server for large text files where the built-in read_file tool fails ("readline was closed") or where encoding issues (e.g. mojibake em-dashes) cause string-matching tools to miss their targets.

The headline insight: content-addressed anchors survive line shifts; line numbers don't. When a file is edited mid-session (by you in the IDE, by a formatter, by another tool), line numbers go stale silently. Anchors travel with the content.

The full design lives in SPEC.md; the implementation plan lives in TODO.md.


Tools

Five stdio MCP tools are exposed (see SPEC.md for full parameter tables, responses, and error codes):

Tool Purpose
read_file_range Read a contiguous span, addressed by anchors (primary) or line numbers (fallback). Returns a content_hash for staleness-guarded edits.
edit_file_range Replace a contiguous span with new content, with an optional expected_content_hash staleness guard.
insert_at Insert content before/after a single target line without replacing it.
prepend_to_file Concatenate content at the start of a file (optional ensure_newline_after).
append_to_file Concatenate content at the end of a file (optional ensure_newline_before).

Anchor matching is substring-based and case-sensitive with a progressive-disclosure ambiguity guard (occurrence / total). Line numbers are 1-based and support negative indexing (-1 = last line). Edits are written via an atomic temp-file → fsync → rename. The span content_hash is a SHA-256 of the raw on-disk bytes, so it is encoding-independent.


Requirements

  • Python 3.10+
  • uv for environment and dependency management
  • The mcp Python SDK (declared in pyproject.toml; installed automatically by uv)

This project is managed with uv. pyproject.toml is the single source of truth for dependencies — there is no requirements.txt. Do not call python, pip, or pytest directly; go through uv so the correct environment is used.

Installing uv

If uv is not already installed, use the official Astral installer (PowerShell):

powershell -ExecutionPolicy ByPass -Command "irm https://astral.sh/uv/install.ps1 | iex"

uv installs to C:\Users\<you>\.local\bin and is added to PATH by the installer. A newly opened terminal will have uv / uvx on PATH; an already-open terminal may need to be reopened.


Setup & usage

Sync the environment

uv sync --extra dev

Run the server

The server speaks the MCP JSON-RPC protocol over stdio. Run it directly:

uv run server.py

Run from a Git repo with uvx

The project is installable as a tool, so uvx can clone the repo into its cache, build the wheel, install it plus dependencies into an isolated environment, and run the file-utils entry point — exactly like npx.

From a published GitHub repo:

uvx --from git+https://github.com/JEL-LL/file_utils.git file-utils

Only committed content is used (it clones from the repo), so commit and push before a new version becomes available. Use --refresh to pick up new commits.

Install into a local venv

uv pip install "git+https://github.com/JEL-LL/file_utils.git"

Run the tests

uv run --extra dev pytest

Run quietly with uv run --extra dev pytest -q.


VS Code / Kilo Code configuration

Recommended: launch globally via uvx straight from the Git repo so any project gets the tool without a local checkout. Add this to your global mcp_settings.json:

{
  "mcpServers": {
    "file_utils": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/JEL-LL/file_utils.git",
        "file-utils"
      ],
      "alwaysAllow": []
    }
  }
}

Alternatively, to run from a local working copy through uv (so dependencies resolve from pyproject.toml):

{
  "mcpServers": {
    "file_utils": {
      "command": "uv",
      "args": ["run", "--directory", "/path/to/file_utils", "server.py"],
      "env": {}
    }
  }
}

Each spawned process is unique to one agent/session. In-memory state (such as a remembered project_root) is per-process and safe across calls within a session.


Path resolution

Every tool accepts an optional project_root parameter. Once supplied, it is remembered in memory for the rest of the session.

Path type project_root state Result
Absolute Any Used as-is; project_root is ignored
Relative Set Resolved against the remembered project_root
Relative Not set INVALID_PARAMETERS — supply an absolute path or a project_root

Anchor selection tips

Good anchors are Markdown section headers (## Phase 10), unique prose phrases, and pure ASCII. Avoid lines containing em-dashes or curly quotes when the file has encoding issues, very short strings that appear many times, and line numbers (use from_line / to_line only as a fallback). See SPEC.md for the full discipline.


License

Licensed under the MIT License. Copyright (c) 2026 LaserLinc Inc.

Authored by Joshua Lansford. Released as open source with the permission of LaserLinc Inc.

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选