MCP Integration

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

Overview

pdfstork 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 pdfstork 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 Code (CLI)

Add the server with one command:

Terminalbash
claude mcp add --transport http pdfstork https://pdfstork.com/mcp/pdf \
  --header "Authorization: Bearer YOUR_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 YOUR_API_TOKEN"
      }
    }
  }
}

Claude Desktop

Claude Desktop's configuration file starts local servers only. Connect to pdfstork through the mcp-remote bridge, which runs locally and forwards to the HTTP endpoint (Node.js required). 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": {
    "pdfstork": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://pdfstork.com/mcp/pdf",
        "--header",
        "Authorization: Bearer YOUR_API_TOKEN"
      ]
    }
  }
}

Restart Claude Desktop after saving the file.

Cursor

Add the server to ~/.cursor/mcp.json for all projects, or to .cursor/mcp.json in a project:

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

Windsurf

Edit ~/.codeium/windsurf/mcp_config.json:

mcp_config.jsonjson
{
  "mcpServers": {
    "pdfstork": {
      "serverUrl": "https://pdfstork.com/mcp/pdf",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Codex (OpenAI CLI)

Add a section to ~/.codex/config.toml:

~/.codex/config.tomltoml
[mcp_servers.pdfstork]
url = "https://pdfstork.com/mcp/pdf"
http_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": {
    "pdfstork": {
      "type": "remote",
      "url": "https://pdfstork.com/mcp/pdf",
      "headers": {
        "Authorization": "Bearer YOUR_API_TOKEN"
      }
    }
  }
}

Available tools

The MCP server provides four tools:

ToolDescription
list-templatesList the templates of the token's 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.