Back to Browse

Castpdf MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Create PDFs from your CastPDF templates or HTML, issue EU e-invoices, and look up documents.

About

Create PDFs from your CastPDF templates or HTML, issue EU e-invoices, and look up documents.

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (7 strong, 4 medium validity signals). No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry.

12 files analyzed · 1 issue found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

HTTP Network Access

Connects to external APIs or services over the internet.

file_system

Check that this permission is expected for this type of plugin.

env_vars

Check that this permission is expected for this type of plugin.

What You'll Need

Set these up before or after installing:

Your CastPDF API key (cpdf_test_... for watermarked test documents, cpdf_live_... for live ones).Required

Environment variable: CASTPDF_API_KEY

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-castpdf-castpdf-mcp": {
      "env": {
        "CASTPDF_API_KEY": "your-castpdf-api-key-here"
      },
      "args": [
        "-y",
        "@castpdf/mcp"
      ],
      "command": "npx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

CastPDF MCP server

The official Model Context Protocol server for CastPDF. It lets AI agents (Claude, Cursor and other MCP clients) list your PDF templates, create PDFs and EU e-invoices, and look up documents, using your CastPDF API key.

Documents are test documents by default (watermarked, not counted against your plan). The agent only makes a live document when you explicitly ask for one, and a cpdf_test_... key can never make live documents at all. Start with a test key.

Tools

ToolWhat it does
list_templatesLists your saved templates (id, name, version).
get_template_fieldsThe data a template expects, read from its sample data (fields and line items).
create_pdfRenders a template with data, or raw html, and returns a signed download URL. test defaults to true.
create_e_invoiceIssues a ZUGFeRD / Factur-X PDF or an XRechnung XML from a structured invoice and returns a download URL. test defaults to true.
list_documentsRecent documents, newest first, with status and download URLs.
get_documentOne document by id: status, error code, fresh download URL.

Download links are signed and expire (see expires_at); the agent shares the link, the file itself is not sent through the conversation.

Setup

You need Node.js 20 or newer and a CastPDF API key (dashboard > API keys). The server reads the key from the CASTPDF_API_KEY environment variable.

Claude Desktop

Settings > Developer > Edit Config, then add to claude_desktop_config.json:

{
  "mcpServers": {
    "castpdf": {
      "command": "npx",
      "args": ["-y", "@castpdf/mcp"],
      "env": { "CASTPDF_API_KEY": "cpdf_test_..." }
    }
  }
}

Restart Claude Desktop. On Windows, if npx is not found, use "command": "cmd" and "args": ["/c", "npx", "-y", "@castpdf/mcp"].

Claude Code

claude mcp add castpdf --env CASTPDF_API_KEY=cpdf_test_... -- npx -y @castpdf/mcp

Add --scope user to use it in every project. Check it with claude mcp list or /mcp inside Claude Code.

Cursor

Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

{
  "mcpServers": {
    "castpdf": {
      "command": "npx",
      "args": ["-y", "@castpdf/mcp"],
      "env": { "CASTPDF_API_KEY": "cpdf_test_..." }
    }
  }
}

Do not commit a file that contains your key.

Other clients

Any MCP client that starts stdio servers works with the command npx -y @castpdf/mcp and the environment variable CASTPDF_API_KEY.

Streamable HTTP

For clients that connect over HTTP, or to run one shared server:

CASTPDF_API_KEY=cpdf_test_... npx -y @castpdf/mcp --http --port 3000
# MCP endpoint: http://127.0.0.1:3000/mcp   health check: http://127.0.0.1:3000/health

Every request to that endpoint uses the server's API key, so:

  • By default it listens on 127.0.0.1 only and accepts only localhost, 127.0.0.1 and [::1] as Host header (DNS rebinding protection) and no browser Origin.
  • Set CASTPDF_MCP_AUTH_TOKEN to require Authorization: Bearer <token> on every request. It is required to listen on any other interface (--host 0.0.0.0). Put a TLS-terminating proxy in front of it, and list the public host name in CASTPDF_MCP_ALLOWED_HOSTS.
  • The server is stateless (no sessions, POST only), so it can run behind a load balancer.

Example client config for HTTP (Claude Code):

claude mcp add --transport http castpdf http://127.0.0.1:3000/mcp

Configuration

Variable / flagDefaultMeaning
CASTPDF_API_KEY(required)Your CastPDF API key.
CASTPDF_BASE_URLhttps://api.castpdf.comAPI base URL.
--http or MCP_TRANSPORT=httpstdioServe Streamable HTTP instead of stdio.
--port or PORT3000HTTP port.
--host or HOST127.0.0.1HTTP interface.
CASTPDF_MCP_AUTH_TOKENnoneBearer token required on HTTP requests.
CASTPDF_MCP_ALLOWED_HOSTSlocalhost namesComma-separated Host header values to accept.
CASTPDF_MCP_ALLOWED_ORIGINSnoneComma-separated browser origins to accept.

Example prompts

  • "Which CastPDF templates do I have?"
  • "Make a test PDF of the Invoice template for Ada Lovelace, 3 hours of consulting at 120 EUR."
  • "Create a ZUGFeRD invoice from Muster GmbH (DE123456789, Berlin) to Kunde AG, Hamburg: 8 hours consulting at 95 EUR, 19 % VAT, payable within 14 days to IBAN DE02 1203 0000 0000 2020 51."
  • "Did my last document fail? Why?"

Use as a library

import { createServer } from '@castpdf/mcp';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = createServer({ apiKey: process.env.CASTPDF_API_KEY! });
await server.connect(new StdioServerTransport());

Version history

  • 0.1.0: first release.

License

MIT

Reviews

No reviews yet

Be the first to review this server!