ocr-arena-mcp

v0.1.0-beta.1
ocr-arena-mcp Checked 3 days ago Published 10 days ago

OCR evaluation harness for coding agents: run your documents through OCR models with your own keys, judge blind, get a ranked report.

Turn your coding agent into an OCR evaluation harness. Ask "which model reads my invoices best?" and it runs your documents through OCR models with your own keys, on your machine, judges the outputs (blind, with an LLM judge against an answer key, or against your expected text), and writes a ranked report. Your documents and keys go only to the model providers you pick. Node 20 or newer. Add it to your agent; keys go in a .env file in your project (see Keys below).

Summary extracted from the README.

OCR Arena MCP

Turn your coding agent into an OCR evaluation harness. Ask "which model reads my invoices best?" and it runs your documents through OCR models with your own keys, on your machine, judges the outputs (blind, with an LLM judge against an answer key, or against your expected text), and writes a ranked report.

Your documents and keys go only to the model providers you pick.

Install (beta)

Node 20 or newer. Add it to your agent; keys go in a .env file in your project (see Keys below).

Claude Code

claude mcp add ocr-arena -- npx -y ocr-arena-mcp@beta

Cursor / Claude Desktop / Windsurf (mcp.json)

{ "mcpServers": { "ocr-arena": { "command": "npx", "args": ["-y", "ocr-arena-mcp@beta"] } } }

Working in this repo? It's already wired up: .mcp.json at the repo root starts the server for any Claude Code session opened here (after npm install in the repo root and in mcp/).

Everything runs live by default: each model is called now with your keys, whether on your files, OCR Arena's public samples or an industry preset. No keys yet? Preview a preset or the samples with use_saved_outputs: true (outputs saved from an earlier OCR Arena run, no cost). Results always say when you're looking at saved outputs.

Fastest start: Extend. Sign up at dashboard.extend.ai (new accounts get $100 in free credits, about 10,000 pages), create a key, add EXTEND_API_KEY=… to your project's .env, and ask your agent to run doctor again. No restart needed. Or just say "help me get started with OCR Arena" (/ocr-arena:get-started).

Keys

One variable per provider; set only the ones you want. They're read from the server's environment, then from .env.local / .env in your workspace, then ~/.config/ocr-arena/.env (or OCR_ARENA_ENV_FILE). Files are re-read on every call, so a key you add mid-session works right away. doctor shows what's set and where it came from (never the values). Don't paste keys into the chat: put them in .env yourself.

Provider Variable Models
OpenAI OPENAI_API_KEY GPT-6.2 Astra
Anthropic ANTHROPIC_API_KEY Claude Fable 5.2
Google GEMINI_API_KEY Gemini 3.6 Flash
Mistral MISTRAL_API_KEY Mistral OCR 4.1
Extend EXTEND_API_KEY Extend Performance, Extend Light. New accounts get $100 in free credits at dashboard.extend.ai
Reducto REDUCTO_API_KEY Reducto r-1, Reducto r-1 mini
LlamaIndex LLAMA_CLOUD_API_KEY LlamaParse (Agentic), LlamaParse (Cost Effective)
LandingAI LANDINGAI_API_KEY LandingAI ADE (DPT-3)
OpenDocRouter OPEN_DOC_ROUTER_API_KEY One key for every open model: Nemotron 3.5 Parse, LightOnOCR-3, PaddleOCR-VL-1.6, MinerU2.5-Pro, dots.mocr

Try it

  • "Which OCR model reads the documents in ./invoices best?"
  • "Try OCR Arena on 5 finance samples and let me judge them." (no keys needed)
  • "Compare Mistral OCR and Reducto on scans/october.pdf and show me where they differ."
  • "Open the OCR Arena page so I can drop some files in."
  • "Run the healthcare preset on GPT-6.2 Astra, Mistral OCR and Reducto and have Claude judge it."
  • "Grade the OCR on ./claims with an LLM judge: draft the questions first and let me check them."

