StructOCR MCP Server
# StructOCR MCP Server
Official [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server for the [StructOCR API](https://structocr.com/developers?utm_source=npm&utm_medium=readme&utm_campaign=mcp).
Give Claude Desktop, Cursor, Claude Code, VS Code, Windsurf, and any MCP-compatible AI agent direct access to **22 structured OCR & verification endpoints** — spanning identity & KYC (US/Canadian front+back driver license verification, PDF417 barcodes, driver licenses, passports, travel visas, proof of address, national IDs, health insurance cards), general documents (multi-page PDF table/JSON extraction, Image to Excel), vehicles & insurance (VIN, VIN Pro vehicle decode, license plates, vehicle registrations including Saudi Istimara & UAE Mulkiya, auto insurance cards), finance (multi-page PDF invoices, receipts), and logistics (bills of lading, shipping containers, weighbridge tickets, ATM cassettes, boat HINs). One tool call per document, zero template training, pay-as-you-go credits that never expire.
## Get a free API key
1. [Create an account](https://structocr.com/register?utm_source=npm&utm_medium=readme&utm_campaign=mcp). New accounts get **200 permanent free credits** (50 full driver license verifications or 100 two-credit document scans), with no credit card required.
2. Copy your key from **API Keys** in the dashboard.
3. Optionally test any endpoint on a sample document in the [Playground](https://structocr.com/dashboard/playground?utm_source=npm&utm_medium=readme&utm_campaign=mcp) before connecting your agent.
After the free credits, packs start at $5 for 500 credits ($0.0058–$0.01/credit). There is no monthly subscription and credits never expire. See [pricing](https://structocr.com/pricing?utm_source=npm&utm_medium=readme&utm_campaign=mcp).
## Supported documents & endpoints
| Document / Workflow | MCP Tool / `document_type` | Credits | Zero Retention | Try it |
| --- | --- | --- | --- | --- |
| US/Canada driver license verify (front OCR + back PDF417) | `verify_driver_license` | 4 | Yes | [Try it](https://structocr.com/solutions/driver-license-verification-api?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| PDF table & JSON extraction (up to 20 pages) | `extract_pdf` | 2 / page | Yes | [Try it](https://structocr.com/tools/pdf-table-extractor?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try) |
| Image to Excel table extraction | `image_to_excel` | 2 / image | Yes | [Try it](https://structocr.com/tools/image-to-excel?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try) |
| US/Canada driver license PDF417 barcode | `scan_document` (`driver_license_pdf417`) | 2 | Yes | [Try it](https://structocr.com/tools/driver-license-pdf417-scanner?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try) |
| Driver license (front) | `scan_document` (`driver_license`) | 2 | — | [Try it](https://structocr.com/products/driver-license-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Passport (MRZ + visual) | `scan_document` (`passport`) | 2 | — | [Try it](https://structocr.com/products/passport-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| National ID card | `scan_document` (`national_id`) | 2 | — | [Try it](https://structocr.com/products/national-id-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Health insurance card | `scan_document` (`health_card`) | 2 | Yes | [Try it](https://structocr.com/products/health-card-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Proof of Address | `scan_document` (`proof_of_address`) | 2 | Yes | [Try it](https://structocr.com/products/proof-of-address-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Travel visa (MRV-A/B & eVisa) | `scan_document` (`visa`) | 2 | Yes | [Try it](https://structocr.com/products/visa-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| VIN | `scan_document` (`vin`) | 1 | — | [Try it](https://structocr.com/products/vin-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| VIN Pro (VIN + vehicle details) | `scan_document` (`vin_pro`) | 2 | — | |
| License plate | `scan_document` (`license_plate`) | 1 | — | [Try it](https://structocr.com/products/license-plate-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Vehicle registration (Istimara, Mulkiya, global) | `scan_document` (`vehicle_registration`) | 2 | — | [Try it](https://structocr.com/products/vehicle-registration-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Auto insurance card | `scan_document` (`auto_insurance`) | 2 | — | [Try it](https://structocr.com/products/auto-insurance-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Invoice (multi-page PDF up to 5 pages) | `scan_document` (`invoice`) | 3 | — | [Try it](https://structocr.com/products/invoice-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Receipt | `scan_document` (`receipt`) | 1 (2 enhanced) | — | [Try it](https://structocr.com/products/receipt-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Shipping container (ISO 6346) | `scan_document` (`container`) | 1 | — | [Try it](https://structocr.com/products/container-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Bill of Lading & freight | `scan_document` (`bill_of_lading`) | 3 | — | [Try it](https://structocr.com/products/bill-of-lading-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| Weighbridge ticket | `scan_document` (`weighbridge_ticket`) | 2 | — | [Try it](https://structocr.com/products/weighbridge-ticket-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
| ATM cassette | `scan_document` (`atm_cassette`) | 1 | — | |
| HIN (boat hull number) | `scan_document` (`hin`) | 1 | — | [Try it](https://structocr.com/products/hin-ocr?utm_source=npm&utm_medium=readme&utm_campaign=mcp_try#live-demo) |
Only successful requests are charged. Failed pages on `extract_pdf` / `image_to_excel` and unreadable back barcodes (`HTTP 422`) on `verify_driver_license` are automatically refunded.
## Quick setup
Node.js 18+ is required. Run directly via `npx` without a global install:
### Claude Desktop (`claude_desktop_config.json`)
```json
{
"mcpServers": {
"structocr": {
"command": "npx",
"args": ["-y", "structocr-mcp"],
"env": {
"STRUCTOCR_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
### Cursor (`.cursor/mcp.json`)
```json
{
"mcpServers": {
"structocr": {
"command": "npx",
"args": ["-y", "structocr-mcp"],
"env": {
"STRUCTOCR_API_KEY": "YOUR_API_KEY"
}
}
}
}
```
### Claude Code
```bash
claude mcp add structocr -e STRUCTOCR_API_KEY="YOUR_API_KEY" -- npx -y structocr-mcp
```
### VS Code (`.vscode/mcp.json`)
```json
{
"servers": {
"structocr": {
"type": "stdio",
"command": "npx",
"args": ["-y", "structocr-mcp"],
"env": {
"STRUCTOCR_API_KEY": "${input:structocr_api_key}"
}
}
},
"inputs": [
{
"id": "structocr_api_key",
"type": "promptString",
"description": "StructOCR API Key",
"password": true
}
]
}
```
## Available MCP tools
| Tool | Endpoint | Credits | Purpose |
| --- | --- | --- | --- |
| `verify_driver_license` | `POST /v1/driver-license-verify` | 4 | Front OCR + back AAMVA PDF417 cross-check, DD/DCF check, expiry, and `min_age` check (strict Zero Data Retention; card-level check only, does not query DMV registries). |
| `extract_pdf` | `POST /v1/pdf-extract` | 2 / page | Multi-page PDF & scanned document table/KV/custom-schema JSON extraction up to 10 MB / 20 pages (strict Zero Data Retention). |
| `image_to_excel` | `POST /v1/image-to-excel` | 2 / image | Convert table photos and scans into deterministic `headers[]` and `rows[][]` arrays (strict Zero Data Retention). |
| `scan_document` | 19 `/v1/*` endpoints | 1–3 | Scan passports, national IDs, driver licenses, PDF417 barcodes, visas, proof of address, health cards, VIN/VIN Pro, license plates, vehicle registrations (Saudi Istimara, UAE Mulkiya, US DMV), auto insurance cards, invoices, receipts, containers, bills of lading, weighbridge tickets, ATM cassettes, and HINs. |
| `get_account_balance` | `GET /v1/account/balance` | 0 | Check remaining non-expiring credits and current-month API usage. |
| `list_supported_documents` | Local metadata | 0 | List all 22 document endpoints, credit costs, zero-retention flags, and accepted formats (works without an API key). |
### Supported file inputs
Every file parameter (`file`, `front_file`, `back_file`) accepts:
- A **local file path** (e.g. `./license-front.jpg`, `/path/to/license-back.heic`, `./statement.pdf`)
- A **base64 data URL** (e.g. `data:image/jpeg;base64,...`)
- A **raw base64 string** with valid JPEG, PNG, WebP, HEIC/HEIF, or PDF magic bytes
Size & format limits:
- `verify_driver_license` and `scan_document` (`driver_license_pdf417`): JPG, PNG, WebP, and Apple HEIC/HEIF up to 4.5 MB.
- Other `scan_document` endpoints: JPG, PNG, WebP, HEIC/HEIF, and PDF up to 4.5 MB.
- `extract_pdf` and `image_to_excel`: PDF, JPG, PNG, and WebP up to 10 MB / 20 pages.
## Example agent prompts
- *"Verify `./license-front.jpg` and `./license-back.heic` with minimum age 21 and tell me if DD matches DCF."*
- *"Extract all tables from pages 1–5 of `./q4-statement.pdf` and save them as a CSV."*
- *"Scan `./saudi-istimara.jpg` as a `vehicle_registration` and return the VIN, plate number, and owner name."*
- *"Check my StructOCR credit balance."*
## Configuration
| Environment variable | Required | Default | Description |
| --- | --- | --- | --- |
| `STRUCTOCR_API_KEY` | Yes (for live scans) | — | Your StructOCR API key |
| `STRUCTOCR_BASE_URL` | No | `https://api.structocr.com/v1` | Custom API base URL |
| `STRUCTOCR_TIMEOUT_MS` | No | `60000` | Request timeout in milliseconds |
## Machine-Readable Specs, SDKs & Automation
- **Python SDK (`pip install structocr`)**: [`dracula911/structocr-python`](https://github.com/dracula911/structocr-python)
- **Node.js SDK (`npm install structocr`)**: [`dracula911/structocr-node`](https://github.com/dracula911/structocr-node)
- **OpenAPI 3.1 Spec**: [`https://structocr.com/openapi.json`](https://structocr.com/openapi.json)
- **LLM Documentation Index**: [`https://structocr.com/llms.txt`](https://structocr.com/llms.txt) · [`https://structocr.com/llms-full.txt`](https://structocr.com/llms-full.txt)
- **n8n Workflow Guides**: [Driver License Verification](https://structocr.com/blog/platforms/n8n-driver-license-verification) · [Image to Excel](https://structocr.com/blog/platforms/n8n-image-to-excel-ocr) · [Saudi Istimara](https://structocr.com/blog/platforms/n8n-saudi-istimara-ocr)
- **API Reference**: [`https://structocr.com/developers`](https://structocr.com/developers?utm_source=npm&utm_medium=readme&utm_campaign=mcp)
## Errors & privacy
- Built on the official [`structocr`](https://www.npmjs.com/package/structocr) Node.js SDK. Errors return structured JSON (`error`, `status`, `code`, `retryable`, `details`) with `isError: true` — the server never retries OCR calls automatically to prevent duplicate charges.
- Strict Zero Data Retention is enforced on `verify_driver_license`, `extract_pdf`, `image_to_excel`, `driver_license_pdf417`, `health_card`, `proof_of_address`, and `visa`.
## License
MIT
TDQS
Scored across 6 tools
Most tools target distinct operations, but verify_driver_license overlaps with scan_document, whose driver_license_pdf417 endpoint covers driver licenses too, and extract_pdf overlaps with scan_document for PDF inputs. The descriptions hint at the difference (dedicated two-sided AAMVA verification vs. generic schema extraction), but an agent could easily misselect between them.
Five of six tools follow a clean verb_noun snake_case pattern (get_account_balance, verify_driver_license, extract_pdf, scan_document, list_supported_documents). image_to_excel breaks the pattern slightly by being noun_to_noun, but it remains readable and consistent in casing.
Six tools is well-scoped for an OCR/extraction API: account, discovery, three extraction modes, and one specialized verification. Each tool clearly earns its place with no filler.
The surface covers discovery, billing/usage, generic PDF extraction, table extraction, schema-based document scanning, and license verification—enough for typical workflows. Minor gaps exist around batch/multi-file submission, async job status, or structured error/result retrieval that a production OCR pipeline might expect.