beliq-mcp 0.3.1 → 0.3.2
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/README.md +1 -1
- package/dist/schema.js +2 -2
- package/dist/tools/generate.js +1 -1
- package/dist/tools/shared.js +14 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ A PDF (Factur-X / ZUGFeRD) must be passed by `documentPath` for validate, parse,
|
|
|
83
83
|
|
|
84
84
|
## Development
|
|
85
85
|
|
|
86
|
-
This server depends on the published [`@beliq/sdk`](https://www.npmjs.com/package/@beliq/sdk), which carries the request, transport, and result-shaping logic.
|
|
86
|
+
This server depends on the published [`@beliq/sdk`](https://www.npmjs.com/package/@beliq/sdk), which carries the request, transport, and result-shaping logic. `package-lock.json` is committed, and CI and the release build install from it with `npm ci`.
|
|
87
87
|
|
|
88
88
|
- `npm install`
|
|
89
89
|
- `npm run build` - compile to `dist/`
|
package/dist/schema.js
CHANGED
|
@@ -117,11 +117,11 @@ export const generateInputShape = {
|
|
|
117
117
|
output: z
|
|
118
118
|
.enum(['xml', 'pdf'])
|
|
119
119
|
.optional()
|
|
120
|
-
.describe("'xml' (default) returns the document inline. 'pdf'
|
|
120
|
+
.describe("'xml' (default) returns the document inline. 'pdf' needs outputPath to write it to: for facturx and zugferd it is a hybrid PDF/A-3 with the XML embedded; xrechnung and peppol-bis have no hybrid form, so it is a visualization with no XML inside it, and their legal document stays the XML."),
|
|
121
121
|
facturxProfile: z
|
|
122
122
|
.enum(LIVE_PROFILES)
|
|
123
123
|
.optional()
|
|
124
|
-
.describe('Profile for a Factur-X / ZUGFeRD
|
|
124
|
+
.describe('Profile for a Factur-X / ZUGFeRD document; ignored for xrechnung and peppol-bis. extended-ctc-fr is Factur-X only: zugferd accepts basicwl, en16931 and extended.'),
|
|
125
125
|
verify: z
|
|
126
126
|
.boolean()
|
|
127
127
|
.optional()
|
package/dist/tools/generate.js
CHANGED
|
@@ -3,7 +3,7 @@ import { runGenerate } from './shared.js';
|
|
|
3
3
|
const description = [
|
|
4
4
|
'Generate a compliant EU electronic invoice from an EN 16931 invoice object.',
|
|
5
5
|
'Set standard to the target (xrechnung, zugferd, facturx, or peppol-bis) and pass the invoice fields.',
|
|
6
|
-
"output 'xml' (default) returns the document inline; 'pdf'
|
|
6
|
+
"output 'xml' (default) returns the document inline; 'pdf' needs outputPath to write it to, and is a hybrid PDF/A-3 with the XML embedded for facturx and zugferd, or a visualization with no embedded XML for xrechnung and peppol-bis (whose legal document stays the XML).",
|
|
7
7
|
'By default the result is validated before it is returned (verify), so a non-compliant document fails rather than coming back.',
|
|
8
8
|
'beliq produces the compliant document; transmission (Peppol, PDP, KSeF, SDI), archiving, and tax-authority reporting stay with your access point.',
|
|
9
9
|
].join(' ');
|
package/dist/tools/shared.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
|
-
import { BeliqApiError } from '@beliq/sdk';
|
|
2
|
+
import { BeliqApiError, isProfileAllowedForStandard, profilesForStandard, } from '@beliq/sdk';
|
|
3
3
|
import { summarizeConvert, summarizeGenerate, summarizeParse, summarizeValidation } from '../summary.js';
|
|
4
4
|
function errorResult(message) {
|
|
5
5
|
return { content: [{ type: 'text', text: message }], isError: true };
|
|
@@ -153,6 +153,15 @@ export async function runGenerate(input, deps) {
|
|
|
153
153
|
if (output === 'pdf' && !outputPath) {
|
|
154
154
|
return errorResult('A pdf output needs outputPath: the file path to write the generated PDF to.');
|
|
155
155
|
}
|
|
156
|
+
// The SDK drops facturxProfile outside the Factur-X / ZUGFeRD family. Inside
|
|
157
|
+
// it the pair is still pinned: extended-ctc-fr is Factur-X only, and the API
|
|
158
|
+
// answers it on zugferd with 422 PROFILE_STANDARD_MISMATCH. Name the legal
|
|
159
|
+
// values rather than spend a call on a pair that cannot succeed.
|
|
160
|
+
const hybrid = input.standard === 'facturx' || input.standard === 'zugferd';
|
|
161
|
+
if (hybrid && input.facturxProfile && !isProfileAllowedForStandard(input.standard, input.facturxProfile)) {
|
|
162
|
+
return errorResult(`facturxProfile '${input.facturxProfile}' is not available for ${input.standard}. ` +
|
|
163
|
+
`Use one of: ${profilesForStandard(input.standard).join(', ')}.`);
|
|
164
|
+
}
|
|
156
165
|
let result;
|
|
157
166
|
try {
|
|
158
167
|
result = await deps.client.generate({
|
|
@@ -160,6 +169,10 @@ export async function runGenerate(input, deps) {
|
|
|
160
169
|
invoice: input.invoice,
|
|
161
170
|
output,
|
|
162
171
|
facturxProfile: input.facturxProfile,
|
|
172
|
+
// XRechnung and Peppol BIS have no hybrid PDF, and the API refuses PDF
|
|
173
|
+
// for them unless the request names a visual to render. Factur-X and
|
|
174
|
+
// ZUGFeRD render theirs either way, so this is inert for them.
|
|
175
|
+
template: output === 'pdf' ? 'standard' : undefined,
|
|
163
176
|
verify: input.verify ?? true,
|
|
164
177
|
// Always seal so the tool can hand back the document sha256 and the
|
|
165
178
|
// validation verdict for the model to cite.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "beliq-mcp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "beliq MCP server: validate, parse, generate, and convert EU e-invoices (XRechnung, ZUGFeRD, Factur-X, Peppol BIS) against authority-pinned, drift-checked rules, for MCP clients.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"prepublishOnly": "npm run build"
|
|
57
57
|
},
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@beliq/sdk": "^0.
|
|
59
|
+
"@beliq/sdk": "^0.4.0",
|
|
60
60
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
61
61
|
"zod": "^4.4.3"
|
|
62
62
|
},
|
|
@@ -66,6 +66,6 @@
|
|
|
66
66
|
"@typescript-eslint/parser": "^7.18.0",
|
|
67
67
|
"eslint": "^8.57.0",
|
|
68
68
|
"typescript": "^5.5.4",
|
|
69
|
-
"vitest": "^
|
|
69
|
+
"vitest": "^4.0.0"
|
|
70
70
|
}
|
|
71
71
|
}
|