@kirjapro/mcp-server 0.19.0 → 0.20.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/CHANGELOG.md CHANGED
@@ -1,5 +1,117 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.20.0] - 2026-10-20
4
+
5
+ PR D of the MCP audit of 18.10.2026 (batches 7 to 12 and 14). Against 0.19.0, 3 of the 56
6
+ tool fingerprints change: `kirjapro_book_vat_settlement`, `kirjapro_send_invoice` and
7
+ `kirjapro_send_offer`. The package now bundles its runtime dependencies (no `dependencies`
8
+ in `package.json`).
9
+
10
+ **PR D release order** (one checklist for every section below; the rollout runbook row 7d0b
11
+ in `docs/guides/ai-workspace-rollout.md` is its source): (1) merge by hand, which deploys the
12
+ web app (until step 2 its Settings page can neither create nor revoke an API key); (2) `npm
13
+ run db:deploy` from clean `main` at low traffic, all six migrations `20261019140000`,
14
+ `20261019150000`, `20261019150100`, `20261019164710`, `20261019170000` and `20261019180000`;
15
+ (3) `npm run functions:deploy` of `dispatch-invoice`, `send-offer-email`, `prh-lookup`,
16
+ `generate-recurring-invoices` and `send-payment-reminders`; (4) `mcp-auth`; (5) `mcp` last;
17
+ (6) this package. For about 11 minutes after step 2 an OAuth connection of a user with MFA
18
+ that was approved just before it may answer 401 once and authorize again.
19
+
20
+ API key lifecycle and DB-boundary hygiene (MCP audit of 18.10.2026, PR D batch 9). Server
21
+ side only: no tool, description or fingerprint changes, and every published package gets
22
+ the behaviour once migrations `20261019150000` and `20261019150100` and the `mcp-auth`
23
+ deploy are live (steps 2 and 4). `src/database.types.ts` gains `api_keys.membership_id`
24
+ and the RPCs `create_api_key`, `revoke_api_key` and `mcp_api_key_access`.
25
+
26
+ - A revoked or expired key's live token, or that of a key whose creator left the company,
27
+ now gets `CREDENTIAL_INVALID` from its next read instead of empty lists ("0 invoices",
28
+ "not found"): the Data API gate answers such a key token with 401 and a message that
29
+ starts with the code.
30
+ - `mcp-auth` answers the key of a creator who was removed from the company (even if
31
+ invited again) with 401, which the server reads as a permanent `CREDENTIAL_INVALID`,
32
+ instead of the `API_ENTITLEMENT_REQUIRED` 403; a failed check is a transient 503.
33
+ - A credential holds at most 1 000 unresolved idempotency claims. Beyond them a write is
34
+ refused before it runs (`IDEMPOTENCY_BACKEND_UNAVAILABLE`, the write was not executed).
35
+ - Keys are created and revoked only in the Kirjapro app (Asetukset → MCP-palvelin), which
36
+ now generates the key in the database and, before revoking, lists the key's writes and
37
+ offers to pause the recurring invoices with automatic sending that it touched; the revoke
38
+ button waits for that list. A key stays bound to its creator's membership for good: no
39
+ later write, not even an operator's, moves or restores the binding.
40
+
41
+ Untrusted text and send friction (MCP audit of 18.10.2026, PR D batch 7: T2-7, T2-8, T3-40,
42
+ T3-42 to T3-45, T4-13, T4-18; T3-41 was fixed by PR A). Released by the PR D order above
43
+ (the migration `20261019164710` and the Edge functions before this package). Three
44
+ fingerprints change:
45
+ `kirjapro_send_invoice`, `kirjapro_send_offer` and `kirjapro_book_vat_settlement`.
46
+
47
+ - `kirjapro_send_invoice` and `kirjapro_send_offer` take `dryRun`: nothing is claimed or
48
+ sent, and the preview names the recipient (wrapped), the channel and the invoice or offer
49
+ number, with `recipient_confirmation_required`. The results name the recipient(s),
50
+ wrapped. The preview asks the Edge function with `previewInvoiceId` or `previewOfferId`,
51
+ never with `invoiceId` or `offerId`, so a function deployed before previews refuses it
52
+ (`PREVIEW_UNAVAILABLE: … Nothing was sent`) and a dry run can never deliver. The text says
53
+ `Nothing was sent` only for a refusal or a lost answer.
54
+ - Recipient confirmation (founder decision 19.10.2026): when the customer's e-mail or
55
+ e-invoice address was created or changed through an MCP credential (an API key or an
56
+ OAuth connection) in the last 24 hours, the send is refused with a cached
57
+ `RECIPIENT_CONFIRMATION_REQUIRED` naming the address, unless the call passes
58
+ `confirmRecipient` equal to it (an e-mail address in any case). A person who saves the
59
+ customer in the Kirjapro app confirms it too. The rule runs in the Edge functions, so the
60
+ remote endpoint enforces it as well; signers configured for a contract in the app need no
61
+ confirmation. The tool descriptions and the server instructions ask the agent to show the
62
+ address to the user first. An e-invoice refusal also names the operator. The automatic
63
+ sends have nobody to confirm, so they hold any recipient an MCP credential set that no
64
+ person has saved since, however old: the daily recurring run leaves the invoice a draft
65
+ and the template's generation log says why, and the payment reminders skip the customer.
66
+ An offer without any recipient answers the missing e-mail address, not
67
+ `RECIPIENT_CONFIRMATION_REQUIRED`.
68
+ - Invoice, reference, offer and customer numbers are no longer trusted as "generated": they
69
+ stay bare only in the shape Kirjapro allocates (`2026-0001`, digits, `TAR00001`/`SOP00001`,
70
+ `C00001`) and are wrapped otherwise, in the read tools (also the ALV reconciliation, the
71
+ offer events and the recurring invoice log) and in the write tools' results and messages
72
+ (a partial reversal of U-65). The company's own IBAN is bare only with a numeric account
73
+ part. The server instructions and `kirjapro://security/data-handling` say so.
74
+ - Refusal texts of the bank reconciliation tools and of `kirjapro_book_vat_settlement` that
75
+ quote stored text (an e-invoice number, a voucher number, the line's currency) are wrapped.
76
+ - An argument that contains `⟦redacted⟧`, which a read result shows in place of text that
77
+ looked like an instruction, is refused with `INVALID_ARGUMENTS` instead of being stored.
78
+ - `kirjapro_get_received_invoice` wraps `pdf_storage_path` (the sender's file name).
79
+ - `kirjapro_get_recurring_invoice` keeps a `template_data` code bare only when it is a VAT
80
+ treatment code, VAT category, price-entry mode or account id the server writes.
81
+ - `kirjapro_get_general_ledger` echoes an unknown account wrapped unless it is a number;
82
+ `kirjapro_book_vat_settlement` takes a 4- or 5-digit `paymentAccount` only.
83
+ - `kirjapro_get_offer` keeps the status codes `from_status` and `to_status` of an offer event
84
+ bare.
85
+
86
+ PR D of the MCP audit of 18.10.2026 (batches 8, 11 and 14). No tool definition changes and
87
+ no fingerprint changes. Released by the PR D order above (`20261019170000`, the server-side
88
+ `batch_size` clamp, is in its `db:deploy`; the package does not need it). Before the first
89
+ tag, run the publish workflow once by hand on `main`: its `publish` job now runs in the
90
+ `npm-publish` environment.
91
+
92
+ - **No runtime dependencies** (T3-58): `@modelcontextprotocol/sdk`, `zod` and
93
+ `@supabase/supabase-js` are bundled into `dist/index.js` (about 2.7 MB) and are
94
+ devDependencies; the optional `@supabase/supabase-js` peer dependency is gone. `npx -y
95
+ @kirjapro/mcp-server` installs this one package, so no unpinned third-party package or
96
+ install script runs with `KIRJAPRO_API_KEY` in its environment. Up to 0.19.0 about 105
97
+ packages were resolved at install time.
98
+ - **Stable code for a schema refusal** (T4-16): arguments that fail a tool's input schema
99
+ answer `INVALID_ARGUMENTS: Input validation error: Invalid arguments for tool …` instead
100
+ of `MCP error -32602: Input validation error: …`, so every failed call starts with a code.
101
+ Telemetry already recorded these as `INVALID_ARGUMENTS`.
102
+ - **Telemetry `batch_size`** (T3-60): only a transactions count within 1–250 is sent. A
103
+ batch call with `transactions: []` or more than 250 items (which the SDK then refuses)
104
+ made the database refuse the whole telemetry flush, its neighbours' events included.
105
+ - **Release pipeline** (T2-12, T3-78; no package change): `publish-mcp.yml` builds and packs
106
+ in a job without secrets or publish rights, checks the live types in a job that holds
107
+ only the read token and installs nothing but the checksum-pinned Supabase CLI 2.111.0
108
+ release, and publishes the packed tarball from a job
109
+ in the `npm-publish` environment that installs nothing. `check:release-version` keeps
110
+ `package.json`, `server.json`, `mcpb/manifest.json` and this file's version heading in
111
+ step on every pull request; `mcpb:validate` and `mcpb:pack` pin `@anthropic-ai/mcpb@2.1.2`.
112
+ `check:types-drift` (also in `prepublishOnly`) runs `supabase` from `PATH` and fails unless
113
+ `supabase --version` is exactly 2.111.0; it no longer runs `npx -y supabase@latest`.
114
+
3
115
  ## [0.19.0] - 2026-10-19
4
116
 
5
117
  PR C of the MCP audit of 18.10.2026 (batches 3 and 4: posting guards and e-invoice send-state