Skip to main content
Glama

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:

  1. Build a map of the document before reading it.

  2. Extract exact source text instead of relying on memory.

  3. Attach evidence and locations to claims.

  4. Separate author claims, source facts, and agent inference.

  5. 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 --check

Start the server:

doc-analysis-mcp

The server communicates only over stdin/stdout. Diagnostics must not be printed to stdout.

MCP tools

Tool

Purpose

doc_prepare

Build a structure map and return the required evidence-first workflow. Start here.

doc_map

Map headings, paragraph/page ranges, tables, images, and structural warnings.

doc_extract

Extract text by range or keyword, search paragraph numbers, or dump tables.

doc_guide

Read the complete Skill guide or a specific analysis reference.

doc_health

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 / assertion

Every 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://skill

  • Resources for analysis lenses, evidence extraction, and output templates

  • Prompt doc_analysis with path, mode, and optional focus

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 -v

The 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 tools
doc_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

    A3.5/5.0

    Scored across 5 tools

    Disambiguation3/5

    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.

    Naming Consistency4/5

    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.

    Tool Count5/5

    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.

    Completeness4/5

    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

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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 npm
      653
      MIT
    • F
      license
      Not graded
      quality
      D
      maintenance
      Enables 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.
      -
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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