File

io.github.rog0x由 GitHub 账号 rog0x 发布v1.0.1更新于 Oct 24, 2026

Dir tree, file stats, duplicates, LOC for AI agents

已验证STDIO仅桌面文件与存储开发者工具

概览

AI 生成的概览

让助手检查本地目录:目录树、文件统计、重复文件检测、代码行数统计和文件搜索。

可以做什么
这个本地 MCP 服务器提供五个只读的文件系统分析工具。dir_tree 生成可视化目录树,可配置深度和忽略规则;file_stats 汇总目录内容,包括文件总数、按扩展名的大小分布以及最大、最新和最旧的文件。duplicate_finder 通过大小和 MD5 哈希找出重复文件并报告浪费空间,code_counter 统计 20 多种语言的代码、注释和空行,file_search 按文件名通配、内容正则、大小和修改日期查找文件。
适用场景
适合助手需要了解代码库或文件夹结构、审查磁盘占用、查找重复文件、按语言统计项目规模,或按名称、内容、日期定位文件而无需手动执行命令行操作的场景。
运行要求
以 npm 包(@rog0x/mcp-file-tools)通过 stdio 在本地运行,需要 Node.js;README 说明需克隆仓库、执行 npm install 和 npm run build,然后在客户端配置中以绝对路径注册构建产物 dist/index.js。仅限桌面端;未声明认证、环境变量或请求头。
安装前请注意
工具会读取本地文件和目录内容,包括用于正则搜索和哈希的文件内容,因此结果可能向助手暴露敏感路径或数据。该服务器为只读,不会修改、移动或删除文件。目录路径以绝对路径传入,应谨慎限定访问范围。

安装

在 SourceWeft 中

  1. 打开 控制台中的 File,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

@rog0x/mcp-file-tools

MCP server providing file and directory analysis tools for AI agents. Gives Claude (and other MCP-compatible AI) the ability to explore, analyze, and search file systems.

Tools

ToolDescription
dir_treeGenerate a visual directory tree structure with configurable depth and ignore patterns
file_statsAnalyze a directory: total files, size breakdown by extension, largest/newest/oldest files
duplicate_finderFind duplicate files by size + MD5 hash, report wasted space
code_counterCount lines of code by language: code, comments, and blank lines (like cloc/scc)
file_searchSearch files by name glob, content regex, size range, and date range

Installation

bash
git clone https://github.com/rog0x/mcp-file-tools.gitcd mcp-file-toolsnpm installnpm run build

Configuration

Claude Code

bash
claude mcp add mcp-file-tools node /absolute/path/to/mcp-file-tools/dist/index.js

Claude Desktop

Add to your claude_desktop_config.json:

json
{  "mcpServers": {    "mcp-file-tools": {      "command": "node",      "args": ["/absolute/path/to/mcp-file-tools/dist/index.js"]    }  }}

Tool Details

dir_tree

Generate a visual directory tree like the tree command.

Parameters:  dir_path (required)     - Absolute path to the directory  max_depth (optional)    - Max depth to traverse (default: 5, 0 = unlimited)  ignore_patterns (optional) - Patterns to ignore (default: node_modules, .git, dist, etc.)

file_stats

Get a comprehensive analysis of a directory's contents.

Parameters:  dir_path (required)     - Absolute path to the directory  max_depth (optional)    - Max depth to traverse (default: 10)

Returns: total files, total size, file counts by extension, top 10 largest files, top 10 newest/oldest files.

duplicate_finder

Find duplicate files using size pre-filtering and MD5 hashing.

Parameters:  dir_path (required)     - Absolute path to the directory  min_size (optional)     - Minimum file size in bytes (default: 1)  max_depth (optional)    - Max depth to traverse (default: 10)

Returns: duplicate groups with file paths, sizes, and total wasted space.

code_counter

Count lines of code across 20+ languages with comment detection.

Parameters:  dir_path (required)     - Absolute path to the directory  max_depth (optional)    - Max depth to traverse (default: 10)

Supported languages: TypeScript, JavaScript, Python, Java, C/C++, C#, Go, Rust, Ruby, PHP, Swift, Kotlin, HTML, CSS, JSON, YAML, Markdown, Shell, SQL, Lua.

file_search

Search for files using multiple criteria simultaneously.

Parameters:  dir_path (required)        - Absolute path to the directory  name_pattern (optional)    - Glob pattern (e.g. "**/*.ts")  content_pattern (optional) - Regex to search file contents  min_size (optional)        - Minimum file size in bytes  max_size (optional)        - Maximum file size in bytes  modified_after (optional)  - ISO date string  modified_before (optional) - ISO date string  max_results (optional)     - Max results (default: 100)

License

MIT

来源:README.md,提交 c917eca

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.1最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分