# PDF Compare: Text Changes + Annotated Diff PDF (MCP server) (`doubleaigents/pdf-compare-mcp`) Actor

Deterministic MCP tool for AI agents: compare two PDF versions and get every added, removed, changed or moved passage with page numbers, plus an annotated diff PDF. Column-aware, reflow-tolerant, OCR for scans. No LLM inside.

- **URL**: https://apify.com/doubleaigents/pdf-compare-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 $10.00 / 1,000 page compareds

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

## PDF Compare: Text Changes + Annotated Diff PDF (MCP server)

A deterministic PDF comparison tool for AI agents, served as an MCP server. There is no LLM inside,
so the same pair of files gives the same output every time. It runs on CPU and does not call any paid API.

**Use it for:** contract redlines when the other side did not track changes, policy and terms updates, new
versions of forms and standards, price list changes, regulatory documents, and checking that a "final" PDF
matches the approved draft.

**Why agents pick it:** asking an LLM "what changed?" across two long PDFs misses edits and invents others.
This tool diffs the actual words, so every reported change is really there and nothing is skipped. It returns
a structured list your agent can reason over, plus an annotated PDF a human can check in a minute.

| Tool | What your agent gets back |
|---|---|
| `compare_pdfs` | `changes`: each with `type` (added / removed / changed / moved), `old_text`, `new_text`, `old_pages`, `new_pages` and `context_before`. A `summary` with counts and word totals, and `identical_text` when nothing differs. `diff_pdf`: a summary page listing every change, followed by the new file with **green boxes** (added), **amber boxes** (changed, with the old wording in a note) and **red markers** where text was removed (removed wording in a note). |

How it stays accurate: two-column pages are read column by column; a line-level diff finds changed regions, then a
word-level diff inside each region pins the exact words, so text that only re-wrapped does not show as an edit.
Passages that were cut from one place and pasted in another are reported once as `moved`. Scanned pages are OCR'd.

### Connect

MCP endpoint (streamable HTTP):

```
https://doubleaigents--pdf-compare-mcp.apify.actor/mcp
Authorization: Bearer <APIFY_TOKEN>
```

Claude Desktop / Cursor style config:

```json
{ "mcpServers": { "pdf-compare": {
    "url": "https://doubleaigents--pdf-compare-mcp.apify.actor/mcp",
    "headers": { "Authorization": "Bearer <APIFY_TOKEN>" } } } }
```

### Tool inputs

`compare_pdfs(old_file_url | old_file_base64, new_file_url | new_file_base64, ignore_case=false, lang="eng", include_inline_pdf=true)`

- Both files must be PDFs (public http/https URL or base64), up to 50 MB and 500 pages each.
- The diff PDF and the full change list come back as key-value store URLs. A diff PDF under 8 MB also comes back inline as base64 unless `include_inline_pdf` is false.

### Pricing (pay per event)

| Event | USD |
|---|---|
| `page-compared`: each page compared, counted as the page count of the longer file | 0.01 |

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 compares text, not images, colours or fonts. A changed logo or a changed figure in a chart is not reported.
- Heavily re-laid-out documents (a table rebuilt as paragraphs, content moved between pages) produce more, smaller changes. Every one is real, but some may be layout rather than wording.
- Boxes are drawn on unrotated pages. On rotated pages the change notes are still added.
- Scans are OCR'd with Tesseract (English by default); OCR noise on poor scans shows up as small changes.

### Batch mode

You can also run the Actor normally with `oldFileUrl` and `newFileUrl`. It writes one dataset item with the counts, the first 1,000 changes, and links to the diff PDF and the full changes JSON.

### 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.
- [Invoice & Receipt to JSON + Excel](https://apify.com/doubleaigents/invoice-receipt-to-json-mcp) — supplier, dates, VAT number, line items and net/VAT/gross, with the totals reconciled.
- [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.

# Actor input Schema

## `oldFileUrl` (type: `string`):

Public http(s) URL of the original PDF (max 50 MB, 500 pages).

## `newFileUrl` (type: `string`):

Public http(s) URL of the revised PDF. The annotated diff is drawn on this file.

## `ignoreCase` (type: `boolean`):

Treat 'Total' and 'TOTAL' as the same word.

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

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

## Actor input object example

```json
{
  "oldFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2017.pdf",
  "newFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2018.pdf",
  "ignoreCase": false,
  "lang": "eng"
}
```

# Actor output Schema

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

One row per comparison: counts of added/removed/changed/moved passages, the change list (first 1,000) and links to the annotated diff PDF and the full changes JSON.

## `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 = {
    "oldFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2017.pdf",
    "newFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2018.pdf"
};

// Run the Actor and wait for it to finish
const run = await client.actor("doubleaigents/pdf-compare-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 = {
    "oldFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2017.pdf",
    "newFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2018.pdf",
}

# Run the Actor and wait for it to finish
run = client.actor("doubleaigents/pdf-compare-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 '{
  "oldFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2017.pdf",
  "newFileUrl": "https://www.irs.gov/pub/irs-prior/fw9--2018.pdf"
}' |
apify call doubleaigents/pdf-compare-mcp --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,doubleaigents/pdf-compare-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/wlcRA0rbjax5IvqFL/builds/4OawDqiMJggNxaP6W/openapi.json
