doc-intel MCP server

doc-intel MCP server

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.

Category
Visit Server

README

doc-intel MCP server

An MCP server that exposes the doc-intel-agent document-extraction pipeline to AI agents (Claude Desktop, Claude Code, or any MCP client). The pipeline extracts structured data from PDFs where every field carries a computed confidence score and provenance (page + bounding box + verbatim source span) — and this server's job is to make sure that uncertainty survives the protocol boundary instead of being flattened away.

Companion repo: the extraction pipeline itself (LangGraph, three-signal confidence scoring, eval harness with measured silent-error rates) lives in doc-intel-agent. This package reads the same database and reuses its models — installing this package pulls it in automatically.

Design points

Confidence must survive the boundary. A total is never returned as 45300. It is returned as:

{"value": "45300.0", "confidence": 0.94, "verified": true, "page": 3}

If the MCP layer flattened uncertainty away, the agent on the other side would hallucinate with our data. Every value-returning tool keeps this envelope.

Return shapes are context-budget-aware. Tool results land in a model's context window — that is the scarce resource, not bandwidth. List tools paginate with explicit {"truncated": true, "next_cursor": ...}; long text truncates with a marker; summaries come with drill-down tools rather than 40KB dumps.

Tool descriptions are prompts. Each docstring states what the tool does, when to use it, and when not to — naming the better alternative ("Do NOT use search_documents to fetch a document you already have an ID for — use get_extraction").

Write tools have a different posture. Mutations are clearly marked, require explicit IDs (no bulk-by-predicate — nothing like "approve everything above 0.8"), and every mutation is logged with the calling client's identity. Corrections double as gold labels for the pipeline's eval harness.

All three MCP primitives, not just tools — most community servers ship tools only; resources let the calling agent understand the data model before querying it.

Surface

Kind Name Why it exists
tool search_documents(query, doc_type?, vendor?, date_from?, date_to?, min_amount?, limit, cursor?) hybrid content + metadata search; paginated
tool get_extraction(document_id, include_low_confidence=False, fields?) structured result; uncertain data is opt-in
tool get_field_provenance(field_id) page, bbox, verbatim span — the agent can show its work
tool list_review_queue(limit, max_confidence, doc_type?) agent triages on a human's behalf
tool compare_documents(doc_id_a, doc_id_b) invoice-vs-PO mismatch, a real BFSI use case
tool ✏️ approve_field(field_id, note?) mutation; explicit ID required; logged
tool ✏️ correct_field(field_id, new_value, note?) mutation; logged as a gold-label review action
tool ✏️ process_document(file_path, doc_type_hint?) returns a job id immediately, does not block
tool get_job_status(job_id) poll for the resulting document_id
resource schema://invoice, schema://purchase_order, schema://bank_statement derived from the live Pydantic models — cannot drift
resource stats://pipeline throughput, review-queue depth, cost
resource doc://{document_id}/text raw document text with explicit truncation
prompt audit_invoice_batch(vendor, date_from, date_to) duplicate/anomaly audit workflow
prompt reconcile_po(invoice_id, po_id) line-item reconciliation workflow

Install / run

pip install "doc-intel-mcp-server @ git+https://github.com/avinashbadgu/doc-intel-mcp-server.git"

# stdio (local clients — Claude Desktop, Claude Code)
python -m mcp_server.server

# streamable HTTP at http://127.0.0.1:8765/mcp
python -m mcp_server.server --http        # or MCP_TRANSPORT=http

Environment: DATABASE_URL (defaults to local SQLite docintel.db — point it at the same DB the pipeline writes), MCP_HOST / MCP_PORT for HTTP, ANTHROPIC_API_KEY optional (enables real-model process_document; without it the deterministic offline extractor runs).

Client config

Claude Code:

claude mcp add doc-intel -- python -m mcp_server.server

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "doc-intel": {
      "command": "python",
      "args": ["-m", "mcp_server.server"],
      "cwd": "path/to/your/checkout"
    }
  }
}

Manual test (MCP Inspector)

python -m mcp_server.server --http
npx @modelcontextprotocol/inspector

Transport Streamable HTTP, URL http://127.0.0.1:8765/mcp. Then: search_documents {"query": "INV-2026"} → note the confidence envelope → get_extraction → note fields_omitted_pending_review → re-run with include_low_confidence: true → get_field_provenance on a queue entry → page + bbox + span.

The end-to-end demo in Claude Code: "find every invoice from vendor Acme over 1,000, check which ones have unverified totals, and tell me which need human review" — the model chains search_documents → get_extraction → get_field_provenance and answers with page and bounding-box citations.

Status / roadmap

Built on the MCP Python SDK 1.28 (spec 2025-06-18), tested via the SDK's in-memory client session in the companion repo. Next: SDK v2 / 2026-07-28 spec migration, and OAuth 2.1 on the HTTP transport (current auth story: stdio + env credentials at startup).

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured