Document OCR MCP Server

Document OCR MCP Server

An AI-powered MCP server that extracts structured data from Indian identity documents (Aadhaar, Passport, PAN, Driving License) using OCR, enabling Claude Desktop to read and process document images locally.

Category
访问服务器

README

🪪 Document OCR MCP Server

An AI-powered MCP (Model Context Protocol) server that extracts structured data from Indian identity documents using OCR. Connect it to Claude Desktop and let Claude read your documents!


📋 Supported Documents

Document Extracted Fields
🪪 Aadhaar Card Name, DOB, Gender, Aadhaar Number*, Address, Pincode
🛂 Passport Name, Passport Number*, Nationality, DOB, Expiry, Sex, MRZ
📄 PAN Card Name, Father's Name, DOB, PAN Number*
🚗 Driving License Name, DOB, DL Number*, Validity, Address, Vehicle Classes
📃 Any Image Raw text + auto-detected document type + key-value pairs

* Sensitive fields are masked by default for privacy.


🚀 Quick Start

Step 1: Install Tesseract OCR (Windows)

Tesseract must be installed separately — it's the OCR engine under the hood.

  1. Download from: https://github.com/UB-Mannheim/tesseract/wiki
  2. Run the installer (choose Additional script data → Hindi if needed)
  3. Default install path: C:\Program Files\Tesseract-OCR\tesseract.exe
  4. Add to PATH, or set in your environment:
    $env:TESSDATA_PREFIX = "C:\Program Files\Tesseract-OCR\tessdata"
    

Step 2: Install Python Dependencies

cd d:\mcp
pip install -r requirements.txt

Step 3: Test the Server

# Run the MCP Inspector (opens browser UI to test tools)
fastmcp dev server.py

Or test directly:

python server.py

🤝 Connect to Claude Desktop

  1. Find your Claude Desktop config file:

    C:\Users\<YourName>\AppData\Roaming\Claude\claude_desktop_config.json
    
  2. Add this to the config:

    {
      "mcpServers": {
        "document-ocr": {
          "command": "python",
          "args": ["d:\\mcp\\server.py"]
        }
      }
    }
    
  3. Restart Claude Desktop

  4. You'll see the 🔌 tools icon — your OCR tools are ready!


💬 Example Claude Prompts

Once connected, you can ask Claude:

Extract all information from my Aadhaar card at C:/Users/me/aadhaar.jpg
What's the expiry date on my passport? Image is at D:/docs/passport.png
Read the PAN card image at C:/scans/pan.jpg and tell me the PAN number
Auto-detect what type of document this is and extract all fields:
C:/Downloads/document.jpg
Get raw text from this image: C:/photos/certificate.png

🛠️ MCP Tools Reference

extract_aadhaar(image_path, show_full=False)

Extract data from Aadhaar card front or back.

extract_passport(image_path, show_full=False)

Extract data from passport bio-data page. Uses MRZ parsing for high accuracy.

extract_pan_card(image_path, show_full=False)

Extract data from PAN card.

extract_driving_license(image_path, show_full=False)

Extract data from Driving License (front side recommended).

extract_any_document(image_path, document_type="auto", show_full=False)

Auto-detect document type and extract accordingly.

ocr_raw_text(image_path, language="eng")

Get raw OCR text from any image. Supports multi-language:

  • "eng" — English
  • "hin" — Hindi
  • "eng+hin" — English + Hindi
  • "eng+tam" — English + Tamil

🔒 Privacy & Security

  • Aadhaar numbers are masked to XXXX XXXX 1234 by default
  • PAN numbers are partially masked to AB*****4F by default
  • Passport numbers are partially masked by default
  • MRZ lines are redacted by default
  • Pass show_full=True to any tool to disable masking
  • All processing is 100% local — no data is sent to any cloud service

📁 Project Structure

d:\mcp\
├── server.py              # FastMCP server (entry point)
├── requirements.txt       # Python dependencies
├── pyproject.toml         # Project config
│
├── tools/
│   ├── aadhaar.py         # Aadhaar OCR
│   ├── passport.py        # Passport OCR + MRZ parser
│   ├── pan_card.py        # PAN Card OCR
│   ├── driving_license.py # Driving License OCR
│   └── generic_ocr.py    # Generic + auto-detect OCR
│
├── utils/
│   ├── image_preprocess.py  # OpenCV preprocessing pipeline
│   ├── validators.py        # Pydantic output models
│   └── privacy.py           # PII masking utilities
│
└── samples/               # Place test images here

⚠️ Troubleshooting

Issue Fix
TesseractNotFoundError Tesseract not in PATH — see Step 1 above
Low accuracy on Hindi text Install Hindi language pack for Tesseract
ModuleNotFoundError: fastmcp Run pip install -r requirements.txt
Image not readable Check file path is absolute and image is not corrupted
Missing fields in output Image quality too low — try a higher resolution scan

📜 License

MIT License — free to use and modify.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选