file-analysis-mcp
file-analysis-mcp
“请把这个文件夹里的 pdf/docx/pptx/svg/png 文档都读一遍并总结一下。” 这是一个个人用 MCP 服务器,只为让 Claude Code 执行这一句话。
指定文件夹后,它会打开其中的文档,只把文本原样提取出来返回。 摘要、解读不是由这个服务器完成,而是在对话中由调用它的 Claude 完成——因此无需单独的 LLM API 密钥,完全在本地以个人方式运行。
目录
Related MCP server: file-analyzer
实际运行效果
这是在 Claude Code 中指定实际文件夹(存放公司内部 PRD 文档的文件夹)提问后的结果。
我:帮我总结一下
docs文件夹里的文档,并分析文件结构
Claude 依次调用 analyze_folder_structure → analyze_folder,并基于返回的原文文本这样回答。
[analyze_folder_structure] pdf 2개, 총 455KB, 최대 파일 prd.pdf(231KB)
[analyze_folder] 2개 파일 모두 추출 성공 (succeeded: 2, failed: 0)
→ Claude의 요약:
두 문서는 같은 프로젝트("ParameterCheck")의 서로 다른 산출물입니다.
- proposal.pdf: RF솔루션 파트의 CAB 파라미터 검증 자동화 기획서
- prd.pdf: 같은 아이디어의 정식 PRD. 목표는 검증 시간 10분→5분 단축,
MVP는 "파라미터 엑셀 입력 시 집계시트 자동 생성 + 오류 빨강 표시"
공통점: 사람 검토·승인은 항상 최종 단계로 남겨둔다는 원칙이 두 문서 모두에 명시됨.服务器只是传回了文本,上面这些摘要语句全部由 Claude 生成——这正是本项目所追求的角色分工。
快速开始
# 1) 의존성 설치 (uv 사용)
uv sync --extra dev
# 2) 확인
uv run pytest # 유닛테스트
uv run python scripts/smoke_stdio.py # 실제 MCP 프로토콜로 서버를 띄워보는 스모크 테스트如果需要 OCR(PNG 分析),请另行安装 Tesseract-OCR——下面在 Claude Code 中注册的开头部分有说明。即便不安装,其余 4 个工具也能正常工作。
5 个工具
工具 | 说明 | 护栏 |
| 返回文件夹内目标文件列表(路径/大小/修改日期)及按扩展名统计的数量 | 超过 |
| 返回包含子文件夹的树形结构、按扩展名统计、容量、最大文件列表 | 仅树形结构受 |
| 提取单个 pdf/docx/pptx/svg 文档的文本 | 以 |
| 通过 OCR 读取单个 png 图片并提取文本 | 同上 + 若 OCR 结果为空,会在 next_actions 中说明原因 |
| 一次性提取文件夹内所有目标文件并以报告形式返回(无需多次调用) | 超过 |
所有工具均为只读,不会修改/删除文件。即使触达上限(max_files),也不会悄悄漏掉文件,而是在响应中如实标注有多少个文件未能读取;同时 status 会变成 PARTIAL,让你立即知晓这一情况。
在 Claude Code 中注册
安装 OCR 引擎(仅 PNG 分析需要)
pytesseract 只是 Tesseract-OCR 引擎的 Python 绑定,引擎本身需要另外安装。
下载 UB-Mannheim Tesseract 安装包并安装到 Windows。(如果需要韩语识别,请在安装过程中的“Additional language data”里勾选 Korean。)
将安装路径(默认
C:\Program Files\Tesseract-OCR)添加到系统 PATH。用
tesseract --version确认安装成功。
注册服务器
本仓库根目录已备好 .mcp.json。在 file-analysis-mcp 文件夹(或其上级文件夹)中运行 Claude Code 时会自动识别。重启后请在 /mcp 命令或工具列表中确认能否看到 file-analysis 的 5 个工具。
如需手动注册:
claude mcp add file-analysis -- uv --directory "C:\Users\20223\Desktop\file-analysis-mcp" run python src/file_analysis_mcp/server.py推荐流程:先用 analyze_folder_structure 了解结构 → 再用 analyze_folder 批量提取全部文档文本 → 由 Claude 基于提取出的文本进行总结。
项目结构
file-analysis-mcp/
├── pyproject.toml
├── .mcp.json
├── src/file_analysis_mcp/
│ ├── server.py # FastMCP 서버, 도구 5개
│ ├── harness.py # 응답/오류 계약 (BaseResponse, ToolFailure 등)
│ ├── scanner.py # 폴더 스캔/구조 분석
│ └── extractors/ # pdf/docx/pptx/svg/image 텍스트 추출기
├── scripts/smoke_stdio.py
├── tests/
│ ├── test_scanner.py # 도메인 로직(순수 함수) 유닛테스트
│ ├── test_extractors.py # 포맷별 추출기 유닛테스트
│ └── test_server_contract.py # 하네스 규약(도구 계약) 테스트
└── data/sample_docs/ # 테스트용 샘플 문서设计原则:harness 工程
这个服务器的优先目标不是“增加功能”,而是让模型只看响应就知道下一步该做什么。在 awesome-harness-engineering 介绍的诸多原则中,只选择了真正符合本项目“本地、单用户、只读”特性的部分加以应用。(OpenTelemetry 观测、提示注入沙箱、mcp-guardian 之类的范围审批门控等,是为多用户、长期运行的代理设计的,对这样规模的个人工具来说过于沉重,因此没有采用。)
应用的内容 | 在本项目中的形态 |
明确的工具边界 | 在工具 docstring 中写明目的 + Returns + “使用 / 不使用”示例,让模型能从 5 个工具中选出正确的一个 |
下一步行动指引 | 所有响应都包含 |
可操作的错误 |
|
上下文节省(单次响应) |
|
上下文节省(护栏) | 为 |
将有价值的失败保留在上下文中 |
|
禁止静默丢失 | 即使超过上限也不会偷偷跳过文件,而是通过 |
工具契约测试 |
|
有意未采用的内容
总结/依据验证(grounding)功能:本服务器设计为“只做提取”(总结是宿主模型的职责),因此不适用。
行号引用锚点(
L12 | ...):在没有单独的引用依据验证工具的情况下,只会让文本变得杂乱,因此没有采用。如果以后需要,可以复用harness.number_lines()来添加。基于审批令牌的保存工作流:本服务器不写入文件,因此不适用。
Maintenance
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
- AlicenseAqualityCmaintenanceProvides LLMs with secure, read-only access to local documentation by scanning directories, extracting content from PDF, DOCX, Markdown, and text files, and performing keyword searches.314MIT
- FlicenseAqualityCmaintenanceEnables read-only analysis of local unstructured documents by scanning a folder, extracting text and structural metadata, and passing content with truncation and error-awareness to an LLM for summarization.9
- FlicenseNot gradedqualityCmaintenanceEnables local, read-only extraction of text and structure from PDF, DOCX, PPTX, SVG, and PNG files, including OCR for images, directory tree and metadata reporting, with strict path isolation and audit logging.
- FlicenseNot gradedqualityCmaintenanceEnables local folder analysis of unstructured documents (PDF, DOCX, PPTX, TXT, SVG, PNG, CSV, XLSX) by extracting structure, reading content, and generating reports, with a strict approval gate before any save operation.
Related MCP Connectors
Read PDFs and images as markdown or text, with exact costs and hard spend caps. $0.75/1k pages.
Search and reason over your Obsidian-style Markdown vault, right from ChatGPT.
Securely search and manage workspace context files for AI agents and teams.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/minheyok-choi/fileanalyzer_mcp-testmonial'
If you have feedback or need assistance with the MCP directory API, please join our Discord server