MCP Integration

Connect pdfstork to your AI assistant using the Model Context Protocol (MCP).

Overview

pdfstork exposes an MCP (Model Context Protocol) server that lets AI assistants such as Claude, ChatGPT, Claude Code, Codex, opencode or pi generate PDFs from your templates through natural language.

Prerequisites

  • A pdfstork account with at least one template
  • An MCP-compatible AI client
  • For the agents you configure by hand, an API token (go to Settings → API Tokens to create one). Claude and ChatGPT only need you to sign in.

Server endpoint

MCP endpointtext
https://pdfstork.com/mcp/pdf

The server accepts two kinds of authentication: you sign in to pdfstork from the assistant (OAuth), or you give it an API token, sent as a Bearer token in the Authorization header.

Connect Claude or ChatGPT

Add pdfstork as a custom connector, using the endpoint above as its URL:

  • Claude (claude.ai and Claude Desktop): Settings → Connectors → Add custom connector, paste the URL, then click Connect.
  • ChatGPT: turn on developer mode (Settings → Apps & Connectors → Advanced settings), then create a connector with the URL and OAuth authentication.

A pdfstork page opens: sign in, pick the team the assistant will work in, and click Allow. The assistant acts in your name: it sees that team's templates, and the PDFs it generates count against the team's quota. You can disconnect it at any time in Settings → Connected apps.

Claude Code can sign in the same way: add the server without a header, then run /mcp and pick Authenticate.

Configuration with an API token

Pick your agent. The examples read your API token from the PDFSTORK_API_TOKEN environment variable: export it once in your shell, for example export PDFSTORK_API_TOKEN=….

Add the server with one command:

Terminalbash
claude mcp add --transport http pdfstork https://pdfstork.com/mcp/pdf \
  --header "Authorization: Bearer $PDFSTORK_API_TOKEN"

Add --scope user to make it available in all your projects. You can also declare it in the project's .mcp.json, at the repository root:

.mcp.jsonjson
{
  "mcpServers": {
    "pdfstork": {
      "type": "http",
      "url": "https://pdfstork.com/mcp/pdf",
      "headers": {
        "Authorization": "Bearer ${PDFSTORK_API_TOKEN}"
      }
    }
  }
}

Available tools

The MCP server provides four tools:

ToolDescription
list-templatesList the templates of the connected team (IDs, names, types)
get-template-detailsGet the variables of a template's published version, with sample data
generate-pdfGenerate a PDF from a template with provided data
get-usageCheck your quota and usage statistics

Recommended workflow

  1. List templates: call list-templates to see your available templates
  2. Inspect a template: call get-template-details with the template ID to understand its variables
  3. Generate a PDF: call generate-pdf with the template ID and required data
  4. Check usage: call get-usage to monitor your quota

Tool reference

list-templates

No parameters required. Returns an array of templates with id, name and type.

get-template-details

ParameterTypeRequiredDescription
template_idintegerYesThe template ID to inspect. A numeric string such as "9" is also accepted

Describes the published version of the template, the one the API renders. Returns id, name, type, variables, sample_data and a hint for the assistant. Each variable has a name, a type, an optional example and, for an array, the item_fields of its rows.

generate-pdf

ParameterTypeRequiredDescription
template_idintegerYesThe template ID, as returned by list-templates. A numeric string such as "9" is also accepted
dataobjectNoKey-value pairs for template variables
url_expiryintegerNoHow long the download link stays valid, in minutes (1 to 1440, default 60)
metadataobjectNoDocument properties (title, author, subject, keywords, creator), Basic plan and above

Returns url, a temporary download link to the PDF, with expires_at and size. The render costs one credit, like any API call.

get-usage

No parameters required. Returns:

  • current_month_usage: PDFs generated this month
  • quota_limit: your plan's monthly limit
  • quota_percentage: usage as a percentage of the quota, rounded to one decimal
  • pack_credits: prepaid credits left
  • has_quota_remaining: whether you can still generate PDFs, counting prepaid credits
  • plan: your current plan (discovery, basic or pro)
Tip
Always call get-template-details before generating a PDF to understand the expected data structure. This helps AI assistants produce accurate results on the first try.