B.L.A.S.T. OCR
Code Read Against Source, 2026-09-10

Setting Up a Document OCR MCP Server for Claude Desktop & Cursor

Primary query: ocr model context protocol mcp · raw markdown

How do you connect OCR to Claude Desktop or Cursor for agentic RAG?

B.L.A.S.T. connects natively to Claude Desktop and Cursor using the Model Context Protocol (MCP). Registering blast_ocr.mcp_server over stdio gives an agent structured Markdown/tables, TEDS-evaluable table extraction, and inline LaTeX equations without sending files to a third-party cloud API. Verified in blast_ocr/mcp_server.py.

Step 1: Claude Desktop configuration

Add the server to claude_desktop_config.json:

{
      "mcpServers": {
        "blast_ocr": {
          "command": "python",
          "args": ["-m", "blast_ocr.mcp_server"]
        }
      }
    }

Step 2: Cursor IDE configuration

Cursor Settings → Features → MCP Servers → Add New MCP Server:

MCP tools exposed to AI agents

Once registered, four deterministic tools are available (blast_ocr/mcp_server.py, MCP_TOOLS):

  1. blast_ocr_process(source_path, formats=["markdown"], engine="rapidocr", secure_mode=False, dewarp=False) — runs the full pipeline, returns generated_files, a text_snippet, and job metadata.
  2. blast_ocr_extract_tables(source_path) — runs TableExtractor on a single image, returns tables_markdown and tables_html.
  3. blast_ocr_extract_formulas(text) — takes already-extracted plain text (not a file path), isolates inline/block LaTeX math.
  4. blast_ocr_semantic_chunk(source_path, max_tokens=512, overlap_tokens=64) — processes to Markdown, then splits into RAG-ready chunks.

All four validate incoming paths via _is_safe_mcp_path(), which blocks resolved paths under system directories (/etc, /root, /boot, /sys, /proc, /dev, /usr, /home, /var) unless they fall inside the current working directory or the OS temp directory.

Author & Engineering Authority

Engineered & maintained by Ibrahim Salman, Full-Stack Software Engineer & AI Systems Architect (UET Taxila).