K Filesystem MCP
A tuned filesystem MCP server for Codex-style development, offering fast file operations, bounded output, and safe edits.
README
K Filesystem MCP
English | 中文
K Filesystem MCP is a K edition of the official MCP filesystem server, tuned for Codex-style local development workflows.
It keeps the general purpose of @modelcontextprotocol/server-filesystem, then adds faster high-frequency file operations, bounded output, structured status fields, safer edit/write behavior, and clearer tool descriptions so coding agents can choose the right filesystem tool with fewer retries.
Security Warning
This server runs in global local filesystem mode. It can read, write, copy, move, and remove any file that the current OS user can access.
Use it only in trusted local environments. Do not expose it to remote clients, shared machines, or untrusted users.
What This Edition Optimizes
- Fewer shell/PowerShell calls for common filesystem work.
- Smaller context usage through range reads, compact output, structured summaries, bounded diffs, and long-line guards.
- Fewer failed edit attempts through exact ranges, anchor-based edits, stable error codes, and concise edit diagnostics.
- Safer mutations through overwrite guards, deletion previews, recursive deletion bounds, optional backups, newline/BOM preservation, and dry-run support where risk justifies it.
- Better broad search behavior through rg-backed search modes, sharded continuation, partial-shard reporting, and explicit hidden/ignored/symlink coverage flags.
Main Tools
read_text_file: read known text files withhead,tail,start_line/end_line, line numbers, output bounds, and selection metadata.read_multiple_files: batch reads for known files or ranges, with per-file success/error metadata.search_files: find paths with glob, depth, hidden/no-ignore/symlink flags, compact output, and result summaries.search_text: search file contents with output modes, context controls, type filters, max match length, sharded continuation, and rg-backed fast paths.list_directory,list_directory_with_sizes,directory_tree: bounded directory browsing, size-aware listing, and stable visual tree output.get_file_info,get_multiple_file_info: structured metadata for one or many paths.diff_text_files: bounded unified diffs for two local text files.edit_file: exact edits, ranged edits, anchor edits, top-level single-edit shortcuts, original-range batch application, and structured diagnostics.write_file: create files or intentionally replace whole files with overwrite guards, bounded diffs, optional backups, and newline/BOM handling.copy_path,move_file,remove_path: guarded copy, move, and deletion tools with structured preflight/status fields.read_media_file: bounded base64 reads for local images or audio.
Install
Clone or copy this repository, then install runtime dependencies once:
npm install
The repository already includes dist/, so this step installs dependencies only. No build step is required for normal use.
Run Check
Codex normally starts the server from the MCP configuration below. To verify the server manually, run this from the repository root:
node dist/index.js
Codex Configuration
Use a dedicated MCP server entry for this repository, with a short name such as fs_k. Put it in the Codex config.toml that your Codex installation loads, usually the user-level config under your Codex home directory.
Recommended configuration:
[mcp_servers.fs_k]
type = "stdio"
command = "cmd"
args = ["/c", "C:\\path\\to\\k-filesystem-mcp\\k-mcp-server-filesystem.cmd"]
enabled = true
Replace the second args entry with the absolute path to your local k-mcp-server-filesystem.cmd. On Windows, launching the wrapper through cmd /c is the most compatible form. If you are not using Windows, run the server with node dist/index.js from the repository root instead.
After restart, Codex should expose tools with the mcp__fs_k prefix. Then add a workspace rule that prefers mcp__fs_k for filesystem work and keeps shell/PowerShell for build, script, and process tasks.
Place your real AGENTS.md at the repository root, or in a nested subdirectory when you need subtree-specific instructions. To make the rule apply across many local repositories under one parent folder, put AGENTS.md in that parent folder, such as your user home directory. For truly global personal defaults across unrelated paths, use Codex global guidance/config instead of relying on a repository AGENTS.md. Example files live under examples/.
A minimal rule is provided in:
The important routing idea is simple:
- Use K MCP for reads, searches, listings, metadata, diffs, edits, writes, copies, moves, and removals when a matching tool exists.
- Use shell/PowerShell for builds, scripts, dynamic generation, process inspection, syntax checks, and work outside MCP capabilities.
- Use
dryRun: truefor risky writes, recursive deletion, broad/ambiguous edits, and important user/project data; skip it for clear low-risk exact edits. - Restart Codex after changing the MCP config or workspace rules so the new routing is picked up.
Documentation
Upstream
This project is a modified K edition of the official MCP filesystem server:
@modelcontextprotocol/server-filesystem- https://github.com/modelcontextprotocol/servers
It is not affiliated with or endorsed by the upstream project.
License
MIT. See LICENSE and NOTICE.md.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。