Skip to content

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-server

Or use npx:

bash
npx @thelawin/mcp-server

Configuration

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

VariableRequiredDescription
THELAWIN_API_KEYYesYour thelawin.dev API key
THELAWIN_API_URLNoCustom API URL

Available Tools

generate_invoice

Generate a ZUGFeRD-compliant invoice.

Parameters:

NameTypeDescription
numberstringInvoice number
datestringInvoice date (YYYY-MM-DD)
seller_namestringSeller company name
seller_vat_idstringSeller VAT ID
seller_citystringSeller city
seller_countrystringSeller country code
buyer_namestringBuyer company name
buyer_citystringBuyer city
buyer_countrystringBuyer country code
itemsarrayLine items
templatestringTemplate: minimal, classic, compact

Returns: PDF file path and validation status

validate_invoice

Validate an existing PDF for ZUGFeRD/Factur-X compliance.

Parameters:

NameTypeDescription
pdf_pathstringPath 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.pdf

Natural 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.

Source Code

github.com/steviee/thelawin.dev/tree/main/mcp-server

ZUGFeRD 2.3 & Factur-X 1.0 compliant