rechnungsapi-mcp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +69 -0
- package/dist/index.js +182 -0
- package/dist/index.js.map +1 -0
- package/package.json +41 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Finbc GmbH
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# rechnungsapi-mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for [RechnungsAPI](https://rechnungsapi.de) — lets Claude and other MCP-compatible AI agents create, validate, and analyze ZUGFeRD and X-Invoice e-invoices directly from a conversation.
|
|
4
|
+
|
|
5
|
+
Built on [`rechnungsapi-sdk`](https://github.com/Rechnungsapi/rechnungsapi-sdk).
|
|
6
|
+
|
|
7
|
+
## Setup
|
|
8
|
+
|
|
9
|
+
Get your API token from the [RechnungsAPI dashboard](https://rechnungsapi.de), then add the server to your MCP client's config.
|
|
10
|
+
|
|
11
|
+
**Claude Code** (`.mcp.json` in your project, or via `claude mcp add`):
|
|
12
|
+
|
|
13
|
+
```json
|
|
14
|
+
{
|
|
15
|
+
"mcpServers": {
|
|
16
|
+
"rechnungsapi": {
|
|
17
|
+
"command": "npx",
|
|
18
|
+
"args": ["-y", "rechnungsapi-mcp"],
|
|
19
|
+
"env": {
|
|
20
|
+
"RECHNUNGSAPI_TOKEN": "your-api-token"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
**Claude Desktop** (`claude_desktop_config.json`): same `mcpServers` entry as above.
|
|
28
|
+
|
|
29
|
+
### Environment variables
|
|
30
|
+
|
|
31
|
+
| Variable | Required | Description |
|
|
32
|
+
|---|---|---|
|
|
33
|
+
| `RECHNUNGSAPI_TOKEN` | Yes | Your RechnungsAPI Bearer token |
|
|
34
|
+
| `RECHNUNGSAPI_BASE_URL` | No | Override the gateway base URL (e.g. for a sandbox environment) |
|
|
35
|
+
| `RECHNUNGSAPI_V2_BASE_URL` | No | Override the v2 analyzer host |
|
|
36
|
+
|
|
37
|
+
## Tools
|
|
38
|
+
|
|
39
|
+
| Tool | Description |
|
|
40
|
+
|---|---|
|
|
41
|
+
| `create_zugferd_invoice` | Create a ZUGFeRD PDF/A-3 from structured invoice JSON + a visual PDF |
|
|
42
|
+
| `create_xinvoice` | Create an X-Invoice (XRechnung/UBL) XML from structured invoice JSON |
|
|
43
|
+
| `create_zugferd_pdf` | Embed an existing X-Invoice XML into a visual PDF |
|
|
44
|
+
| `extract_xinvoice_from_zugferd` | Extract the embedded XRechnung XML from a ZUGFeRD PDF as JSON |
|
|
45
|
+
| `validate_xinvoice_xml` | Validate an X-Invoice XML against schema and business rules |
|
|
46
|
+
| `validate_zugferd_pdf` | Validate a ZUGFeRD PDF's embedded XML |
|
|
47
|
+
| `analyze_pdf_invoice` | Extract structured invoice JSON from a scanned/PDF invoice |
|
|
48
|
+
| `analyze_pdf_invoice_async_submit` / `analyze_pdf_invoice_async_status` | Async analysis for large files |
|
|
49
|
+
| `create_zugferd_from_pdf` | Convert a PDF/scan directly into a validated ZUGFeRD PDF |
|
|
50
|
+
|
|
51
|
+
## Development
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
yarn install
|
|
55
|
+
yarn typecheck
|
|
56
|
+
yarn build
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Test locally with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
RECHNUNGSAPI_TOKEN=your-token yarn inspect
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
> **Note:** `@modelcontextprotocol/sdk` is pinned to `1.22.0` (not `^1.x`). Versions ≥1.23.0 introduced a Zod v3/v4 compatibility layer that currently triggers a `TS2589: Type instantiation is excessively deep` compiler error with `registerTool` (see [modelcontextprotocol/typescript-sdk#1180](https://github.com/modelcontextprotocol/typescript-sdk/issues/1180) and [#1423](https://github.com/modelcontextprotocol/typescript-sdk/issues/1423)). Re-evaluate this pin once that's fixed upstream.
|
|
66
|
+
|
|
67
|
+
## License
|
|
68
|
+
|
|
69
|
+
MIT
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// src/index.ts
|
|
4
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
5
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
|
+
import { RechnungsApiClient as RechnungsApiClient2 } from "rechnungsapi-sdk";
|
|
7
|
+
|
|
8
|
+
// src/config.ts
|
|
9
|
+
function loadConfigFromEnv() {
|
|
10
|
+
const apiToken = process.env.RECHNUNGSAPI_TOKEN;
|
|
11
|
+
if (!apiToken) {
|
|
12
|
+
throw new Error(
|
|
13
|
+
`RECHNUNGSAPI_TOKEN environment variable is required. Get your API token from the RechnungsAPI dashboard and set it in your MCP client's server config (e.g. Claude Desktop/Code's mcp.json under "env").`
|
|
14
|
+
);
|
|
15
|
+
}
|
|
16
|
+
return {
|
|
17
|
+
apiToken,
|
|
18
|
+
baseUrl: process.env.RECHNUNGSAPI_BASE_URL,
|
|
19
|
+
v2BaseUrl: process.env.RECHNUNGSAPI_V2_BASE_URL
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// src/tools.ts
|
|
24
|
+
import { RechnungsApiError } from "rechnungsapi-sdk";
|
|
25
|
+
import { z } from "zod";
|
|
26
|
+
var invoiceJsonSchema = z.any().describe("Structured invoice data (line items, parties, totals, etc.) as defined by the RechnungsAPI invoice schema");
|
|
27
|
+
var transportSchema = z.any().optional().describe("Optional delivery/transport metadata (e.g. email delivery options)");
|
|
28
|
+
async function asToolResult(fn) {
|
|
29
|
+
try {
|
|
30
|
+
const result = await fn();
|
|
31
|
+
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
32
|
+
} catch (error) {
|
|
33
|
+
if (error instanceof RechnungsApiError) {
|
|
34
|
+
return {
|
|
35
|
+
isError: true,
|
|
36
|
+
content: [
|
|
37
|
+
{
|
|
38
|
+
type: "text",
|
|
39
|
+
text: JSON.stringify({ status: error.status, message: error.message, body: error.body }, null, 2)
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
45
|
+
return { isError: true, content: [{ type: "text", text: message }] };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function registerTools(server, client) {
|
|
49
|
+
server.registerTool(
|
|
50
|
+
"create_zugferd_invoice",
|
|
51
|
+
{
|
|
52
|
+
title: "Create ZUGFeRD invoice",
|
|
53
|
+
description: "Create a ZUGFeRD PDF/A-3 e-invoice (visual PDF with embedded XRechnung XML) from structured invoice JSON plus a visual PDF template.",
|
|
54
|
+
inputSchema: {
|
|
55
|
+
invoice: invoiceJsonSchema,
|
|
56
|
+
invoicePdf64: z.string().describe("Base64-encoded visual PDF the XML will be embedded into"),
|
|
57
|
+
transport: transportSchema
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
async ({ invoice, invoicePdf64, transport }) => asToolResult(() => client.createZugferdFromJson(invoice, invoicePdf64, { transport }))
|
|
61
|
+
);
|
|
62
|
+
server.registerTool(
|
|
63
|
+
"create_xinvoice",
|
|
64
|
+
{
|
|
65
|
+
title: "Create X-Invoice (XRechnung/UBL)",
|
|
66
|
+
description: "Create an X-Invoice (XRechnung/UBL) XML document from structured invoice JSON.",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
invoice: invoiceJsonSchema,
|
|
69
|
+
transport: transportSchema
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
async ({ invoice, transport }) => asToolResult(() => client.createXInvoiceFromJson(invoice, { transport }))
|
|
73
|
+
);
|
|
74
|
+
server.registerTool(
|
|
75
|
+
"create_zugferd_pdf",
|
|
76
|
+
{
|
|
77
|
+
title: "Embed X-Invoice XML into a PDF",
|
|
78
|
+
description: "Embed an existing X-Invoice XML document into a visual PDF to produce a ZUGFeRD PDF.",
|
|
79
|
+
inputSchema: {
|
|
80
|
+
invoicePdf64: z.string().describe("Base64-encoded visual PDF"),
|
|
81
|
+
xInvoiceXml: z.string().describe("X-Invoice XML to embed")
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
async ({ invoicePdf64, xInvoiceXml }) => asToolResult(() => client.createZugferdPdf(invoicePdf64, xInvoiceXml))
|
|
85
|
+
);
|
|
86
|
+
server.registerTool(
|
|
87
|
+
"extract_xinvoice_from_zugferd",
|
|
88
|
+
{
|
|
89
|
+
title: "Extract X-Invoice from ZUGFeRD PDF",
|
|
90
|
+
description: "Extract the embedded XRechnung XML from a ZUGFeRD PDF and return it as structured JSON.",
|
|
91
|
+
inputSchema: {
|
|
92
|
+
zugferd64: z.string().describe("Base64-encoded ZUGFeRD PDF")
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
async ({ zugferd64 }) => asToolResult(() => client.extractXInvoiceFromZugferd(zugferd64))
|
|
96
|
+
);
|
|
97
|
+
server.registerTool(
|
|
98
|
+
"validate_xinvoice_xml",
|
|
99
|
+
{
|
|
100
|
+
title: "Validate X-Invoice XML",
|
|
101
|
+
description: "Validate an X-Invoice (XRechnung/UBL) XML document against schema and business rules.",
|
|
102
|
+
inputSchema: {
|
|
103
|
+
xml: z.string().describe("The X-Invoice XML content to validate")
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
async ({ xml }) => asToolResult(() => client.validateXInvoiceXml(xml))
|
|
107
|
+
);
|
|
108
|
+
server.registerTool(
|
|
109
|
+
"validate_zugferd_pdf",
|
|
110
|
+
{
|
|
111
|
+
title: "Validate ZUGFeRD PDF",
|
|
112
|
+
description: "Validate a ZUGFeRD PDF's embedded XML content.",
|
|
113
|
+
inputSchema: {
|
|
114
|
+
zugferdFile64: z.string().describe("Base64-encoded ZUGFeRD PDF"),
|
|
115
|
+
comparePDF2XML: z.boolean().optional().describe("Also cross-check the embedded XML against the visual PDF content")
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
async ({ zugferdFile64, comparePDF2XML }) => asToolResult(() => client.validateZugferdPdf(zugferdFile64, { comparePDF2XML }))
|
|
119
|
+
);
|
|
120
|
+
server.registerTool(
|
|
121
|
+
"analyze_pdf_invoice",
|
|
122
|
+
{
|
|
123
|
+
title: "Analyze a PDF/scanned invoice",
|
|
124
|
+
description: "Extract structured invoice JSON from a scanned or digital PDF/PNG/JPEG/TIFF invoice using the high-accuracy analyzer.",
|
|
125
|
+
inputSchema: {
|
|
126
|
+
pdfBase64: z.string().describe("Base64-encoded PDF, PNG, JPEG, or TIFF invoice"),
|
|
127
|
+
withLineItems: z.boolean().optional().describe("Also extract individual line items")
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
async ({ pdfBase64, withLineItems }) => asToolResult(() => client.analyzePdfInvoiceV2(pdfBase64, withLineItems ?? false))
|
|
131
|
+
);
|
|
132
|
+
server.registerTool(
|
|
133
|
+
"analyze_pdf_invoice_async_submit",
|
|
134
|
+
{
|
|
135
|
+
title: "Submit a large PDF invoice for async analysis",
|
|
136
|
+
description: "Submit a large scanned/PDF invoice for asynchronous analysis (for files too large for the synchronous analyzer). Returns a job_id \u2014 poll it with analyze_pdf_invoice_async_status.",
|
|
137
|
+
inputSchema: {
|
|
138
|
+
pdfBase64: z.string().describe("Base64-encoded PDF, PNG, JPEG, or TIFF invoice"),
|
|
139
|
+
withLineItems: z.boolean().optional().describe("Also extract individual line items")
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
async ({ pdfBase64, withLineItems }) => asToolResult(() => client.analyzePdfInvoiceAsync(pdfBase64, withLineItems))
|
|
143
|
+
);
|
|
144
|
+
server.registerTool(
|
|
145
|
+
"analyze_pdf_invoice_async_status",
|
|
146
|
+
{
|
|
147
|
+
title: "Check async PDF analysis status",
|
|
148
|
+
description: "Poll the status of an asynchronous PDF invoice analysis job submitted via analyze_pdf_invoice_async_submit.",
|
|
149
|
+
inputSchema: {
|
|
150
|
+
jobId: z.string().describe("The job_id returned by analyze_pdf_invoice_async_submit")
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
async ({ jobId }) => asToolResult(() => client.getAnalysisStatus(jobId))
|
|
154
|
+
);
|
|
155
|
+
server.registerTool(
|
|
156
|
+
"create_zugferd_from_pdf",
|
|
157
|
+
{
|
|
158
|
+
title: "Convert a PDF/scan directly into a ZUGFeRD PDF",
|
|
159
|
+
description: "Convert a PDF or scanned image invoice directly into a validated ZUGFeRD PDF/A-3 in one call (analyzes, validates, and embeds in a single step).",
|
|
160
|
+
inputSchema: {
|
|
161
|
+
pdfBase64: z.string().describe("Base64-encoded PDF, PNG, JPEG, or TIFF invoice"),
|
|
162
|
+
fileName: z.string().optional().describe("Original filename, used to name the resulting PDF")
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
async ({ pdfBase64, fileName }) => asToolResult(() => client.createZugferdFromPdf(pdfBase64, fileName))
|
|
166
|
+
);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// src/index.ts
|
|
170
|
+
async function main() {
|
|
171
|
+
const config = loadConfigFromEnv();
|
|
172
|
+
const client = new RechnungsApiClient2(config);
|
|
173
|
+
const server = new McpServer({ name: "rechnungsapi-mcp", version: "0.1.0" });
|
|
174
|
+
registerTools(server, client);
|
|
175
|
+
const transport = new StdioServerTransport();
|
|
176
|
+
await server.connect(transport);
|
|
177
|
+
}
|
|
178
|
+
main().catch((error) => {
|
|
179
|
+
console.error("rechnungsapi-mcp failed to start:", error instanceof Error ? error.message : error);
|
|
180
|
+
process.exit(1);
|
|
181
|
+
});
|
|
182
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/tools.ts"],"sourcesContent":["import { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { StdioServerTransport } from \"@modelcontextprotocol/sdk/server/stdio.js\"\nimport { RechnungsApiClient } from \"rechnungsapi-sdk\"\nimport { loadConfigFromEnv } from \"./config.js\"\nimport { registerTools } from \"./tools.js\"\n\nasync function main() {\n const config = loadConfigFromEnv()\n const client = new RechnungsApiClient(config)\n\n const server = new McpServer({ name: \"rechnungsapi-mcp\", version: \"0.1.0\" })\n registerTools(server, client)\n\n const transport = new StdioServerTransport()\n await server.connect(transport)\n}\n\nmain().catch((error) => {\n console.error(\"rechnungsapi-mcp failed to start:\", error instanceof Error ? error.message : error)\n process.exit(1)\n})\n","export interface RechnungsApiMcpConfig {\n apiToken: string\n baseUrl?: string\n v2BaseUrl?: string\n}\n\nexport function loadConfigFromEnv(): RechnungsApiMcpConfig {\n const apiToken = process.env.RECHNUNGSAPI_TOKEN\n if (!apiToken) {\n throw new Error(\n \"RECHNUNGSAPI_TOKEN environment variable is required. Get your API token from the RechnungsAPI dashboard \" +\n \"and set it in your MCP client's server config (e.g. Claude Desktop/Code's mcp.json under \\\"env\\\").\",\n )\n }\n return {\n apiToken,\n baseUrl: process.env.RECHNUNGSAPI_BASE_URL,\n v2BaseUrl: process.env.RECHNUNGSAPI_V2_BASE_URL,\n }\n}\n","import type { McpServer } from \"@modelcontextprotocol/sdk/server/mcp.js\"\nimport { RechnungsApiClient, RechnungsApiError } from \"rechnungsapi-sdk\"\nimport { z } from \"zod\"\n\nconst invoiceJsonSchema = z\n .any()\n .describe(\"Structured invoice data (line items, parties, totals, etc.) as defined by the RechnungsAPI invoice schema\")\n\nconst transportSchema = z\n .any()\n .optional()\n .describe(\"Optional delivery/transport metadata (e.g. email delivery options)\")\n\n/** Wraps a client call so thrown RechnungsApiError/generic errors become MCP tool errors instead of crashing the server. */\nasync function asToolResult(fn: () => Promise<unknown>) {\n try {\n const result = await fn()\n return { content: [{ type: \"text\" as const, text: JSON.stringify(result, null, 2) }] }\n } catch (error) {\n if (error instanceof RechnungsApiError) {\n return {\n isError: true,\n content: [\n {\n type: \"text\" as const,\n text: JSON.stringify({ status: error.status, message: error.message, body: error.body }, null, 2),\n },\n ],\n }\n }\n const message = error instanceof Error ? error.message : String(error)\n return { isError: true, content: [{ type: \"text\" as const, text: message }] }\n }\n}\n\nexport function registerTools(server: McpServer, client: RechnungsApiClient): void {\n server.registerTool(\n \"create_zugferd_invoice\",\n {\n title: \"Create ZUGFeRD invoice\",\n description:\n \"Create a ZUGFeRD PDF/A-3 e-invoice (visual PDF with embedded XRechnung XML) from structured invoice JSON plus a visual PDF template.\",\n inputSchema: {\n invoice: invoiceJsonSchema,\n invoicePdf64: z.string().describe(\"Base64-encoded visual PDF the XML will be embedded into\"),\n transport: transportSchema,\n },\n },\n async ({ invoice, invoicePdf64, transport }) =>\n asToolResult(() => client.createZugferdFromJson(invoice, invoicePdf64, { transport })),\n )\n\n server.registerTool(\n \"create_xinvoice\",\n {\n title: \"Create X-Invoice (XRechnung/UBL)\",\n description: \"Create an X-Invoice (XRechnung/UBL) XML document from structured invoice JSON.\",\n inputSchema: {\n invoice: invoiceJsonSchema,\n transport: transportSchema,\n },\n },\n async ({ invoice, transport }) => asToolResult(() => client.createXInvoiceFromJson(invoice, { transport })),\n )\n\n server.registerTool(\n \"create_zugferd_pdf\",\n {\n title: \"Embed X-Invoice XML into a PDF\",\n description: \"Embed an existing X-Invoice XML document into a visual PDF to produce a ZUGFeRD PDF.\",\n inputSchema: {\n invoicePdf64: z.string().describe(\"Base64-encoded visual PDF\"),\n xInvoiceXml: z.string().describe(\"X-Invoice XML to embed\"),\n },\n },\n async ({ invoicePdf64, xInvoiceXml }) => asToolResult(() => client.createZugferdPdf(invoicePdf64, xInvoiceXml)),\n )\n\n server.registerTool(\n \"extract_xinvoice_from_zugferd\",\n {\n title: \"Extract X-Invoice from ZUGFeRD PDF\",\n description: \"Extract the embedded XRechnung XML from a ZUGFeRD PDF and return it as structured JSON.\",\n inputSchema: {\n zugferd64: z.string().describe(\"Base64-encoded ZUGFeRD PDF\"),\n },\n },\n async ({ zugferd64 }) => asToolResult(() => client.extractXInvoiceFromZugferd(zugferd64)),\n )\n\n server.registerTool(\n \"validate_xinvoice_xml\",\n {\n title: \"Validate X-Invoice XML\",\n description: \"Validate an X-Invoice (XRechnung/UBL) XML document against schema and business rules.\",\n inputSchema: {\n xml: z.string().describe(\"The X-Invoice XML content to validate\"),\n },\n },\n async ({ xml }) => asToolResult(() => client.validateXInvoiceXml(xml)),\n )\n\n server.registerTool(\n \"validate_zugferd_pdf\",\n {\n title: \"Validate ZUGFeRD PDF\",\n description: \"Validate a ZUGFeRD PDF's embedded XML content.\",\n inputSchema: {\n zugferdFile64: z.string().describe(\"Base64-encoded ZUGFeRD PDF\"),\n comparePDF2XML: z.boolean().optional().describe(\"Also cross-check the embedded XML against the visual PDF content\"),\n },\n },\n async ({ zugferdFile64, comparePDF2XML }) =>\n asToolResult(() => client.validateZugferdPdf(zugferdFile64, { comparePDF2XML })),\n )\n\n server.registerTool(\n \"analyze_pdf_invoice\",\n {\n title: \"Analyze a PDF/scanned invoice\",\n description:\n \"Extract structured invoice JSON from a scanned or digital PDF/PNG/JPEG/TIFF invoice using the high-accuracy analyzer.\",\n inputSchema: {\n pdfBase64: z.string().describe(\"Base64-encoded PDF, PNG, JPEG, or TIFF invoice\"),\n withLineItems: z.boolean().optional().describe(\"Also extract individual line items\"),\n },\n },\n async ({ pdfBase64, withLineItems }) =>\n asToolResult(() => client.analyzePdfInvoiceV2(pdfBase64, withLineItems ?? false)),\n )\n\n server.registerTool(\n \"analyze_pdf_invoice_async_submit\",\n {\n title: \"Submit a large PDF invoice for async analysis\",\n description:\n \"Submit a large scanned/PDF invoice for asynchronous analysis (for files too large for the synchronous analyzer). \" +\n \"Returns a job_id — poll it with analyze_pdf_invoice_async_status.\",\n inputSchema: {\n pdfBase64: z.string().describe(\"Base64-encoded PDF, PNG, JPEG, or TIFF invoice\"),\n withLineItems: z.boolean().optional().describe(\"Also extract individual line items\"),\n },\n },\n async ({ pdfBase64, withLineItems }) =>\n asToolResult(() => client.analyzePdfInvoiceAsync(pdfBase64, withLineItems)),\n )\n\n server.registerTool(\n \"analyze_pdf_invoice_async_status\",\n {\n title: \"Check async PDF analysis status\",\n description: \"Poll the status of an asynchronous PDF invoice analysis job submitted via analyze_pdf_invoice_async_submit.\",\n inputSchema: {\n jobId: z.string().describe(\"The job_id returned by analyze_pdf_invoice_async_submit\"),\n },\n },\n async ({ jobId }) => asToolResult(() => client.getAnalysisStatus(jobId)),\n )\n\n server.registerTool(\n \"create_zugferd_from_pdf\",\n {\n title: \"Convert a PDF/scan directly into a ZUGFeRD PDF\",\n description:\n \"Convert a PDF or scanned image invoice directly into a validated ZUGFeRD PDF/A-3 in one call \" +\n \"(analyzes, validates, and embeds in a single step).\",\n inputSchema: {\n pdfBase64: z.string().describe(\"Base64-encoded PDF, PNG, JPEG, or TIFF invoice\"),\n fileName: z.string().optional().describe(\"Original filename, used to name the resulting PDF\"),\n },\n },\n async ({ pdfBase64, fileName }) => asToolResult(() => client.createZugferdFromPdf(pdfBase64, fileName)),\n )\n}\n"],"mappings":";;;AAAA,SAAS,iBAAiB;AAC1B,SAAS,4BAA4B;AACrC,SAAS,sBAAAA,2BAA0B;;;ACI5B,SAAS,oBAA2C;AACzD,QAAM,WAAW,QAAQ,IAAI;AAC7B,MAAI,CAAC,UAAU;AACb,UAAM,IAAI;AAAA,MACR;AAAA,IAEF;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA,SAAS,QAAQ,IAAI;AAAA,IACrB,WAAW,QAAQ,IAAI;AAAA,EACzB;AACF;;;AClBA,SAA6B,yBAAyB;AACtD,SAAS,SAAS;AAElB,IAAM,oBAAoB,EACvB,IAAI,EACJ,SAAS,2GAA2G;AAEvH,IAAM,kBAAkB,EACrB,IAAI,EACJ,SAAS,EACT,SAAS,oEAAoE;AAGhF,eAAe,aAAa,IAA4B;AACtD,MAAI;AACF,UAAM,SAAS,MAAM,GAAG;AACxB,WAAO,EAAE,SAAS,CAAC,EAAE,MAAM,QAAiB,MAAM,KAAK,UAAU,QAAQ,MAAM,CAAC,EAAE,CAAC,EAAE;AAAA,EACvF,SAAS,OAAO;AACd,QAAI,iBAAiB,mBAAmB;AACtC,aAAO;AAAA,QACL,SAAS;AAAA,QACT,SAAS;AAAA,UACP;AAAA,YACE,MAAM;AAAA,YACN,MAAM,KAAK,UAAU,EAAE,QAAQ,MAAM,QAAQ,SAAS,MAAM,SAAS,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC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CP (Model Context Protocol) server for RechnungsAPI — lets AI agents create, validate, and analyze ZUGFeRD and X-Invoice e-invoices.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "Finbc GmbH <support@rechnungsapi.de>",
|
|
7
|
+
"homepage": "https://rechnungsapi.de",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/Rechnungsapi/rechnungsapi-mcp.git"
|
|
11
|
+
},
|
|
12
|
+
"keywords": ["mcp", "model-context-protocol", "rechnungsapi", "zugferd", "xinvoice", "e-invoice"],
|
|
13
|
+
"type": "module",
|
|
14
|
+
"bin": {
|
|
15
|
+
"rechnungsapi-mcp": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"main": "./dist/index.js",
|
|
18
|
+
"files": ["dist", "README.md", "LICENSE"],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsup",
|
|
21
|
+
"dev": "tsup --watch",
|
|
22
|
+
"start": "node dist/index.js",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"test": "vitest run",
|
|
25
|
+
"inspect": "npx @modelcontextprotocol/inspector node dist/index.js"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@modelcontextprotocol/sdk": "1.22.0",
|
|
29
|
+
"rechnungsapi-sdk": "^0.1.0",
|
|
30
|
+
"zod": "^3.23.8"
|
|
31
|
+
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"@types/node": "^22.10.2",
|
|
34
|
+
"tsup": "^8.3.5",
|
|
35
|
+
"typescript": "^5.7.2",
|
|
36
|
+
"vitest": "^2.1.8"
|
|
37
|
+
},
|
|
38
|
+
"engines": {
|
|
39
|
+
"node": ">=18"
|
|
40
|
+
}
|
|
41
|
+
}
|