Or the slash commands: /ocr-arena:get-started, /ocr-arena:pick-a-model, /ocr-arena:try-samples, /ocr-arena:llm-judge-preset, /ocr-arena:compare.

LLM judge and presets

A judge model (GPT, Claude or Gemini, on your key) gets each OCR output plus the document's answer key (questions whose answers are printed on the page, each with the correct answer). It marks every answer right or wrong and rates the transcription 1–10. Models are ranked by answers correct, then rating, and the report lists the questions each model missed.

  • Presets: finance, healthcare, mortgage, supply_chain. Each has 20 public documents, an answer key per document and a default judging prompt. They run live with your keys; use_saved_outputs: true previews them with no keys. list_presets shows them; run_eval { preset } runs one; judge { mode: "llm" } grades it.
  • Your own documents: put an answer key next to each file (invoice.pdf → invoice.qa.json as [{"q": "Invoice number?", "a": "INV-0042"}], or invoice.qa.csv with question,answer columns, or one qa.json per folder keyed by file name), or pass answer_keys to judge. Documents without one are only rated.
  • Customise: judge_model, prompt (your rubric; the answer key and reply format are added for you) and with_document (attach the original, default on).
  • More than 100 judge calls ask for confirmation first, like large runs.

Tools

Tool What it does
doctor Which keys are set, which models are ready, where results go
list_models The roster, with what's ready and how to unlock the rest
list_presets Industry presets: documents, answer keys and judging prompts
estimate Documents, pages, live calls and time, before anything runs
run_eval Runs files, folders, globs, a preset or public samples through models; cached, resumable, with progress. Asks for confirmation above 100 live calls
get_results Ranked summary: judged wins or accuracy, latency, failures
compare What one model read that another missed, on one document
draft_answer_keys A GPT, Claude or Gemini model writes questions (with exact answers) from each of your documents, for the LLM judge; you check them first
judge Blind A/B judging by the agent (mode: "agent") or by you in a local page (mode: "human"), or an LLM judge against answer keys (mode: "llm")
submit_verdicts The agent's verdicts for the pairs judge handed out
report Writes report.md and report.html, exports every output (Markdown, and JSON blocks with page and bounding box) plus answers.csv, grades.csv and latency.csv under .ocr-arena/runs/<id>/export/, and links the review page
open_workspace A local page (localhost only) to drag and drop files, run, judge blind and see results. view: "review" opens a run's review: each document rendered with every model's bounding boxes, each output block by block, the answer key with every model's answers, and the judge's grades with evidence

Ground truth: put the expected text next to a document (invoice.pdf → invoice.expected.md, .gt.md or .md) and run_eval scores word-level accuracy automatically, formatting ignored.

Results live in .ocr-arena/ in your workspace: outputs, cache, reports. Re-running only calls what changed.

Safety

  • No write path to OCR Arena: no votes, no ratings, no uploads. The server only talks to the model providers you pick (and downloads public sample PDFs).
  • Files: only PDFs and images are read, up to 50 MB each. Folders and patterns are searched only inside your workspace.
  • Keys: read from the environment, never logged, returned or written; scrubbed from provider error messages.
  • Money: estimate before running; runs above 100 live calls need your explicit go-ahead (OCR_ARENA_CONFIRM_ABOVE to change).
  • Malicious documents: OCR output is passed to the agent as delimited data and labelled untrusted.
  • The local page: bound to 127.0.0.1, needs a random per-session token, and checks the Host header.

Develop

npm run build       # bundle src/ + the web app's shared adapters into dist/index.js
npm test            # end to end over stdio on public samples (no keys, no network)
npm run typecheck
node test/live.manual.mjs dist/index.js <workspace>   # real providers (needs keys)

The server reuses the website's adapters (lib/client/adapters), prompts and diff code. build.mjs swaps the two browser-only modules (PDF rendering and the key vault) for Node versions in src/. Samples in samples/ come from scripts/export-samples.mjs (public playground documents only, never held-out battle documents).