idin9-doc-ocr-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@idin9-doc-ocr-mcp Extract the Thai tax invoice from invoice.pdf and route it"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
idin9-doc-ocr-mcp
Standalone Model Context Protocol (MCP) server for document OCR and Thai tax invoice processing, with automated scanner ingestion (SMB/Shared Folder) and SQLite storage.
The server extracts tax invoices from PDFs and scanned images, parses the 13 core Thai tax-invoice fields, applies three-tier routing (success / need-train / failed), and stores results in SQLite. It can also poll an SMB scanner share or watch a local drop folder.
Features
Digital + scanned documents — PyMuPDF for embedded text, Tesseract (
tha+eng) with image pre-processing (grayscale, de-noise, adaptive threshold, de-skew) for scans.Thai tax invoice parsing — supplier/buyer, 13-digit tax IDs, line items, summary, currency, and capture-rate scoring.
Three-tier routing
success— 100% capture + valid totals + buyer verification →processed/YYYY-MM/need_train— 80–99% capture →Need-Train/failed— < 80% capture or non-tax document →failed/
Automated ingestion — SMBv2/v3 scanner share polling and watchdog folder watching.
SQLite storage — WAL mode, tax invoices + canonical contacts tables, full CRUD.
MCP tools — exposed via FastMCP for Hermes / Claude Desktop / any MCP client.
Related MCP server: DocumentPro MCP
Requirements
Python 3.11+
Tesseract OCR with Thai + English language packs (
tesseract-ocr-tha,tesseract-ocr-eng)Access to a scanner SMB share (optional)
Debian / Ubuntu Tesseract install
sudo apt-get update
sudo apt-get install -y tesseract-ocr tesseract-ocr-tha tesseract-ocr-engInstallation
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # then edit valuesConfiguration
Copy .env.example to .env and adjust:
Variable | Description |
| Local/mounted scanner drop folder |
| SMB scanner share (leave blank to disable) |
| SQLite database path |
| OCR engine settings |
| Threshold to decide digital vs scanned extraction |
Running
python -m src.mcp_serverOr with Docker:
docker compose up --buildMCP Client Configuration
Hermes
{
"mcpServers": {
"idin9-doc-ocr-mcp": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/path/to/idin9-doc-ocr-mcp",
"env": {
"TESSERACT_CMD": "tesseract",
"OCR_LANGUAGES": "tha+eng"
}
}
}
}Claude Desktop
{
"mcpServers": {
"idin9-doc-ocr-mcp": {
"command": "python",
"args": ["-m", "src.mcp_server"],
"cwd": "/path/to/idin9-doc-ocr-mcp"
}
}
}Available Tools
Tool | Purpose |
| Extract a single PDF/image invoice |
| Process all pending files in a folder |
| Pull & process new files from the SMB share |
| Retrieve a stored record |
| List records with filters |
| CRUD on contacts |
| List low-confidence ( |
| Confirm (→ success) or reject (→ failed) a review item |
| DB/SMB/queue health report |
Human Review Workflow (Multi-User)
Documents that score 80–99% capture (or have valid totals but an unverified
buyer) are routed to Need-Train/ and stored with status need_train. These are
held for human confirmation before they are trusted as final.
Two interfaces are provided, both backed by the same SQLite database:
1. MCP tools (for Claude Desktop / Hermes)
ocr_review_queue()→ returns pending items.ocr_review_record(invoice_id, action="confirm"|"reject", reviewer, notes?, corrected?)confirm → status becomes
success, file moves toprocessed/YYYY-MM/, reviewer identity and optional corrected fields are stored.reject → status becomes
failed, file moves tofailed/.
2. Web UI (for manual multi-user review)
Run the review web server:
python -m src.webui
# or: idin9-doc-ocr-webui
# optional port: WEBUI_PORT=8080 python -m src.webuiOpen http://localhost:8080. The queue lists every pending invoice; opening one
shows an editable form (header, supplier, buyer, summary) plus the raw OCR text.
A reviewer enters their name, then Confirms as correct or Rejects as bad.
The reviewer name is remembered via a cookie and recorded on the record
(reviewer, reviewed_at, review_notes, review_status).
The tax_invoices table gains these review columns: review_status
(pending/confirmed/rejected), reviewer, reviewed_at, review_notes.
Data Layout
data/
drop/ # scanner drop folder (watchdog)
staging/ # temporary download area (SMB)
processed/YYYY-MM/ # successful extractions
Need-Train/ # 80-99% capture, for review/training
failed/ # <80% capture or non-tax documents
idin9_doc_ocr.db # SQLite databaseDevelopment & Tests
pip install -e ".[dev]"
pytestLicense
MIT
Available Tools
9 toolsocr_batch_processC
Process all pending files in the drop/staging directory.
Inputs: folder_path.
ocr_extract_invoiceA
Extract a single PDF/image invoice and return structured JSON.
Inputs: file_path (required).
ocr_get_recordC
Retrieve a processed invoice record from the database.
Inputs: invoice_id, invoice_number.
ocr_list_recordsC
List invoice records with optional status filter.
Inputs: limit, status. Returns: result
ocr_manage_contactC
Perform CRUD operations on the contacts database.
Inputs: action (required), tax_id (required), company_name.
ocr_review_queueA
List low-confidence (need_train) records awaiting human confirmation.
Inputs: limit. Returns: result
ocr_review_recordB
Confirm (as success) or reject (as failed) a low-confidence record.
corrected is an optional JSON string of overridden fields (invoiceNumber,
invoiceDate, currency, supplier_name, supplier_taxId, buyer_name,
buyer_taxId, capture_rate).
Inputs: action (required), reviewer (required), invoice_id (required), notes, +1 more.
ocr_system_healthA
Report database status, SMB status, and queue depth.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 9 tools
Most tools have clearly distinct purposes: extraction, batch processing, scanner polling, record retrieval, review, contact management, and health checks. The only slight overlap is between ocr_batch_process and ocr_poll_scanner_share, since both process files from directory-like sources.
All tools share the ocr_ prefix and use snake_case, which creates a strong predictable pattern. However, ocr_batch_process and ocr_system_health deviate from the strict verb_noun structure used by most other tools.
Nine tools is well-scoped for an OCR invoice processing server covering ingestion, extraction, retrieval, review, contacts, and system health. Each tool serves a meaningful part of the workflow without redundancy or bloat.
The toolset covers the main OCR invoice lifecycle: extract, batch process, poll scanner, retrieve/list records, review low-confidence results, manage contacts, and check health. Minor gaps exist, such as no direct update/delete for processed invoice records outside the review flow or explicit reprocessing of failed items.
Related MCP Connectors
Receipt extraction, invoice-to-PO quantity allocation, and free three-document discrepancy checks.
Turn PDFs, scans and photos into a queryable database. Invoices, CVs, receipts, in bulk.
AI-OCR for invoices, faxes, handwriting and photos. Extract structured data with custom layouts.
Thailand Leceipt e-Tax: AI agents create, poll and download e-Tax Invoices, stateless BYO.
Related MCP Servers
- AlicenseAqualityDmaintenanceAccounting automation MCP server for Japanese tax firms. Two-stage classifier (keyword + Claude AI) with TaxRuleEngine for consumption tax, withholding, invoice system, and confidence-based routing.122MIT

DocumentPro MCPofficial
AlicenseNot gradedqualityDmaintenanceExtract structured, schema-typed data from invoices, purchase orders, receipts, and tax forms, and classify documents into custom label sets — via a hosted MCP server. Free tier included.MIT- AlicenseNot gradedqualityDmaintenanceConnects AI agents to ACCOS for OCR on Thai receipts, tax invoices, and withholding tax certificates via MCP.Apache 2.0
- FlicenseNot gradedqualityBmaintenanceEnables autonomous end-to-end SME loan underwriting through MCP microservices that handle email intake, document validation, KYC/AML screening, fraud detection, credit scoring, policy-based decisions, and automated Thai-language memo generation.-