Automate

MCP server

Give the PDF tools to your AI agents (Claude and others).

@pdfforge/mcp is a Model Context Protocol server that exposes the pdfforge toolbox to AI agents — Claude Code, Claude Desktop, Cursor, or any MCP client. The agent works with file paths; the server handles upload, base64 and saving results.

Setup

Add the server to your MCP client config (example for Claude Code / Claude Desktop):

{
  "mcpServers": {
    "pdfforge": {
      "command": "npx",
      "args": ["-y", "@pdfforge/mcp"],
      "env": {
        "PDFFORGE_API_KEY": "pf_live_..."
      }
    }
  }
}
Env variableDescription
PDFFORGE_API_KEYRequired. Your API key.
PDFFORGE_BASE_URLOptional API override (staging, self-hosted).
PDFFORGE_OUTPUT_DIRWhere generated PDFs/images are written (default: the OS temp dir).

The tools

Generation

ToolWhat it does
generate_pdf_from_htmlHTML string → PDF file (Tailwind supported).
generate_pdf_from_templateStored template + JSON data → PDF.
list_templates / get_templateDiscover templates and their data schema.

Operations

ToolWhat it does
merge_pdfsMerge files by path, in order.
split_pdfOne file per page.
pdf_to_imageRasterize pages to PNG — how the agent looks at a document.
strip_pdf_watermarkStructurally remove overlay watermarks.

The perceive → act loop

ToolWhat it does
pdf_perceiveCall this first. Structured map: elements with stable ids, text, bboxes, semantic labels (email, phone, iban, amount...), logical regions (header, line_items_table, signature_area...).
edit_pdf_textRewrite elements by perceived id — design stays intact; works on vector text and OCR/scanned spans.
redact_pdfTrue redaction by element ids, regex pattern, semantics labels, or raw regions. flatten: true rasterizes for scans.
place_signatureBurn a signature image, anchored to text (anchor_text) or the perceived signature_area.

PDF templates (the import flow)

ToolWhat it does
create_pdf_templateMark perceived elements as variables → a reusable template from ANY designed PDF.
fill_pdf_templateRender a stored PDF template with values.
list_pdf_templatesDiscover templates and their variables.

Perceive first

The action tools (edit_pdf_text, redact_pdf, place_signature, create_pdf_template) act on the ids and bboxes returned by pdf_perceive. Ids change after every edit — re-perceive between operations on the same file. The server caches perceptions per file and guards against silently corrupted output (an edit that would destroy unrelated text is aborted).

Example session

A prompt like this is enough — the agent chains the tools itself:

Take ~/Documents/contract.pdf: redact every email address and phone number,
place my signature (~/Documents/signature.png) under "Le Directeur",
then show me page 1.

pdf_perceiveredact_pdf (semantics: ["email", "phone"]) → place_signature (anchor "Le Directeur") → pdf_to_image.

Next steps

  • Inspect — the perception layer these tools are built on.
  • Import a PDF — the template flow behind create_pdf_template.
  • n8n — no-code automation instead.

On this page