What open-ocr-cli does
open-ocr-cli turns images, PDFs, and public web pages into Markdown or structured JSON. It can use provider presets for invoices, receipts, resumes, and business cards, or validate results against a user-supplied JSON Schema. The same OCR engine is available from the terminal, through MCP, or through a versioned JSON request protocol for scripts and agents.
Supported provider profiles include Gemini, Kimi, Meta Muse, OpenRouter, and OpenAI-compatible APIs. OpenRouter can route to supported vision models, while the generic compatible profile can target services such as a local Ollama endpoint. Provider and model selection can be changed per command.
How it works
Run open-ocr-cli mcp to start a stdio MCP server. The server uses its launch directory as a boundary: input files, schemas, configuration paths, and output directories must resolve within that directory. Provider endpoints, credential variable names, and operational limits come from the server's configuration or environment; tool arguments may reduce configured limits but cannot raise them or change routing and pricing settings.
The MCP interface includes five tools:
ocr_capabilities reports available providers, models, modes, schemas, and limits.
ocr_extract processes files as Markdown, a preset, or custom-schema data.
ocr_run_agentic performs iterative extraction with regional re-reads.
ocr_web extracts content from public URLs.
ocr_read_artifact reads saved results in bounded chunks.
Batch jobs support directories and globs, bounded concurrency, manifests, and resumption. Completed documents are skipped unless their content changed, and existing output files are protected from accidental replacement. Results have explicit succeeded, partial, failed, or skipped states with typed error information. Cost ceilings, request-rate limits, dry runs, and per-model price estimates help control paid processing.
Setup and configuration
Install the package globally with npm, then run open-ocr-cli doctor to check the environment. Node.js 20.19+, 22.13+, or 24+ is supported. Docker and GitHub Actions installation paths are also available.
Set the credential variable for the selected provider before starting the MCP process. open-ocr-cli init creates project configuration, while init --global writes shared configuration under the user's configuration directory. Flags take precedence over environment variables, which take precedence over configuration files. Credentials are referenced by variable name rather than stored in configuration.
Register the stdio process with Claude Code using claude mcp add --transport stdio --scope user open-ocr -- open-ocr-cli mcp. Codex requires its MCP 2026-07-28 feature and protocol environment setting, plus an appropriate working directory. OPEN_OCR_MCP_CONFIRM=1 enables confirmation before paid runs, showing the document count, cost ceiling, destination host, and credential variable.
Tools and capabilities
The CLI supports single-file extraction, structured presets, custom schemas, agentic mode, web URLs, dry runs, provider and model discovery, environment diagnostics, and batch status inspection. The machine interface accepts protocol v2 requests and emits JSONL lifecycle events ending in run.completed or run.failed.
PDF handling depends on the provider profile. Gemini and Muse read PDFs natively, Kimi extracts PDF text first, and the generic OpenAI-compatible profile accepts images only. Cloudflare AI Gateway routing is available through the gateway option.
Batch processing resumes after interruption and applies a cumulative --max-cost ceiling. If a paid provider returns no usage data, the ceiling fails closed. Output names are adjusted to avoid hidden names and agent instruction filenames.
Limitations and notes
The MCP transport is stdio, so the server inherits the working directory and environment of its host process. A single document can take a long time in agentic mode because it may issue several billed requests. Claude Code's stdio idle timeout and the server's per-document timeout need compatible values.
The server is designed for public web URLs; private-page authentication is not described as part of the web tool. Provider capabilities differ, so use ocr_capabilities or the CLI's model and provider commands before selecting a model.