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
https://pdfstork.com/mcp/pdfThe 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:
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:
{
"mcpServers": {
"pdfstork": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer ${PDFSTORK_API_TOKEN}"
}
}
}
}Available tools
The MCP server provides four tools:
| Tool | Description |
|---|---|
list-templates | List the templates of the connected team (IDs, names, types) |
get-template-details | Get the variables of a template's published version, with sample data |
generate-pdf | Generate a PDF from a template with provided data |
get-usage | Check your quota and usage statistics |
Recommended workflow
- List templates: call
list-templatesto see your available templates - Inspect a template: call
get-template-detailswith the template ID to understand its variables - Generate a PDF: call
generate-pdfwith the template ID and required data - Check usage: call
get-usageto monitor your quota
Tool reference
list-templates
No parameters required. Returns an array of templates with id, name and type.
get-template-details
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | integer | Yes | The 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
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | integer | Yes | The template ID, as returned by list-templates. A numeric string such as "9" is also accepted |
data | object | No | Key-value pairs for template variables |
url_expiry | integer | No | How long the download link stays valid, in minutes (1 to 1440, default 60) |
metadata | object | No | Document 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 monthquota_limit: your plan's monthly limitquota_percentage: usage as a percentage of the quota, rounded to one decimalpack_credits: prepaid credits lefthas_quota_remaining: whether you can still generate PDFs, counting prepaid creditsplan: your current plan (discovery,basicorpro)
get-template-details before generating a PDF to understand the expected data structure. This helps AI assistants produce accurate results on the first try.