doc-analysis-mcp
Supports mapping and extracting text from Markdown documents, including headings, paragraph ranges, tables, images, and structural warnings.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@doc-analysis-mcp Map annual_report.docx and extract the risk section with cited evidence."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
doc-analysis-mcp
doc-analysis-mcp packages the doc-analysis workflow as a standard MCP server. Any MCP-capable agent can use it; compatible Skill loaders can also read the bundled SKILL.md.
The plugin makes an agent:
Build a map of the document before reading it.
Extract exact source text instead of relying on memory.
Attach evidence and locations to claims.
Separate author claims, source facts, and agent inference.
Grade uncertainty and avoid analysis of unread sections.
Why MCP
MCP is the portable integration layer. The server uses only Python's standard library and JSON-RPC over stdio, so it does not require an MCP SDK or a framework-specific plugin runtime.
Related MCP server: MinerU Document Explorer
Install
Python 3.9 or newer is required.
python -m pip install -e ".[documents]"The prebuilt v0.1.0 wheel is available at artifacts/doc_analysis_mcp-0.1.0-py3-none-any.whl.
For plain Markdown/text-only use, the three document parser dependencies are optional:
python -m pip install -e .Check the runtime:
doc-analysis-mcp --checkStart the server:
doc-analysis-mcpThe server communicates only over stdin/stdout. Diagnostics must not be printed to stdout.
MCP tools
Tool | Purpose |
| Build a structure map and return the required evidence-first workflow. Start here. |
| Map headings, paragraph/page ranges, tables, images, and structural warnings. |
| Extract text by range or keyword, search paragraph numbers, or dump tables. |
| Read the complete Skill guide or a specific analysis reference. |
| Check Python, parser packages, scripts, and supported formats. |
Supported by doc_map: .docx, .pptx, .xlsx, .md, .markdown, .txt.
Supported by doc_extract: .docx, .pptx, .md, .markdown, .txt.
PDF input is intentionally not parsed directly. Render the relevant pages to images with an Office/PDF tool, cite page numbers, and disclose that reading was image-based.
Generic MCP configuration
After installation:
{
"mcpServers": {
"doc-analysis": {
"command": "doc-analysis-mcp",
"args": []
}
}
}Without installing the console script:
{
"mcpServers": {
"doc-analysis": {
"command": "python",
"args": ["-m", "doc_analysis_mcp"],
"env": {
"PYTHONPATH": "/absolute/path/to/doc-analysis-mcp/src"
}
}
}
}See examples/mcp.json and examples/codex-config.toml.
Suggested agent workflow
doc_prepare(path)
doc_guide(section="lenses")
doc_extract(path, start=12, end=24)
doc_extract(path, find="关键词", context=2)For L2/L3 analysis, the agent should maintain an internal evidence table:
claim | quoted source (<=30 chars) | paragraph/page | empirical / argument / assertionEvery conclusion must point to at least one evidence row. If the source does not support a conclusion, label it as inference or remove it.
Resources and prompts
The server exposes:
Resource
doc-analysis://skillResources for analysis lenses, evidence extraction, and output templates
Prompt
doc_analysiswithpath,mode, and optionalfocus
Agents that do not expose resources or prompts can call doc_guide instead.
Native Skill use
The bundled SKILL.md remains directly usable by Skill-compatible agents. The MCP server is additive: it makes the same workflow callable through tools.
Development
python -m unittest discover -s tests -vThe test suite starts the server as a real subprocess and exercises initialization, tool discovery, resources, prompts, health checks, and Markdown document mapping.
The GitHub Actions template is stored as .github/ci.yml.example. Move it to
.github/workflows/ci.yml from a token/account that has permission to manage
workflow files to enable automatic CI.
Security and privacy
Files are read locally by the MCP server.
The server does not upload documents or call a network service.
Document contents are returned to the calling agent and are subject to that agent's privacy policy.
Path arguments are passed as separate subprocess arguments; shell command construction is not used.
License
MIT. The bundled analysis workflow originates from xhlyy/doc-analysis.
Available Tools
5 toolsdoc_extractExtract source text and tablesA
Extract exact source text by paragraph/page range or keyword, or dump tables. Supports .docx, .pptx, .md, .markdown, and .txt. Paragraph numbers match doc_map.
Inputs: path (required), end, find, start, +3 more.
doc_guideRead the document-analysis guideA
Return the bundled Skill guide or a specific reference for agents that do not support MCP resources or prompts.
Inputs: section.
doc_healthCheck document-analysis runtimeA
Report Python, parser dependencies, bundled scripts, and supported formats. Run this when a document tool fails.
Inputs: no named parameters.
doc_mapBuild a document structure mapB
Map headings, paragraph ranges, character counts, tables, images, and structural warnings. Supports .docx, .pptx, .xlsx, .md, .markdown, and .txt.
Inputs: path (required), format, maxHeadings.
doc_preparePrepare a document for analysisB
Build a structural map and return the required evidence-first workflow. Use this first for any document analysis task.
Inputs: path (required), maxHeadings.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Most tools have distinct roles, but doc_prepare and doc_map overlap because both appear to build structural maps, and doc_guide and doc_prepare both provide workflow guidance. The descriptions clarify intended order and usage, but an agent could still hesitate between prepare and map for initial structural discovery.
All names use the same doc_ prefix and snake_case convention, with concise action-oriented suffixes. doc_health is slightly less verb-like than the others, but the pattern remains predictable overall.
Five tools is well-scoped for a document-analysis server, with each covering a clear phase: preparation, guidance, mapping, extraction, and diagnostics. There is no obvious bloat or missing role.
The surface covers the core analysis workflow from preparation through structural mapping and exact extraction, plus diagnostics. However, doc_map claims xlsx support while doc_extract does not, leaving a possible extraction gap for spreadsheet content.
Maintenance
Related MCP Connectors
Read-only MCP over an agentic SLR workspace with per-claim citation verification
Read-only MCP over an agentic SLR workspace with per-claim citation verification
Parse documents to Markdown with OCR, verify claims and bind citations to their sources.
Query your own PDFs and documents from any MCP client. Every answer cites the page it came from.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to read documents in Excel, DOCX, PDF, and TXT formats via MCP protocol.186 PyPI23MIT
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to search, deep-read, and build knowledge bases from Markdown, PDF, DOCX, and PPTX documents via MCP tools for retrieval, document navigation, and ingestion.39 npm653MIT
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to extract structured data from PDFs with confidence scores and provenance, and to search, review, and correct documents via MCP tools, resources, and prompts.-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to read Word, Excel, PowerPoint, and PDF documents through MCP tools, returning structured Markdown, spreadsheet tables, slide content, and extracted PDF text with clear truncation and error handling.MIT