beliq-mcp 0.2.0 → 0.3.1

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/dist/schema.js CHANGED
@@ -140,6 +140,19 @@ export const generateOutputShape = {
140
140
  outputPath: z.string().optional(),
141
141
  bytesWritten: z.number().optional(),
142
142
  xml: z.string().optional(),
143
+ // The verify-it-yourself seal: sha256 of the returned document, the combined
144
+ // ruleset fingerprint it was checked against, and the validation verdict.
145
+ sha256: z.string().optional(),
146
+ rulesetSha256: z.string().optional(),
147
+ livemode: z.boolean().optional(),
148
+ validationResult: z
149
+ .object({
150
+ valid: z.boolean(),
151
+ schematronVersion: z.string().optional(),
152
+ errors: z.array(issueShape),
153
+ warnings: z.array(issueShape),
154
+ })
155
+ .optional(),
143
156
  };
144
157
  // ── Convert ────────────────────────────────────────────────────────────────
145
158
  export const convertInputShape = {
package/dist/summary.js CHANGED
@@ -52,11 +52,15 @@ export function summarizeParse(result) {
52
52
  /**
53
53
  * A human-readable summary of a generate. For an XML result the document is
54
54
  * appended in full so a client without structured output still receives it; a
55
- * PDF is reported by the path it was written to.
55
+ * PDF is reported by the path it was written to. When the seal is present the
56
+ * document sha256 and validation verdict are stated so the model can cite them.
56
57
  */
57
58
  export function summarizeGenerate(g) {
58
59
  const checked = g.schematronVersion ? `, checked against Schematron ${g.schematronVersion}` : '';
59
- const header = `Generated a ${g.standard} ${g.output} document${checked}.`;
60
+ const seal = g.sha256
61
+ ? ` Document sha256 ${g.sha256}${g.valid === undefined ? '' : `; validation ${g.valid ? 'passed' : 'failed'}`}.`
62
+ : '';
63
+ const header = `Generated a ${g.standard} ${g.output} document${checked}.${seal}`;
60
64
  if (g.output === 'pdf') {
61
65
  const where = g.outputPath ? ` Written to ${g.outputPath} (${plural(g.bytesWritten ?? 0, 'byte')}).` : '';
62
66
  return `${header}${where}`;
@@ -161,6 +161,9 @@ export async function runGenerate(input, deps) {
161
161
  output,
162
162
  facturxProfile: input.facturxProfile,
163
163
  verify: input.verify ?? true,
164
+ // Always seal so the tool can hand back the document sha256 and the
165
+ // validation verdict for the model to cite.
166
+ seal: true,
164
167
  });
165
168
  }
166
169
  catch (err) {
@@ -183,6 +186,7 @@ export async function runGenerate(input, deps) {
183
186
  return errorResult(`Could not write the document: ${err.message}`);
184
187
  }
185
188
  }
189
+ const vr = result.validationResult;
186
190
  const text = summarizeGenerate({
187
191
  standard: input.standard,
188
192
  output,
@@ -190,6 +194,8 @@ export async function runGenerate(input, deps) {
190
194
  outputPath,
191
195
  bytesWritten,
192
196
  xml: output === 'xml' ? result.xml : undefined,
197
+ sha256: result.sha256,
198
+ valid: vr?.valid,
193
199
  });
194
200
  return {
195
201
  content: [{ type: 'text', text }],
@@ -201,6 +207,17 @@ export async function runGenerate(input, deps) {
201
207
  outputPath,
202
208
  bytesWritten,
203
209
  xml: output === 'xml' ? result.xml : undefined,
210
+ sha256: result.sha256,
211
+ rulesetSha256: result.meta.rulesetSha256,
212
+ livemode: result.meta.livemode,
213
+ validationResult: vr
214
+ ? {
215
+ valid: vr.valid,
216
+ schematronVersion: vr.schematronVersion,
217
+ errors: vr.errors ?? [],
218
+ warnings: vr.warnings ?? [],
219
+ }
220
+ : undefined,
204
221
  },
205
222
  };
206
223
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "beliq-mcp",
3
- "version": "0.2.0",
3
+ "version": "0.3.1",
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.1.0",
59
+ "@beliq/sdk": "^0.3.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": "^2.1.8"
69
+ "vitest": "^3.2.6"
70
70
  }
71
71
  }