MCP Server
The Model Context Protocol (MCP) server lets AI-enabled tools — like Cursor, Claude Desktop, and other MCP clients — interact with your PDF Generator workspace programmatically. You can list, create, update, and delete templates, variables, and files directly from your AI coding environment.
What Is MCP?
MCP is an open protocol that standardizes how AI applications communicate with external tools and data sources. PDF Generator exposes its template management capabilities as MCP tools, resources, and prompts — making your entire template workspace available to AI assistants.
Connecting an MCP Client
Prerequisites
- An MCP client (Cursor, Claude Desktop, etc.)
- Your MCP token (generate from Profile → MCP Settings)
Configuration
Add the PDF Generator MCP server to your client's configuration. The server runs at:
https://app.generator.rest/mcp
Cursor
Add to your Cursor MCP configuration:
{
"mcpServers": {
"pdf-generator": {
"url": "https://app.generator.rest/mcp",
"headers": {
"Authorization": "Bearer YOUR_MCP_TOKEN"
}
}
}
}
Claude Desktop
Add to your Claude Desktop configuration file (claude_desktop_config.json):
{
"mcpServers": {
"pdf-generator": {
"command": "npx",
"args": [
"-y",
"@anthropic/client-mcp-transport",
"https://app.generator.rest/mcp",
"--header",
"Authorization: Bearer YOUR_MCP_TOKEN"
]
}
}
}
Authentication
Two authentication methods are supported simultaneously:
- Bearer Token —
Authorization: Bearer YOUR_MCP_TOKENheader - Query Parameter —
POST /mcp?mcpToken=YOUR_MCP_TOKEN
Generate your MCP token from Profile → MCP Settings.
Available Tools
| Tool | Description |
|---|---|
list_templates | List/search templates by name or type |
get_template | Get single template metadata |
create_template | Create a new template (name required; defaults: type=simple, renderer=itext) |
update_template | Update template metadata |
list_template_variables | List variables, optionally filter by template |
create_template_variable | Create a new variable |
update_template_variable | Update a variable |
delete_template_variable | Delete a variable |
list_template_files | List files for a template |
get_template_file | Get HTML content of a file |
save_template_file | Save HTML content (emits SSE event for preview refresh) |
Resources
Resources provide structured access to your data. MCP clients can read resources using the mcp:// URI scheme:
| Resource URI | Description |
|---|---|
mcp://templates | List all templates |
mcp://templates/{id} | Get a specific template |
mcp://templates/{id}/files | List files for a template |
mcp://templates/{id}/files/{name} | Get a specific file's content |
mcp://template-variables | List all variables |
mcp://template-variables/{id} | Get a specific variable |
Prompts
Prompts are pre-built templates that help AI assistants generate HTML content and suggest variable structures:
| Prompt | Purpose |
|---|---|
generate_html_template | Structured prompt for generating HTML template content |
suggest_template_variables | Prompt for suggesting relevant variables based on template content |
improve_html_styling | Prompt for improving CSS styling in existing templates |
Use prompts by invoking them through your MCP client — they return structured LLM instructions that guide the AI in creating better templates.
SSE Notifications
The MCP server supports Server-Sent Events (SSE) for real-time notifications. When you save a template file, the server broadcasts a template-saved event. MCP clients subscribed to the SSE stream receive these notifications and can trigger automatic refreshes.
POST /mcp— All MCP operations (initialize, list tools, call tool, etc.)GET /mcp— SSE stream for server notificationsDELETE /mcp— Session termination
Example: Creating a Template via MCP
Here's an example of what an AI assistant can do through the MCP server when you ask "Create an invoice template with common variables":
- Calls
create_templatewith{ name: "Invoice", type: "full", pageSize: "A4" } - Calls
create_template_variablefor each needed variable (invoiceNumber, customerName, lineItems, etc.) - Calls
save_template_fileto write the HTML body with proper variable placeholders - Calls
save_template_filefor header and footer content
All through natural language — no API calls to write manually.