Start for Free

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

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

Authentication 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
claude_desktop_config.jsonjson
{
  "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:

.mcp.jsonjson
{
  "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:

mcp_config.jsonjson
{
  "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):

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

Or globally in ~/.codex/config.toml:

~/.codex/config.tomltoml
[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:

opencode.jsonjson
{
  "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:

ToolDescription
list-templatesList all your PDF templates (IDs, names, types)
get-template-detailsGet a template's expected variables and example 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, type, created_at, and updated_at.

get-template-details

ParameterTypeRequiredDescription
template_idstringYesThe template ID to inspect

Returns the template's variables, their types, and example data when available.

generate-pdf

ParameterTypeRequiredDescription
template_idstringYesThe template ID to use
dataobjectNoKey-value pairs for template variables
filenamestringNoOutput filename (default: document.pdf)
outputstringNourl (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 month
  • quota_limit — your plan's monthly limit
  • quota_percentage — usage as a percentage
  • has_quota_remaining — whether you can still generate PDFs
  • plan — your current plan (free, 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.