Skip to main content
Glama
saewookkangboy

file-analyzer-mcp

file-analyzer-mcp

Python Protocol Scope Tests

这是一个个人使用的 stdio MCP 服务器,用于从本地文件夹中的 PDF·DOCX·PPTX·SVG·PNG 文件中仅提取文本/结构。它不进行摘要或解读——读取提取结果并进行摘要的工作由调用此工具的宿主 LLM(如 Claude Code 等)负责。

做什么 / 不做什么

做什么

不做什么

提取指定根文件夹下文档的文本结构

摘要·解读(由宿主 LLM 负责)

统计文件夹树·按扩展名统计文件数/容量

文件写入·删除·移动(只读)

提取 PNG 的 OCR 文本

理解图像的视觉含义(图片·图表)

对大型/损坏文件进行超时处理

服务器运行期间更改分析目标文件夹

Related MCP server: Visual Document Forensics MCP Server

运行示例

> read_document("quarterly-report.pdf")
{
  "type": "pdf",
  "num_pages": 12,
  "text": "Q3 Revenue Summary\n..."
}

> read_document("../../etc/passwd")
{ "error": "'../../etc/passwd' resolves outside the allowed root folder" }

快速开始

git clone https://github.com/saewookkangboy/fileanalyzer_mcp_testmonial.git
cd fileanalyzer_mcp_testmonial
python3 -m venv .venv && source .venv/bin/activate
pip install -e .
brew install tesseract   # PNG OCR용 (한국어는 brew install tesseract-lang 추가)

注册到 Claude Code:

claude mcp add file-analyzer --env FILE_ANALYZER_ROOT=/분석할/폴더 -- \
  "$(pwd)/.venv/bin/python" "$(pwd)/server.py"
claude mcp list   # ✔ Connected 확인

注册后,在新会话中请求"帮我总结这个文件夹的文档",Claude 就会直接调用以下 3 个工具。

工具(Tools)

工具

说明

list_directory(subpath=".", recursive=True)

文件夹树,按扩展名统计文件数/容量

read_document(relative_path)

文本/结构提取 — .pdf .docx .pptx .svg .png

get_file_metadata(relative_path)

大小、修改时间、页数/幻灯片数、图像分辨率等

项目结构

server.py                    # FastMCP 앱 진입점, 툴 등록, 루트 폴더 검증
file_analyzer/
  security.py                #  경로 격리(resolve_safe_path), 크기 제한
  timeout.py                 #  추출 작업 하드 타임아웃
  audit.py                   #  로컬 감사 로그(logs/audit.jsonl)
  tree.py, metadata.py       #  list_directory / get_file_metadata 로직
  extractors/                #  pdf · docx · pptx · svg · image(OCR) 추출기
tests/                       # pytest 회귀 스위트
AGENTS.md                    # 호출 에이전트(Claude Code)를 위한 운영 지침

安全与限制

项目

策略

路径隔离

仅可访问 FILE_ANALYZER_ROOT 下内容 — 完全阻止 ../、绝对路径注入、symlink 逃逸

文件大小

超过 50MB 时不读取并返回错误

超时

提取/元数据解析超过 30 秒时以错误中止返回

支持的扩展名

.pdf .docx .pptx .svg .png — 不支持 .ppt(旧格式)、.jpg

图像解读

仅提取 OCR 文本,无法理解图片/图表的视觉含义

分析目标文件夹

服务器启动时固定一次,运行期间不可更改

可观测性 — 审计日志

所有工具调用仅以逐行方式记录在 logs/audit.jsonl 中(无外部传输)。

{"timestamp": "2026-08-26T06:03:35Z", "tool": "read_document", "params": {"relative_path": "report.pdf"}, "status": "ok", "duration_ms": 251.3}

如需清空日志,删除 logs/audit.jsonl 即可。

开发

pip install -e ".[dev]"
pytest -q

tests/ 涵盖路径逃逸·绝对路径注入拦截、5 种提取器、超时、审计日志、服务器集成。考虑到此项目规模,我们认为无需 CI 流水线,仅通过本地 pytest 执行即可充分完成回归验证,因此一直保持这种方式。

为什么这样设计

  • 没有摘要功能 — 为了在没有单独 LLM API 密钥的情况下也能运行,采用了提取由服务器负责/摘要由宿主负责的最小结构。

  • PNG 使用 OCR,不传递 vision — 不将图像以 base64 形式传给宿主,而是只提取文本返回,降低了返回量和实现复杂度(无法看到图片的视觉含义)。

  • 无 git/CI,仅本地 pytest — 在单人本地工具规模下,判断 CI 基础设施过于冗余。

已知限制

  • 超时基于线程实现,超时的调用本身的后台线程在返回后仍可能继续执行到底。

  • 不支持 .ppt — 请转换为 .pptx 后使用。

许可证

这是一个没有单独许可证文件的个人项目。

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI-powered extraction and analysis of PDF documents with 40+ specialized tools for text, tables, images, layout analysis, security assessment, and document intelligence. Supports both text-based and scanned PDFs with OCR capabilities.
    10
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Enables deterministic visual and structural analysis of PDF and DOCX documents, extracting measurable evidence such as blur, OCR confidence, and image anomalies for auditable forensic workflows.
    1
  • A
    license
    A
    quality
    C
    maintenance
    Enables reading and extracting text from local documents (PDF, Word, Excel, PowerPoint, HWP, Markdown, CSV, etc.) without network access, and provides approval-gated summary saving and file organization.
    11
    MIT

View all related MCP servers

Related MCP Connectors

View all MCP Connectors

Latest Blog Posts

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/saewookkangboy/fileanalyzer_mcp_testmonial'

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