MCP Server
MCP Server
LightningPDF ships a built-in Model Context Protocol (MCP) server, so AI agents such as Claude, Cursor, and Composio can generate and process PDFs directly. It exposes the full PDF tool surface over Streamable HTTP and is protected by a complete OAuth 2.1 authorization server with open Dynamic Client Registration, so most clients connect with no manual token pasting.
Endpoint
https://lightningpdf.dev/mcp
The endpoint speaks MCP over Streamable HTTP (single JSON response, no server-sent events). Point any MCP client at that URL.
Authentication
Two options are supported. Every tool call runs through the same authentication, per-plan rate limiting, and credit accounting as the REST API, so usage is billed exactly once against your plan.
Option 1: OAuth 2.1 (recommended)
Clients that support remote MCP OAuth discover everything automatically:
- The client calls
/mcpwith no token and receives401with aWWW-Authenticateheader pointing at the protected-resource metadata. - It reads
/.well-known/oauth-protected-resourceand/.well-known/oauth-authorization-server. - It registers itself at
POST /oauth/register(open Dynamic Client Registration, RFC 7591). Clients are public and use PKCE, so no client secret is issued. - It sends you to
/oauth/authorize, where you sign in and approve access on a consent screen. - It exchanges the authorization code at
POST /oauth/token(PKCES256required) for an access token and a refresh token.
Access tokens expire after one hour; the client refreshes them with the refresh token. You can revoke access at any time by deleting the corresponding key under Dashboard -> API keys (OAuth tokens appear there).
Option 2: API key bearer token
If your client lets you paste a token, use an existing lpdf_ API key created under Dashboard -> API keys:
Authorization: Bearer lpdf_live_your_key_here
This is the simplest path for scripts and self-hosted agents.
Available tools
| Tool | Description |
|---|---|
generate_pdf |
Render HTML, Markdown, a saved template, or a built-in template type into a PDF. Returns a stored record with a download URL (or base64 when storage is off). |
create_pdf_job |
Queue an asynchronous PDF job and return its id. |
get_pdf_job |
Get the status and result of an async job. |
merge_pdfs |
Merge 2 to 50 base64 PDFs into one. |
split_pdf |
Split a PDF into single-page PDFs. |
compress_pdf |
Compress a PDF (screen, ebook, printer, prepress). |
protect_pdf |
Add owner and user password protection. |
convert_pdf_to_pdfa |
Convert to archival PDF/A (Pro plan or above). |
get_pdf_info |
Return page count, dimensions, encryption, and more. |
list_templates |
List your saved templates. |
create_template |
Create a reusable template. |
get_template |
Fetch a template by id. |
update_template |
Update a template. |
delete_template |
Delete a template. |
get_usage |
Return your credit balance, monthly allowance, PDFs this month, and plan. |
PDF inputs and outputs for the post-processing tools are base64-encoded. Large outputs above the inline limit return a note pointing back at the equivalent REST endpoint.
Example: Claude Desktop / Claude Code
Add the remote server and complete the OAuth prompt in the browser when asked:
claude mcp add --transport http lightningpdf https://lightningpdf.dev/mcp
Example: raw JSON-RPC
List the tools with a bearer token:
curl -s https://lightningpdf.dev/mcp \
-H "Authorization: Bearer lpdf_live_your_key_here" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'
Credits are consumed per PDF action exactly as documented in Authentication.