unlimited-ocr-mcp-server: Instructions file for Claude Code

CLAUDE.md

unlimited-ocr-mcp-server CLAUDE.md is an instructions file for Claude Code from tinygone/unlimited-ocr-mcp-server. It costs 1,684 tokens per session, scanned A, original, MIT.

Project instructions for running an OCR service based on Baidu's Unlimited-OCR model. OCR means reading text from images or PDF pages, and MCP is the connection that lets an agent call the service.

In plain words
What is it for?
Use them to start and verify the local OCR service, run text extraction on images or PDFs, and troubleshoot its Python, CUDA, and GPU setup.
Why use it?
They document the required environment, long-running service, model setup, health check, and test commands needed before OCR calls work.

Instructions file for Claude Code

Written for Claude Code: the file is CLAUDE.md. Also seen: reads .claude/ paths; mentions CLAUDE.md; mentions Claude Code.

This is tinygone/unlimited-ocr-mcp-server's own configuration. It tells Claude Code how to work on unlimited-ocr-mcp-server itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything unlimited-ocr-mcp-server configures →

Reuse

Borrowing it

Nothing to install: this file belongs to tinygone/unlimited-ocr-mcp-server. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/tinygone/unlimited-ocr-mcp-server/master/CLAUDE.md
Clone the repo
git clone --depth 1 https://github.com/tinygone/unlimited-ocr-mcp-server

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for unlimited-ocr-mcp-server CLAUDE.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/tinygone/unlimited-ocr-mcp-server/claude-md.svg)](https://agentmods.dev/instructions/tinygone/unlimited-ocr-mcp-server/claude-md)
Your own site
<a href="https://agentmods.dev/instructions/tinygone/unlimited-ocr-mcp-server/claude-md"><img src="https://agentmods.dev/badge/instructions/tinygone/unlimited-ocr-mcp-server/claude-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,684 This file is loaded in full into every session.
When invoked 1,684 The same file — it is already loaded in full.
Security scan A 1 finding. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01684 $0.01684
Opus 5 $0.00842 $0.00842
Sonnet 5 $0.00337 $0.00337
Haiku 4.5 $0.00168 $0.00168

Measured 5d ago against content hash 8344eab0ddaf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

unlimited-ocr-mcp-server CLAUDE.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 5d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

curl http://127.0.0.1:10000/v1/models
CLAUDE.md · 90 lines

How it starts

The opening of the file, as written. The whole thing — 90 lines — stays where its author put it; the contents beside it link to each section on GitHub.

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

项目概述

把百度的 Unlimited-OCR 模型封装成 MCP 工具,让 Claude Code 能识别任意图片中的文字。本地推理、无调用配额、无 API 费用。整套链路必须在本机 GPU 上运行。 我在Windows 11 + RTX5070TI LAPTOP,使用Python 3.12.3,CUDA13.2,测试成功。 官网推荐是Python3.12.3 + CUDA12.9。如果使用其他版本,建议看看测试效果。

常用命令

服务必须在 conda 环境 uocr 中运行(Python 3.12.3 + PyTorch/CUDA)。

conda activate uocr

# 1. 启动 OCR 服务(关键,必须常驻。首次下载模型需设镜像)
$env:HF_ENDPOINT = "https://hf-mirror.com"   # PowerShell; bash 用 export
$env:HF_HOME = "your/path/hf/cache" # PowerShell; bash 用 export。换成你自己的缓存目录(如 D:/hf/cache)
python serve_ocr.py

# 2. 验证服务在线(MCP 能用的前提)
curl http://127.0.0.1:10000/v1/models

# 3. 测试 HTTP API(默认图 inputs/test.jpg; --image 指定图; --stream 测流式)
python test_api.py --image inputs/1.jpg

# 4. 命令行直接推理(脱离 MCP,单进程内加载模型并跑一次)
python run_ocr.py --mode single -i inputs/1.jpg -o outputs
python run_ocr.py --mode multi  -i inputs/p1.png inputs/p2.png -o outputs
python run_ocr.py --mode pdf    -i inputs/doc.pdf -o outputs --dpi 300

# 5. 调试脚本:探测 model.infer 的真实返回值类型
python probe_infer.py

MCP server(ocr_mcp_server.py无需手动启动——Claude Code 通过 .mcp.json 自动拉起。

本项目没有自动化测试框架test_api.py / probe_infer.py 是手动 smoke-test 脚本,不是 pytest 用例。

架构:两层解耦(改代码前必读)

Claude Code ──MCP(stdio)──> ocr_mcp_server.py ──HTTP /v1/chat/completions──> serve_ocr.py ──> 模型
文件 职责
模型服务 serve_ocr.py 启动时一次性加载模型进显存,FastAPI 暴露 OpenAI 兼容 HTTP API(:10000),常驻进程
MCP 网关 ocr_mcp_server.py 把 HTTP API 包装成 MCP 工具 ocr_image / ocr_multi,被 Claude Code 经 stdio 调用

为什么分两层:模型加载耗时数十~上百秒。拆开后模型只在 serve_ocr.py 启动时加载一次,Claude Code / MCP server 重启都不重载模型。这是整个设计的核心不变量,改动时不能破坏。

两个推理分支(参数不同,别混用)

serve_ocr.pyrun_inference() 按图片数量走不同模型方法:

  • 单图model.infer(),走 gundam 配置(base_size=1024, image_size=640, crop_mode=True),适合大图切片
  • 多图model.infer_multi()(image_size=1024),保留跨页上下文

Read the full file on GitHub · 90 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 5d ago First seen · 90 lines · 1,684 tokens per session scan A 8344eab0ddaf

Subscribe to this mod's changes

unlimited-ocr-mcp-server CLAUDE.md is an instructions file published in the GitHub repository tinygone/unlimited-ocr-mcp-server (0 stars, last pushed 1mo ago), licensed MIT. It adds 1,684 tokens to every session, about $0.0084 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other instructions, from other repositories

next.js AGENTS.md

AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.

vercel/next.js · 7,296 tokens

codex AGENTS.md

AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.

openai/codex · 5,182 tokens

vscode buildNext.instructions.md

Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).

microsoft/vscode · 6,785 tokens

vscode oss-third-party-notices.instructions.md

Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).

microsoft/vscode · 5,001 tokens

langchain AGENTS.md

AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.

langchain-ai/langchain · 4,469 tokens

spec-kit AGENTS.md

AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.

github/spec-kit · 7,104 tokens