MCP Server
The InvoicePig MCP server exposes a single tool: generate invoice PDFs from JSON using your API key—no draft or history access via MCP.
Quick start
Pick your MCP client, paste the JSON, restart the client if needed, then try the prompts. For environment variables and HTTP details, see Setup & configuration.
What is MCP?
Model Context Protocol is an open standard so AI apps can call tools and use resources in a structured, secure way. InvoicePig's MCP server gives your assistant:
- ·Stateless PDF — send invoice JSON (same fields as the web editor) and get a base64 PDF; nothing is stored via MCP.
- ·Account-scoped access — every request uses your API key and resolves subscription tier for layout rules.
- ·Same rules as the web app — premium-only layouts return
403for free accounts; PDF watermark/footer behavior matches the in-app PDF export.
How it works
Three steps from key to automated invoicing.
Core concepts for integrators
How InvoicePig data maps to tools and HTTP—read this before wiring an agent.
Setup & configuration
Build the server with bun install and bun run build in invoicepig-mcp-server. The app build runs this automatically; for MCP-only work you can still build there. Then merge the JSON into your client config.
Same JSON snippets as the Quick start tabs—expanded notes and links for each transport.
Recommended for production and cloud agents: no local build, no Node path—your client speaks Streamable HTTP to InvoicePig. Paste the JSON into ~/.cursor/mcp.json (merge into mcpServers if you already have servers). Replace <API_KEY> with your full key from Settings (starts with pig_live_). No local dist/index.js. Streamable HTTP at /api/invoicepig-mcp. For a preview deployment, replace the host with your preview URL. If your client only supports stdio, use npx -y mcp-remote <url> (see mcp-handler client docs).
{
"mcpServers": {
"invoicepig": {
"url": "https://invoicepig.com/api/invoicepig-mcp",
"headers": {
"Authorization": "Bearer <API_KEY>"
}
}
}
}Common workflows
Tool sequences third-party agents typically implement for user intents.
Example prompts
Once the server is connected, natural language maps to invoicepig_generate_pdf and POST /api/mcp/invoices/generate-pdf.
Tool reference
One tool. Read / Write badges indicate typical side effects; PDF generation is read-only with respect to your stored data.
Invoice PDF
Stateless generation: POST JSON that matches the web editor field set; receive base64 PDF. Nothing is stored in the cloud via MCP.
Troubleshooting
Symptom-first fixes for the most common MCP and API issues.
FAQ
Common questions about keys, hosting, and behavior.
Learn more
Protocol docs, client guides, and the InvoicePig source.