mcp-fstools

mcp-fstools

Provides file read, edit, and write operations with exact-match editing and hash-based consistency checks, designed for models that prefer structured schemas over patch grammars.

Category
访问服务器

README

mcp-fstools

Minimal MCP server that exposes opencode-style file tools (read / edit / write) over stdio. Designed for models that handle a small, structured schema better than a free-form patch grammar.

Why this exists

Alternatives tried:

  • codex-rs apply_patch shell command — the model has to compose a custom multi-line patch grammar (*** Begin Patch / *** Update File: / -old / +new / *** End Patch) inside a shell argument. Smaller models stumble on this format.
  • mcp-workspace (Python, stdio) — exposes the same opencode shape but enforces two extra boundaries the host already covers: a --project-dir filter and a .gitignore filter that blocks reading common ignored files (target/, .env, etc.).

This server keeps the opencode tool shape and drops the extra boundaries, so models get a familiar three-field schema and can reach every file the OS sandbox allows.

Tools

Name Args Notes
read path, offset?, limit? Line-numbered output; records file hash for must-read-first.
edit filePath / file_path, oldString / old_string, newString / new_string Exact match; must be unique; must-read-first enforced.
write filePath / file_path, content Atomic full-file write; creates parent dirs.

edit mirrors opencode's contract:

  1. You must call read on the same file first in the session.
  2. oldString must appear exactly once in the current file content.
  3. The file must not have changed since the last read or since the last successful edit/write on that file (hash mismatch → fail).

The hash check runs before the oldString check, so a stale edit against a changed file reports "file changed" rather than the misleading "oldString not found".

JSON-RPC arg names

Tool calls accept either casing — pick whichever feels natural. The schema tools/list reports uses camelCase (MCP convention), but the server also accepts snake_case at call time, so all of these are equivalent for edit:

  • filePath / file_path
  • oldString / old_string
  • newString / new_string

If a Pydantic error names a field as missing, check both spellings before assuming truncation — that's the diagnostic FastMCP surfaces when an unknown key is dropped.

Sandbox

None at the application layer. The host (e.g. Codex) provides the OS-level sandbox (Seatbelt/landlock) which already wraps the spawned subprocess. This server intentionally does not enforce a --project-dir boundary or a .gitignore filter.

Install

# First install
uv tool install .

# After source changes — use --reinstall (not --force)
uv tool install --reinstall .

Both commands write outside the default Codex sandbox scope (~/.local/share/uv/tools/, ~/.cache/uv/), so run with sandbox_permissions: "require_escalated". See AGENTS.md for the why behind --reinstall.

Entry point: mcp-fstools (stdio MCP server).

Wire into Codex

In ~/.codex/config.toml:

[mcp_servers.mcp_fstools]
command = "mcp-fstools"
default_tools_approval_mode = "approve"

Restart Codex after the install. To verify, run a read and an edit in a fresh session — both should succeed without a permission prompt.

推荐服务器

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

官方
精选