MCP Invoice Generator
Enables generation of PDF invoices via an MCP server, using Typst for typesetting and a local TOML file for billing data.
README
<div align="center">
🧾 MCP Invoice Generator
Generate PDF invoices via a Model Context Protocol (MCP) server.
</div>
This server is primarily designed for local use via stdio. It generates PDF invoices directly on your machine using Typst — a modern, fast typesetting system that replaces traditional HTML/CSS-to-PDF pipelines. Templates are clean, readable .typ files compiled to pixel-perfect PDFs in milliseconds. Billing data (issuers, clients, services) is loaded from a local TOML file, making it easy to manage without any external service or database.
Features
- PDF invoice generation — Typst template compiled to PDF
- MCP server —
generate_invoiceandget_default_valuestools accessible by an LLM - TOML configuration — issuers, clients and services defined in
data/billing.toml - FastMCP — modern MCP server framework
- Typst — typesetting system for PDF rendering
- pydantic-settings — application settings management
- dynaconf — TOML billing data loading
- uv — dependency management
- ruff — linter & formatter
- Dockerfile — multi-stage build ready for production
Requirements
Getting Started
1. Clone the repository
git clone https://github.com/pirocheto/mcp-invoice-generator
cd mcp-invoice-generator
2. Billing data
Copy and fill in the data file:
cp data/billing.toml.example data/billing.toml
This file is the core data source for invoice generation. It defines the people, companies, and services that can appear on your invoices. The get_default_values tool reads directly from this file, and generate_invoice uses the provided data to populate the PDF.
You can define multiple entries in each section — simply repeat the [[issuers]], [[services]], or [[clients]] block.
[[issuers]]
name = "Jane Doe"
address = "12 rue de la Paix"
city = "Lyon"
postal = "69001"
email = "jane.doe@example.com"
siren = "123 456 789"
siret = "123 456 789 00012"
vat_number = "FR 12 123 456 789"
iban = "FR76 ..."
bic = "BNPAFRPPXXX"
tax_rate = 0.2
[[services]]
name = "consulting"
daily_rate = 600
description = "Professional services — consulting"
[[clients]]
name = "Acme Corp"
address = "42 avenue des Champs-Élysées"
city = "Paris"
postal = "75008"
siren = "987 654 321"
vat_number = "FR 98 987 654 321"
3. Environment variables
The application is configured via environment variables (prefixed with APP_) or a .env file at the project root.
| Variable | Default | Description |
|---|---|---|
APP_SERVICE_NAME |
Invoice Generator Service |
Name of the MCP server |
APP_ENV |
development |
Environment (development or production) |
APP_OUTPUT_DIR |
outputs |
Directory where generated PDFs are saved |
APP_TEMPLATE_DIR |
templates |
Directory containing Typst invoice templates |
APP_DATA_FILE |
data/billing.toml |
Path to the billing data TOML file |
Relative paths are resolved from the project root. Absolute paths are used as-is.
Installation
Local (stdio)
Clone the repository and point your MCP client (e.g. Claude Desktop, Github Copilot, OpenCode, etc) to it:
{
"mcpServers": {
"invoice-generator": {
"type": "stdio",
"env": {
"APP_DATA_FILE": "./data/billing.toml",
"APP_OUTPUT_DIR": "./outputs",
"APP_TEMPLATE_DIR": "./templates"
},
"command": "uv",
"args": [
"run",
"--directory",
"/path/to/mcp-invoice-generator",
"--",
"fastmcp",
"run"
]
}
}
}
Replace
/path/to/mcp-invoice-generatorwith the absolute path where you cloned the repository.
Docker
The project includes a multi-stage Dockerfile optimised for production:
- Builder stage — installs dependencies with
uvusing layer caching - Runtime stage — minimal
python:3.13-slimimage with only the virtual environment copied over - Typst binary copied from the official
ghcr.io/typst/typstimage - Runs as a non-root user (
nonroot, uid 999) - Exposes the MCP server via
uvicornon port8000
# Build the image
make build
# Run the container (mounts data/, outputs/ and templates/, exposes port 8000)
make start
data/billing.tomlmust exist before running the container — it is mounted at runtime and is never baked into the image.
MCP Tools
get_default_values — Returns all default billing data from billing.toml, including available issuers, services, and clients.
generate_invoice — Generates a PDF invoice from flat input fields.
| Parameter | Type | Default | Description |
|---|---|---|---|
invoice_number |
str |
— | Invoice number |
invoice_date |
date |
today | Invoice date (ISO 8601) |
issuer_name |
str |
— | Issuer full name |
issuer_address |
str |
— | Issuer street address |
issuer_city |
str |
— | Issuer city |
issuer_postal |
str |
— | Issuer postal code |
issuer_email |
str |
— | Issuer email address |
issuer_siren |
str |
— | Issuer SIREN number |
issuer_siret |
str |
— | Issuer SIRET number |
issuer_vat_number |
str |
— | Issuer VAT number |
issuer_iban |
str |
— | Issuer IBAN |
issuer_bic |
str |
— | Issuer BIC / SWIFT code |
issuer_tax_rate |
float |
— | VAT rate (e.g. 0.2 for 20%) |
service_daily_rate |
int |
— | Daily rate in euros (TJM) |
service_description |
str |
— | Service description line on invoice |
service_days |
int |
— | Number of days worked |
client_name |
str |
— | Client company name |
client_address |
str |
— | Client street address |
client_city |
str |
— | Client city |
client_postal |
str |
— | Client postal code |
client_siren |
str |
— | Client SIREN number |
client_vat_number |
str |
— | Client VAT number |
Returns the path to the generated PDF file.
Template
The invoice template is located in templates/invoice.typ and is written in Typst, a modern typesetting language. It receives all invoice fields as named parameters and is compiled to PDF by the typst Python package.
The included template is designed for French freelancers: it is based on a daily rate (TJM), computes subtotal, VAT, and total, and formats all monetary values using French conventions (e.g. 3 000,00 €).
To customise the invoice layout, edit templates/invoice.typ directly.
Template parameters
All parameters are passed as flat named arguments to the Typst template function.
Issuer
| Parameter | Type | Description |
|---|---|---|
issuer_name |
str |
Full name |
issuer_address |
str |
Street address |
issuer_city |
str |
City |
issuer_postal |
str |
Postal code |
issuer_email |
str |
Email address |
issuer_siren |
str |
SIREN number |
issuer_siret |
str |
SIRET number |
issuer_vat_number |
str |
VAT number |
issuer_iban |
str |
IBAN |
issuer_bic |
str |
BIC / SWIFT code |
issuer_tax_rate |
float |
VAT rate (e.g. 0.2 for 20%) |
Client
| Parameter | Type | Description |
|---|---|---|
client_name |
str |
Company name |
client_address |
str |
Street address |
client_city |
str |
City |
client_postal |
str |
Postal code |
client_siren |
str |
SIREN number |
client_vat_number |
str |
VAT number |
Service
| Parameter | Type | Description |
|---|---|---|
service_daily_rate |
int |
Daily rate in euros (TJM) |
service_description |
str |
Description line on invoice |
service_days |
int |
Number of days worked |
Invoice
| Parameter | Type | Description |
|---|---|---|
invoice_number |
str |
Invoice number |
invoice_date |
str |
Invoice date (DD/MM/YYYY) |
Development
make dev
Starts the server with --reload via dev.fastmcp.json.
Make Commands
| Command | Description |
|---|---|
make dev |
Start server in development mode with auto-reload |
make test |
Run tests with coverage report |
make build |
Build the Docker image |
make start |
Run the container in production |
make run-inspector |
Launch the MCP inspector |
License
MIT — see LICENSE.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。