Accie OCR
MCP
The Accie OCR MCP server is a thin stdio wrapper around the same HTTP API at https://ocr.accie.ai. It does not add a second product surface. File bytes are not sent through MCP — you PUT them to the upload_url the API returns.
Run it
Install and run:
pip install mcp httpx
ACCIE_API_URL=https://ocr.accie.ai ACCIE_API_KEY=accie_sk_... \
python mcp/accie_ocr_server.py
Cursor MCP config (do not commit keys):
{
"mcpServers": {
"accie-ocr": {
"command": "python",
"args": ["/absolute/path/to/accie_ocr/mcp/accie_ocr_server.py"],
"env": {
"ACCIE_API_URL": "https://ocr.accie.ai",
"ACCIE_API_KEY": "<from POST /api/v1/api-keys>"
}
}
}
}
Authentication (env only)
| Variable | Role |
|---|---|
ACCIE_API_URL | API base. Production: https://ocr.accie.ai. |
ACCIE_API_KEY | Preferred. Sent as Authorization: Bearer …. |
ACCIE_BEARER_TOKEN | Used only if the API key env is empty (session or Accie JWT). |
If neither secret is set, the server raises: Set ACCIE_API_KEY (preferred) or ACCIE_BEARER_TOKEN — never hard-code secrets. Every tool goes through that header helper, including tools that wrap public HTTP routes such as list_export_formats.
Tools
Each tool returns a JSON string (pretty-printed on success). HTTP calls use httpx with a 60s timeout.
| Tool | HTTP | Notes from the server docstring / code |
|---|---|---|
list_ocr_kinds |
GET /api/v1/ocr-kinds |
Five primary OCR kinds with org enablement. Unauthenticated call: HTTP 401 missing_bearer_token. |
create_ocr_job |
POST /api/v1/jobs |
Required filename. Defaults: document_class=invoice, estimated_pages=1, content_type=application/pdf, prefer_gpu=false. Optional: enhance, id_type_hint, script_profile. Legacy indic maps to handwritten + script_profile=indic. ID jobs set options.enhance default auto and validate=true. Returns upload_url — PUT the file yourself, then poll get_job_status. |
get_job_status |
GET /api/v1/jobs/{job_id} |
Status, page_count, document_class, documents[] for ID, error_message if any. |
export_job |
POST /api/v1/jobs/{job_id}/exports/{fmt} |
Default fmt=json. Docstring: short-lived download_url, pages are not re-charged. Formats follow the live export matrix. |
usage_summary |
GET /api/v1/usage |
Pages by OCR kind, feature events, plan entitlements. Auth required (not captured here). |
list_export_formats |
GET /api/v1/export-formats |
Public HTTP route. Body is on the REST API page. MCP still requires an API key in env. |
validate_indian_id |
POST /api/v1/id/validate |
Soft-validate without a job. Types: pan, aadhaar, dl, voter, passport, ration, pension, pran. Docstring: never government-verified. Aadhaar full numbers in the request may be masked in the response. |
list_id_schemas |
GET /api/v1/id/schemas |
Public HTTP route. Response includes government_verified: false and disclaimer “Soft validation only — format/checksum/heuristic checks. Not UIDAI, NSDL, Parivahan, NVSP, or DigiLocker authentication.” MCP still requires an API key in env. |
On HTTP 4xx/5xx, create_ocr_job, get_job_status, export_job, validate_indian_id, and list_id_schemas return a JSON object with error: true, status, and body instead of raising. list_ocr_kinds, usage_summary, and list_export_formats call raise_for_status().
Try it — the two public tools, without an MCP client
list_export_formats and list_id_schemas just call public HTTP routes under the hood. Run the same request an MCP agent would make:
Try it live — no key required
Every other tool — create_ocr_job, get_job_status, export_job, usage_summary, validate_indian_id, list_ocr_kinds — needs a real API key, since it acts on an organisation's data. See the REST API page for the full authenticated flow.
What MCP is not
- It is not a second API with different auth. Same bearer / API key as REST.
- It does not upload file bytes. Put bytes to
upload_url, then pollget_job_status.