MCP Integration
Connect PDF-API to your AI assistant using the Model Context Protocol (MCP).
Overview
PDF-API exposes an MCP (Model Context Protocol) server that allows AI assistants like Claude, Cursor, or Windsurf to generate PDFs from your templates through natural language.
Prerequisites
- A PDF-API account with at least one template
- An API token (go to Settings → API Tokens to create one)
- An MCP-compatible AI client
Server endpoint
https://pdfstork.com/mcp/pdfAuthentication uses a Bearer token in the Authorization header.
Configuration
Claude Desktop
Edit your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"pdf-api": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Claude Code (CLI)
Add to your project's .mcp.json at the repository root:
{
"mcpServers": {
"pdf-api": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Or configure it globally in ~/.claude/.mcp.json to make it available across all projects.
Cursor
Open Settings → MCP and add a new server:
- Name:
pdf-api - Type:
http - URL:
https://pdfstork.com/mcp/pdf - Headers:
Authorization: Bearer YOUR_API_TOKEN
Windsurf
Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"pdf-api": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Codex (OpenAI CLI)
Add to your project's .mcp.json at the repository root (Codex reads the standard MCP file):
{
"mcpServers": {
"pdf-api": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Or globally in ~/.codex/config.toml:
[mcp_servers.pdf-api]
type = "http"
url = "https://pdfstork.com/mcp/pdf"
headers = { Authorization = "Bearer YOUR_API_TOKEN" }opencode
Add the server to opencode.json at the project root, or globally in ~/.config/opencode/opencode.json:
{
"mcp": {
"pdf-api": {
"type": "http",
"url": "https://pdfstork.com/mcp/pdf",
"headers": {
"Authorization": "Bearer YOUR_API_TOKEN"
}
}
}
}Available tools
The MCP server provides four tools:
| Tool | Description |
|---|---|
list-templates | List all your PDF templates (IDs, names, types) |
get-template-details | Get a template's expected variables and example 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, type, created_at, and updated_at.
get-template-details
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | The template ID to inspect |
Returns the template's variables, their types, and example data when available.
generate-pdf
| Parameter | Type | Required | Description |
|---|---|---|---|
template_id | string | Yes | The template ID to use |
data | object | No | Key-value pairs for template variables |
filename | string | No | Output filename (default: document.pdf) |
output | string | No | url (default) or base64 |
With output: "url", returns a temporary download link valid for 60 minutes. With output: "base64", returns the PDF content as a base64-encoded string.
get-usage
No parameters required. Returns:
current_month_usage— PDFs generated this monthquota_limit— your plan's monthly limitquota_percentage— usage as a percentagehas_quota_remaining— whether you can still generate PDFsplan— your current plan (free,basic, orpro)
get-template-details before generating a PDF to understand the expected data structure. This helps AI assistants produce accurate results on the first try.