# Invoice & Receipt to JSON + Excel, Totals Checked (MCP server) (`doubleaigents/invoice-receipt-to-json-mcp`) Actor

Deterministic MCP tool for AI agents: invoice or receipt PDF/scan to structured JSON + XLSX (supplier, dates, invoice no., VAT no., line items, net/VAT/gross) with lines, net, VAT and gross reconciled and an all_ok flag. No LLM inside.

- **URL**: https://apify.com/doubleaigents/invoice-receipt-to-json-mcp.md
- **Developed by:** [Double AIgents](https://apify.com/doubleaigents) (community)
- **Categories:** AI, MCP servers, Developer tools
- **Features:** Limited permissions, Single-tenant, Server interface
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $30.00 / 1,000 invoice/receipt page processeds

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Invoice & Receipt to JSON + Excel, Totals Checked (MCP server)

A deterministic invoice and receipt reader for AI agents, served as an MCP server. There is no LLM inside,
so the same file gives the same output every time. It runs on CPU and does not call any paid API.

**Use it for:** accounts-payable intake, expense receipts, bookkeeping imports, matching invoices to purchase
orders or bank lines, and checking supplier invoices before they are paid.

**Why agents pick it:** an agent that books a wrong total costs real money. This tool does not just read the
figures, it does the arithmetic: every line's qty x unit price is recomputed, line items are summed against the net,
and net + VAT is checked against the gross. Your agent gets a plain `all_ok` flag and a list of the checks, so it
knows when to trust the result and when to ask a human.

| Tool | What your agent gets back |
|---|---|
| `invoice_to_json` | `supplier`, `invoice_number`, `invoice_date` and `due_date` (ISO), `vat_number` / `vat_numbers`, `currency`, `net`, `vat`, `gross`, `discount`, `shipping`, and `line_items` (description, qty, unit_price, discount_pct, vat_rate, tax_amount, amount). `checks` lists every reconciliation made, with the computed and stated figure. `all_ok` is true only when every check that could be made passed. Plus an XLSX with **Invoice**, **Line items** and **Checks** sheets. |

Reads PDFs with a text layer directly, and OCRs scanned PDFs and photos (PNG, JPG, TIFF) with Tesseract. Labels are
recognised in English, with common German, French and Dutch equivalents (Rechnungsnr., Total HT, TVA, Totaal, BTW,
MwSt). Amounts in `1,234.56`, `1.234,56` and `3,89 €` styles are all handled.

### Connect

MCP endpoint (streamable HTTP):

```
https://doubleaigents--invoice-receipt-to-json-mcp.apify.actor/mcp
Authorization: Bearer <APIFY_TOKEN>
```

Claude Desktop / Cursor style config:

```json
{ "mcpServers": { "invoices": {
    "url": "https://doubleaigents--invoice-receipt-to-json-mcp.apify.actor/mcp",
    "headers": { "Authorization": "Bearer <APIFY_TOKEN>" } } } }
```

### Tool inputs

`invoice_to_json(file_url | file_base64, filename?, lang="eng")`

- Send exactly one of `file_url` (public http/https) or `file_base64`. Supported files are PDF, PNG, JPG, TIFF, BMP and WEBP, up to 50 MB and 500 pages.
- The XLSX comes back as a key-value store URL. Files under 8 MB also come back inline as base64.

### Pricing (pay per event)

| Event | USD |
|---|---|
| `page-processed`: each page of the input file, after extraction and reconciliation | 0.03 |

You are charged only after a call completes. If your run's maximum charge cannot cover the page count, the call is refused before any work is done.

### Limits worth knowing

- It is a layout reader, not a language model. It finds fields by their labels and position. Unusual layouts can leave a field empty; when that happens it is left `null`, never guessed.
- `all_ok: false` means a check failed **or** there was nothing to check (no total found). Read `problems`.
- The supplier is taken from a "From/Supplier/Sold by" block, else the letterhead. On invoices where the customer's name is printed first, check this field.
- Handwriting is not supported. Poor photos lower OCR accuracy; the reconciliation is what flags it.

### Batch mode

You can also run the Actor normally with `fileUrl` (or a list in `fileUrls`). It writes one dataset item per file with the fields, line items, checks and a link to the XLSX.

### Who runs it

Double AIgents Ltd, UK (company no. 17513072). Your input files are processed for the call. Outputs sit in the run's Apify storage, which Apify removes under its data-retention policy.
Need volume pricing, a private deployment or a custom document pipeline? https://www.doubleaigents.com

### More tools from Double AIgents

- [PDF Tables to Excel + True PII Redaction](https://apify.com/doubleaigents/pdf-tables-and-true-redaction-mcp) — tables from PDFs and scans to XLSX with every figure double-read, and true redaction of personal data with a verification log.
- [Bank Statement PDF to CSV/Excel](https://apify.com/doubleaigents/bank-statement-to-csv-mcp) — every transaction, with running balances and opening/closing totals verified.
- [PDF Compare](https://apify.com/doubleaigents/pdf-compare-mcp) — every added, removed, changed or moved passage between two PDF versions, plus an annotated diff PDF.

# Actor input Schema

## `fileUrl` (type: `string`):

Public http(s) URL of an invoice or receipt (PDF, scanned PDF, PNG, JPG or TIFF; max 50 MB, 500 pages).

## `fileUrls` (type: `array`):

Process several files in one run, one dataset item each. If set, fileUrl is ignored.

## `lang` (type: `string`):

Tesseract language code for scanned pages. The image ships with eng.

## Actor input object example

```json
{
  "fileUrl": "https://slicedinvoices.com/pdf/wordpress-pdf-invoice-plugin-sample.pdf",
  "fileUrls": [],
  "lang": "eng"
}
```

# Actor output Schema

## `results` (type: `string`):

One row per file: supplier, invoice number, dates, net/VAT/gross, line items, the reconciliation checks, all_ok and a link to the XLSX.

## `files` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "fileUrl": "https://slicedinvoices.com/pdf/wordpress-pdf-invoice-plugin-sample.pdf"
};

// Run the Actor and wait for it to finish
const run = await client.actor("doubleaigents/invoice-receipt-to-json-mcp").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "fileUrl": "https://slicedinvoices.com/pdf/wordpress-pdf-invoice-plugin-sample.pdf" }

# Run the Actor and wait for it to finish
run = client.actor("doubleaigents/invoice-receipt-to-json-mcp").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "fileUrl": "https://slicedinvoices.com/pdf/wordpress-pdf-invoice-plugin-sample.pdf"
}' |
apify call doubleaigents/invoice-receipt-to-json-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,doubleaigents/invoice-receipt-to-json-mcp"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/6HIcMRcPAPiNsaDAL/builds/FHw42MJlLmtvbj8lq/openapi.json
