# CastPDF [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/castpdf/castpdf-mcp  
**GitHub Stars:** 0  
**Views:** 0  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/castpdf

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

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "castpdf": {
    "command": "npx",
    "args": ["-y","@castpdf/mcp"],
    "env": {
      "CASTPDF_API_KEY": "",
      "CASTPDF_BASE_URL": "",
      "CASTPDF_MCP_AUTH_TOKEN": "",
      "CASTPDF_MCP_ALLOWED_HOSTS": "",
      "CASTPDF_MCP_ALLOWED_ORIGINS": "",
      "MCP_TRANSPORT": "",
      "PORT": "",
      "HOST": ""
    }
  }
}
```

**Requires environment variables:** `CASTPDF_API_KEY`, `CASTPDF_BASE_URL`, `CASTPDF_MCP_AUTH_TOKEN`, `CASTPDF_MCP_ALLOWED_HOSTS`, `CASTPDF_MCP_ALLOWED_ORIGINS`, `MCP_TRANSPORT`, `PORT`, `HOST` — the values above are empty placeholders; fill in real credentials before running (see the repository for what each one is for).

## Documentation

## What CastPDF MCP server does

The CastPDF MCP server gives MCP-compatible agents access to selected CastPDF document operations. It can inspect saved PDF templates, determine the fields and line items expected by a template, render a PDF from template data or raw HTML, issue structured EU e-invoices, and retrieve recent or individual documents.

PDF creation supports either a saved CastPDF template with supplied data or directly provided HTML. E-invoice creation produces either a ZUGFeRD / Factur-X PDF or an XRechnung XML file from structured invoice information. The document lookup operations expose status, errors where available, and download URLs.

The server is designed for workflows where an agent prepares or checks business documents through conversation. Typical requests include finding an invoice template, producing a test invoice, creating an electronic invoice for European compliance formats, or investigating whether a recent document failed.

## How it works

The CastPDF MCP server authenticates with a CastPDF API key supplied through the environment. MCP clients invoke tools, and the server sends those requests to CastPDF. For generated files, the response contains a signed download URL rather than transferring the file through the chat. Links include an expiration value and should be used before they expire.

The available operations are exposed as six tools:

- `list_templates` returns saved template IDs, names, and versions.
- `get_template_fields` reads the sample data for a template and reports its fields and line items.
- `create_pdf` renders a template or HTML into a PDF.
- `create_e_invoice` creates a ZUGFeRD / Factur-X PDF or XRechnung XML document.
- `list_documents` returns recent documents, newest first, with status and download links.
- `get_document` retrieves one document by ID, including its status, error code, and a fresh download URL.

PDF and e-invoice creation use test mode by default. Test output is watermarked and does not count against the plan. An API key beginning with `cpdf_test_` cannot create live documents.

## Setup and configuration

Run the package with Node.js 20 or newer and provide `CASTPDF_API_KEY`, obtained from the CastPDF dashboard. A standard stdio setup uses `npx -y @castpdf/mcp`; Claude Desktop, Claude Code, Cursor, and other clients that launch stdio servers can use this command. The package can also be imported as a library and connected to an MCP transport in Node.js code.

For shared or HTTP-based deployments, start the package with `--http`, then use the `/mcp` endpoint. The default port is 3000 and the default interface is `127.0.0.1`; `/health` provides a health check. HTTP mode is stateless, uses POST requests, and can run behind a load balancer.

`CASTPDF_BASE_URL` changes the CastPDF API base URL. `PORT`, `HOST`, and `MCP_TRANSPORT` provide environment-based HTTP configuration. For non-local HTTP exposure, configure `CASTPDF_MCP_AUTH_TOKEN` for bearer authentication and use `CASTPDF_MCP_ALLOWED_HOSTS` and, where needed, `CASTPDF_MCP_ALLOWED_ORIGINS` to restrict accepted requests. A TLS-terminating proxy is required in front of a publicly exposed instance.

## Limitations and notes

The CastPDF MCP server does not send the generated file directly in the conversation; agents receive signed URLs instead. Those URLs expire, so clients should use the supplied expiration information.

Live document creation is not the default behavior. Start with a test API key and test requests, then explicitly request live output only when appropriate. HTTP requests use the API key configured for the running server, so a shared HTTP instance gives every request access to that server's CastPDF account.

The server's documented release history lists version 0.1.0 as the first release. It is distributed under the MIT license.

_Full upstream README: https://allmcps.com/mcp/castpdf/readme_

