Skip to main content
Glama
asuramama-hue

file-analyzer-mcp

file-analyzer-mcp

Python Protocol Scope Tests

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

做什么 / 不做什么

做什么

不做什么

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

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

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

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

提取 PNG 的 OCR 文本

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

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

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

Related MCP server: Docalyze

运行示例

> 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/asuramama-hue/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

0Releases (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 Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server that reads PDFs and exposes them as structured Markdown, metadata, outlines, images, and tables to LLM consumers via tools like pdf_read_markdown and pdf_info.
    Apache 2.0
  • A
    license
    B
    quality
    D
    maintenance
    An MCP server that lets AI assistants read and visually analyze local documents — PDFs, Excel spreadsheets, CSV files, Word documents, PowerPoint presentations, and images.
    4
    66
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Local MCP server that indexes folders of documents into a hybrid vector + keyword search index for Claude Desktop, with support for PDFs, Office files, and images via OCR.
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP server for indexing, semantic search, and generation of multi-format documents. Exposes 13 tools over JSON-RPC 2.0 so an LLM can search your local PDF, Excel, and Word files, and create or edit Excel and Word documents.
    AGPL 3.0

View all related MCP servers

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/asuramama-hue/fileanalyzer_mcp_testmonial'

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