einvoice-mcp
E-Invoice MCP 服务器
用于 DACH 地区(德国、奥地利、瑞士)电子发票的 MCP 服务器 — 创建、验证 XRechnung 并提取数据。可直接从 Claude、Cursor 或任何 MCP 客户端使用。
这是什么?
E-Invoice MCP 是一个 Model Context Protocol 服务器,用于根据德国 XRechnung 标准创建和验证电子发票。从 2027 年起,德国所有企业都必须具备发送电子发票的能力 — 使用此工具,你已做好准备。
你只需告诉 Claude:“为 Beispiel GmbH 创建一张 10 小时咨询服务的发票” — 即可获得一份有效的 UBL 2.1 XML 格式的 XRechnung。
Related MCP server: mcp-facturacion-electronica-es
功能特性
创建 XRechnung — 从结构化数据生成有效的 UBL 2.1 XML(符合 EN 16931 + XRechnung 3.0.2 标准)
验证电子发票 — 检查语法、必填字段和德国业务规则 (BR-DE)
提取数据 — 从 UBL 或 CII XML 中读取结构化数据
格式信息 — 提供必填字段、税收类别、单位代码和截止日期的查询手册
自动计算 — 自动计算净额、总额和税额
插件化 — 可独立运行,也可集成到 BuchPilot MCP 服务器中
无需外部服务 — 全部本地运行,无需 API 密钥
无原生依赖 — 可在任何安装了 Node.js 的系统上运行
法定截止日期
日期 | 事件 |
2025年1月1日 | 所有企业必须具备接收电子发票的能力 |
2026年12月31日 | PDF 发票仅在获得接收方同意的情况下允许使用 |
2027年1月1日 | 年营业额超过 80 万欧元的企业必须发送电子发票 |
2028年1月1日 | 所有企业必须发送电子发票 |
错误的电子发票可能导致进项税抵扣损失(外加 6% 的利息)。
安装
前提条件
Node.js >= 18
npm (全局)
npm install -g einvoice-mcp从源码安装
git clone https://github.com/makririch/einvoice-mcp.git
cd einvoice-mcp
npm install
npm run build配置
此 MCP 服务器无需配置。不需要 API 密钥或外部服务 — 全部本地运行。
使用方法
启动服务器 (独立模式)
# Nach npm install -g:
einvoice-mcp
# Oder von Source:
npm start
# Entwicklung mit Auto-Reload:
npm run dev服务器通过 stdio 运行并等待 MCP 消息。
在 Claude Desktop 中使用
详细指南请参阅 Claude Desktop Setup Guide。
简要说明 — 在 claude_desktop_config.json 中添加:
{
"mcpServers": {
"einvoice": {
"command": "npx",
"args": ["-y", "einvoice-mcp"]
}
}
}示例(在 Claude 中使用自然语言)
配置服务器后,你可以询问 Claude,例如:
“为 Beispiel GmbH 创建一张 10 小时咨询服务的 XRechnung,单价 150 欧元”
“这个 XML 文件是有效的 XRechnung 吗?”
“从这个 XML 中提取发票数据”
“XRechnung 需要哪些必填字段?”
“有哪些税收类别,它们分别代表什么?”
“我的企业必须在什么时候具备发送电子发票的能力?”
快速入门
“5 分钟创建你的第一张 XRechnung”的分步指南可在 docs/quickstart.md 中找到。
工具参考
所有 4 个工具的完整参考(包括参数、输入示例和输出示例)可在 docs/tool-reference.md 中找到。
概览
工具 | 描述 |
| 从结构化数据创建 XRechnung (UBL 2.1 XML) |
| 验证电子发票 XML(语法 + BR-DE 业务规则) |
| 从 UBL 或 CII XML 中提取结构化数据 |
| 格式、必填字段、代码和截止日期的查询手册 |
BuchPilot 集成
E-Invoice MCP 可以作为插件集成到 BuchPilot MCP 服务器 中:
import { registerEInvoiceTools } from "einvoice-mcp";
registerEInvoiceTools(server);组合使用: BuchPilot 在 Lexoffice 中创建发票 -> 提取数据 -> 生成 XRechnung -> 完成电子发票。
支持的标准
标准 | 版本 | 状态 |
XRechnung | 3.0.2 | 创建 + 验证 |
EN 16931 | — | XRechnung 的基础 |
UBL 2.1 | — | XRechnung 的 XML 语法 |
CII (Cross Industry Invoice) | — | 提取(读取) |
ZUGFeRD / Factur-X | 2.3 | 提取(读取),计划支持创建 |
常见问题 / 故障排除
“无法解析 XML”
XML 是否格式良好?(所有标签是否正确闭合?)
它确实是 UBL 或 CII 发票吗?(根元素必须是
<Invoice>或<CrossIndustryInvoice>)编码是否为 UTF-8?
验证显示错误 “BR-DE-13: Buyer Reference 是必填项”
买方参考号 (BT-10) 在 XRechnung 中是必填项。对于向公共部门客户开具的发票,这是 Leitweg-ID。对于 B2B 发票,它可以是任何参考号(例如订单号)。
{
"buyerReference": "04011000-12345-67"
}验证显示警告 “BR-DE-21: 建议提供电话号码”
这只是一个警告,不是错误。发票仍然有效。为了获得最佳兼容性,你应该提供卖方的电话号码。
有哪些税收类别?
代码 | 名称 | 描述 | 税率 |
S | 标准 | 标准税率 | 19%, 7% |
Z | 零税率 | 0%(例如免增值税的欧盟内交易) | 0% |
E | 免税 | 例如根据德国增值税法第 19 条的小型企业 | 0% |
AE | 反向征税 | 接收方纳税义务(德国增值税法第 13b 条) | 0% |
K | 欧盟内交易 | 免税的欧盟内交付 | 0% |
有哪些单位代码?
代码 | 名称 | 描述 |
H87 | 件 | 单个单位(默认) |
HUR | 小时 | 工作小时 |
DAY | 天 | 工作日 |
MON | 月 | 日历月 |
KGM | 公斤 | 重量 |
MTR | 米 | 长度 |
LTR | 升 | 体积 |
MTK | 平方米 | 面积 |
SET | 套/包 | 组合 |
C62 | 单位(通用) | 通用计量单位 |
服务器已启动,但 Claude 无法识别工具
检查
claude_desktop_config.json是否正确修改配置后重启 Claude Desktop
检查日志:
~/Library/Logs/Claude/mcp.log(macOS)
许可证
MIT — 可自由使用,包括商业用途。
作者
MaKri — GitHub
Available Tools
6 toolsconvert_formatA
Konvertiert E-Rechnungen zwischen UBL (XRechnung), CII (ZUGFeRD) und JSON. Converts e-invoices between formats: ubl_to_cii, cii_to_ubl, ubl_to_json, cii_to_json, json_to_ubl, json_to_cii.
Inputs: direction (required), input (required), validate_output.
create_xrechnungC
Erstellt eine XRechnung (UBL 2.1 XML) aus strukturierten Daten. Konform zu EN 16931 + XRechnung 3.0.2. Creates a valid XRechnung XML from structured data.
Inputs: invoiceNumber (required), issueDate (required), seller (required), buyer (required), +11 more.
create_zugferdB
Erstellt ZUGFeRD 2.3 CII XML (Factur-X). Returns CII XML for embedding into PDF/A-3. Creates ZUGFeRD-compatible e-invoice XML in CII format.
Inputs: invoiceNumber (required), issueDate (required), seller (required), buyer (required), +9 more.
extract_dataC
Extrahiert strukturierte Daten aus einer E-Rechnung (UBL-XML oder CII-XML). Extracts structured data from an e-invoice XML.
Inputs: xml, base64.
get_format_infoB
Gibt Informationen ueber E-Rechnungs-Formate, Pflichtfelder, Steuer-Kategorien, Einheiten-Codes und gesetzliche Fristen zurueck. Useful reference for creating valid invoices.
Inputs: format, topic.
validate_invoiceC
Prueft ob XML eine gueltige E-Rechnung (XRechnung/ZUGFeRD) ist. Validiert Syntax, Pflichtfelder und deutsche Business-Regeln (BR-DE). Validates e-invoice XML.
Inputs: xml, base64, level.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a clearly distinct purpose with no overlap: convert_format handles format conversion, create_xrechnung and create_zugferd create specific invoice types, extract_data extracts data from invoices, get_format_info provides reference information, and validate_invoice validates invoices. The descriptions reinforce these distinct roles, making tool selection unambiguous.
All tool names follow a consistent verb_noun pattern using snake_case: convert_format, create_xrechnung, create_zugferd, extract_data, get_format_info, and validate_invoice. This uniformity makes the tool set predictable and easy to navigate for an agent.
With 6 tools, the server is well-scoped for e-invoice processing, covering creation, conversion, validation, data extraction, and reference information. Each tool earns its place without bloat, fitting typical expectations for a domain-specific server.
The tool set provides strong coverage for e-invoice workflows, including creation (XRechnung and ZUGFeRD), conversion between formats, validation, data extraction, and reference info. A minor gap is the lack of update or delete operations for invoices, but this is reasonable as invoices are typically immutable once created, and agents can work around this by recreating or modifying data externally.
Maintenance
Related MCP Connectors
Create ZUGFeRD e-invoices from JSON or PDF, verify Factur-X, check VAT IDs and Peppol.
Create, validate, convert & extract compliant e-invoices (UBL, Factur-X, ZUGFeRD, XRechnung)
Validate, parse, fix and render e-invoices: XRechnung, ZUGFeRD, Peppol, KSeF, Facturae, MyInvois
E-invoice checker for ZUGFeRD, Factur-X, XRechnung and Peppol BIS. Web tool, API and MCP.
Related MCP Servers
- AlicenseAqualityBmaintenanceModel Context Protocol (MCP) server for German Electronic Invoicing (ZUGFeRD 2.x / XRechnung 3.x). Provides tools to validate, generate, parse, and convert invoices compliant with EN 16931 and KoSIT.50146 PyPI2Apache 2.0
- AlicenseBqualityBmaintenanceModel Context Protocol (MCP) server for Spanish Electronic Invoicing. Provides tools to generate, validate, and submit invoices across VERI\*FACTU, Facturae/FACe, SII, TicketBAI, and Crea y Crece B2B.20161 PyPI3Apache 2.0
- AlicenseAqualityDmaintenanceMCP server for German e-invoice compliance (XRechnung 3.0 & ZUGFeRD 2.x) enabling AI agents to validate, generate, parse, and check compliance of electronic invoices per EN 16931.61MIT
- FlicenseNot gradedqualityCmaintenanceMCP server for German e-invoicing with tools to generate and validate XRechnung CII XML locally, supporting German VAT rates and § 19 UStG.-