Edit PDF text with Claude

Describe the change in plain words. Claude calls the pdf_edit tool, the text is rewritten in place with the document's own font, the page is rendered before and after, and the edit is refused if anything else on the page moved.

A real run on the hosted sample quotation: a name, a total and an IBAN, three edits, each verified. The prompt is the one shown.

Install

Claude Code

One line, nothing else to configure. The server runs on your machine, uploads the file you name and writes the result next to it. No key needed to start: 20 pages a day per IP, output watermarked. A free key (200 pages a month, no watermark on ordinary documents) lifts both.

claude mcp add pdfedit -- npx -y @niubai/pdfedit-mcp

With a key (get one, then put it in place of sk_live_your_key):

claude mcp add pdfedit -e PDFEDIT_API_KEY=sk_live_your_key -- npx -y @niubai/pdfedit-mcp

Claude Desktop

Add to claude_desktop_config.json and restart the app (drop the env block to start without a key):

{
  "mcpServers": {
    "pdfedit": {
      "command": "npx",
      "args": [
        "-y",
        "@niubai/pdfedit-mcp"
      ],
      "env": {
        "PDFEDIT_API_KEY": "sk_live_your_key"
      }
    }
  }
}

claude.ai

The web app cannot run a local server. Settings โ†’ Connectors โ†’ Add custom connector, name pdfedit, URL https://pdfedit-mcp-remote.niubai-pdfedit-remote-worker.workers.dev/mcp (paid Claude plans). This hosted server takes PDF URLs, not local paths.

What to say

Replace

In ./quote.pdf change "Acme Inc." to "Acme GmbH" and make the total 249.00 USD.

One call to pdf_edit; the result is written as quote.edited.pdf next to the original, which is never touched, and the changed page comes back as a before/after picture.

Redact

Redact every IBAN and every email address in ./statement.pdf before I share it.

The bytes are removed, not covered; metadata is swept; the reply lists anywhere the same string still appears.

Batch

Use ./offer-template.pdf and ./hires.csv: one PDF per row, filling {name} and {salary}.

pdf_batch returns a job id; pdf_job hands back one finished document per row.

What comes back

  • The edited PDF, written as a new file (x.edited.pdf, then x.edited.2.pdf); the original is never overwritten.
  • One record per edit: page, what was found, what it became, which font was used, and whether the verification passed.
  • A before/after image of every changed page, shown in the conversation.
  • A refusal instead of a file when a change cannot be verified: the page is rendered before and after, and anything that moved outside the edit rolls the edit back.

Limits

  • Without a key: 20 pages a day per IP, output watermarked.
  • With a key: 200 pages a month free, no watermark on ordinary documents. Get a key with one email, then set PDFEDIT_API_KEY.
  • Right-to-left scripts are refused; scanned pages go through OCR and a replacement is drawn as pixels; relative-positioned text (charts) may be rolled back. The error table lists each case.

Other clients: Cursor ยท VS Code. The same tools from any MCP client: GitHub, npm. No Node? The same API as an agent skill: npx skills add zp130221/pdfedit-mcp.