MCP Server
Model Context Protocol server for AI assistants.
Generate invoices with natural language using Claude, GPT, or other AI tools.
Installation
bash
npm install -g @thelawin/mcp-serverOr use npx:
bash
npx @thelawin/mcp-serverConfiguration
Claude Desktop
Add to your claude_desktop_config.json:
json
{
"mcpServers": {
"thelawin": {
"command": "npx",
"args": ["@thelawin/mcp-server"],
"env": {
"THELAWIN_API_KEY": "env_sandbox_xxx"
}
}
}
}Environment Variables
| Variable | Required | Description |
|---|---|---|
THELAWIN_API_KEY | Yes | Your thelawin.dev API key |
THELAWIN_API_URL | No | Custom API URL |
Available Tools
generate_invoice
Generate a ZUGFeRD-compliant invoice.
Parameters:
| Name | Type | Description |
|---|---|---|
number | string | Invoice number |
date | string | Invoice date (YYYY-MM-DD) |
seller_name | string | Seller company name |
seller_vat_id | string | Seller VAT ID |
seller_city | string | Seller city |
seller_country | string | Seller country code |
buyer_name | string | Buyer company name |
buyer_city | string | Buyer city |
buyer_country | string | Buyer country code |
items | array | Line items |
template | string | Template: minimal, classic, compact |
Returns: PDF file path and validation status
validate_invoice
Validate an existing PDF for ZUGFeRD/Factur-X compliance.
Parameters:
| Name | Type | Description |
|---|---|---|
pdf_path | string | Path to PDF file |
Returns: Validation result with errors/warnings
Example Usage
With Claude
Human: Generate an invoice for Acme GmbH (DE123456789) in Berlin
to Customer AG in Munich. 8 hours of consulting at €150/hour.
Claude: I'll generate that invoice for you using thelawin.dev.
[Uses generate_invoice tool with the provided details]
I've generated the invoice. Here are the details:
- Invoice Number: 2026-001
- Total: €1,428.00 (including 19% VAT)
- Validation: ✓ EN16931 compliant
- Saved to: ./invoice-2026-001.pdfNatural Language Examples
- "Create an invoice for my consulting work this month"
- "Generate a ZUGFeRD invoice for customer XYZ"
- "Make an invoice with 3 line items for the software project"
- "Validate this PDF to check if it's ZUGFeRD compliant"
Features
- Natural language interface - No need to remember API syntax
- Automatic validation - All invoices are EN16931 compliant
- File handling - PDFs saved automatically
- Error feedback - Clear error messages if something's wrong
Troubleshooting
"API key not found"
Ensure THELAWIN_API_KEY is set in your environment or MCP configuration.
"Connection refused"
Check that the MCP server is running and your Claude Desktop config is correct.
"Validation failed"
The AI will show you which fields are missing. Provide the required information.