@kirjapro/mcp-server 0.18.1 → 0.19.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,95 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.19.0] - 2026-10-19
4
+
5
+ PR C of the MCP audit of 18.10.2026 (batches 3 and 4: posting guards and e-invoice send-state
6
+ guards). **Release order:** `npm run db:deploy` of `20261019120000`–`20261019120300` and
7
+ `20261019130000` first (`kirjapro_get_invoice` fails against a database without
8
+ `20261019130000`, and `check:types-drift` fails until it is live), then the Edge functions
9
+ `dispatch-invoice`, `generate-recurring-invoices`, `process-dead-letters`,
10
+ `send-einvoice-maventa`, `send-invoice-email` and `mcp`, then this package. Against 0.18.1,
11
+ 12 of the 56 tool fingerprints change: `kirjapro_book_purchase`,
12
+ `kirjapro_create_from_template`, `kirjapro_create_invoice`, `kirjapro_create_transaction`,
13
+ `kirjapro_create_transactions_batch`, `kirjapro_delete_invoice`, `kirjapro_get_invoice`,
14
+ `kirjapro_link_bank_transaction`, `kirjapro_list_bank_link_candidates`,
15
+ `kirjapro_match_bank_transaction`, `kirjapro_send_invoice` and
16
+ `kirjapro_update_invoice_status`. The two sections below list the changes per batch.
17
+
18
+ E-invoice send-state guards (MCP audit of 18.10.2026, PR C batch 4: T2-6, T3-53 to T3-57).
19
+ **Needs migration `20261019130000` before the release:** `kirjapro_get_invoice` reads the
20
+ computed field `invoice_delivery_in_progress`, which a database without the migration
21
+ refuses (the call fails). Deploy the Edge functions before publishing: `dispatch-invoice`
22
+ (names the channel of another delivery in `inProgressChannel`, re-reads the invoice after
23
+ its attempt mark), `generate-recurring-invoices`, `process-dead-letters`,
24
+ `send-einvoice-maventa`, `send-invoice-email` and `mcp` (the shared read definitions and the
25
+ generated core).
26
+ Four fingerprints change: `kirjapro_get_invoice`, `kirjapro_send_invoice`,
27
+ `kirjapro_update_invoice_status` and `kirjapro_delete_invoice`.
28
+
29
+ - `kirjapro_get_invoice` returns an optional `delivery` object once the invoice has a
30
+ delivery through Kirjapro: `in_progress` (with its `channel`) while a send is queued or
31
+ started and its outcome is not settled, or a draft was delivered but is not yet marked
32
+ sent; `einvoice_status` and `email_sent_at` as the providers reported them. Without
33
+ `delivery`, no delivery was started. A failed read of it fails the call. A client that
34
+ cached the previous output schema and checks results refuses the results that carry
35
+ `delivery` until it lists the tools again.
36
+ - `kirjapro_update_invoice_status` does not cancel a draft whose delivery is in progress or
37
+ done: the database refuses it for every client and the tool answers `DELIVERY_IN_PROGRESS`.
38
+ - `kirjapro_send_invoice` delivers an invoice once. A web, scheduled or earlier e-invoice
39
+ (pending or accepted) or a sent e-mail refuses another delivery, and another channel's
40
+ delivery in progress is now a definite, cached `DELIVERY_IN_PROGRESS` that names that
41
+ channel, not `IDEMPOTENCY_OUTCOME_UNKNOWN`. The outcome-unknown answer says not to cancel,
42
+ delete or use the other channel, points to `delivery` in `kirjapro_get_invoice` and says
43
+ that a new `idempotencyKey` for the same invoice and channel resumes the same delivery.
44
+ - `kirjapro_send_invoice` of an invoice that is already sent (`sent`, `partial`, `paid` or
45
+ `overdue`), for example the retry of a send whose outcome was unknown but which in fact
46
+ delivered it, answers a cached success with `already_sent: true`, `email_sent_at` and
47
+ `einvoice_status`, without a second delivery; before, it was an error. Its `channel` is
48
+ the one the evidence shows (`email`, `einvoice`), and an invoice marked sent in the app
49
+ without a Kirjapro delivery answers `channel: null` and says that Kirjapro sent nothing.
50
+ - `kirjapro_delete_invoice` does not delete a draft whose delivery is in progress or done
51
+ (a live e-invoice transmission, a sent e-mail, or an e-mail whose outcome a person has yet
52
+ to resolve): the database refuses it and the tool answers a cached `DELIVERY_IN_PROGRESS`.
53
+ - The `vat_notice` of `kirjapro_send_invoice` for a sales credit note gives its effect on the
54
+ VAT payable as negative (the credit note is stored with positive amounts and reverses the
55
+ VAT); it was positive.
56
+
57
+ MCP audit of 18.10.2026, batch 3 (posting guards). Needs the database migrations
58
+ `20261019120000`–`20261019120300` first; nine tool fingerprints change
59
+ (`kirjapro_book_purchase`, `kirjapro_create_from_template`, `kirjapro_create_transaction`,
60
+ `kirjapro_create_transactions_batch`, `kirjapro_create_invoice`, `kirjapro_send_invoice`,
61
+ `kirjapro_match_bank_transaction`, `kirjapro_list_bank_link_candidates`,
62
+ `kirjapro_link_bank_transaction`).
63
+
64
+ - A VAT posting dated in a VAT period already settled with `kirjapro_book_vat_settlement`
65
+ is still booked, and the result adds `vat_notice`, a Finnish note the agent relays to the
66
+ user: the period's settlement does not include this VAT (the note gives its net effect on
67
+ the VAT payable with its sign), so the period's VAT return is corrected in OmaVero and the
68
+ difference settled with a voucher (founder decision 19.10.2026, audit T3-16). Reductions
69
+ count too (a purchase credit note, a 4210 debit); VAT settlements, payments and refunds do
70
+ not. Covered: `kirjapro_book_purchase` (and its dry run), a purchase
71
+ template with VAT in `kirjapro_create_from_template`, `kirjapro_create_transaction` and
72
+ `kirjapro_create_transactions_batch` lines on 2320/4210 (preview and commit, one line per
73
+ voucher), and `kirjapro_send_invoice` (the sales journal is dated on the invoice date).
74
+ - `kirjapro_create_invoice` takes an optional `deliveryDate` (supply date). VAT treatments
75
+ are judged by it, as the app and the database do, and it is stored on the invoice
76
+ (audit T3-17): food delivered in December 2025 and invoiced in January 2026 keeps 14 %.
77
+ - `kirjapro_match_bank_transaction` refuses with `ALREADY_BOOKED` when a voucher already
78
+ moved the bank account by exactly the receipt's amount; link the line to that voucher
79
+ with `kirjapro_link_bank_transaction` instead (audit T3-19).
80
+ - `kirjapro_link_bank_transaction` to a purchase invoice answers `ALREADY_BOOKED` when the
81
+ payment already has a voucher that debits the invoice's payable (the database refuses it,
82
+ audit T2-1), and `kirjapro_list_bank_link_candidates` lists vouchers first. A same-amount
83
+ voucher that does not touch the payable no longer blocks the invoice link, and a line with
84
+ a payment-batch EndToEndId links to the batch item's separate payment voucher. The refusal
85
+ text is built from structured fields (the voucher number wrapped, the supplier's invoice
86
+ number not echoed). An item accepted by hand without a bank line no longer closes the cap
87
+ for a line without its EndToEndId (audit T3-27).
88
+ - An archived account is refused before any write with `ACCOUNT_ARCHIVED` in the voucher,
89
+ template and booking tools (audit T3-26).
90
+ - The install examples use `@kirjapro/mcp-server@latest`, so an older npm does not reuse a
91
+ cached copy; the package updates when the app restarts the server.
92
+
3
93
  ## [0.18.1] - 2026-10-19
4
94
 
5
95
  No database migration; one tool fingerprint changes (`kirjapro_book_sale`).
package/README.md CHANGED
@@ -39,6 +39,9 @@ sending, or when you automate Kirjapro from a local MCP client.
39
39
 
40
40
  ### 2. Configure your MCP client
41
41
 
42
+ The examples use `@kirjapro/mcp-server@latest`: the package updates whenever your app
43
+ restarts the server, and a running session keeps the version it started with.
44
+
42
45
  #### Claude Code
43
46
 
44
47
  Add the server with `claude mcp add`. User scope (every project) and local scope (this
@@ -47,7 +50,7 @@ project root:
47
50
 
48
51
  ```bash
49
52
  claude mcp add --transport stdio --env KIRJAPRO_API_KEY=kp_your_key_here --scope user \
50
- kirjapro -- npx -y @kirjapro/mcp-server
53
+ kirjapro -- npx -y @kirjapro/mcp-server@latest
51
54
  ```
52
55
 
53
56
  A project-scope `.mcp.json` is usually committed, so reference the key from your
@@ -59,7 +62,7 @@ environment instead of pasting it:
59
62
  "kirjapro": {
60
63
  "type": "stdio",
61
64
  "command": "npx",
62
- "args": ["-y", "@kirjapro/mcp-server"],
65
+ "args": ["-y", "@kirjapro/mcp-server@latest"],
63
66
  "env": {
64
67
  "KIRJAPRO_API_KEY": "${KIRJAPRO_API_KEY}"
65
68
  }
@@ -85,7 +88,7 @@ Add to `claude_desktop_config.json`:
85
88
  "mcpServers": {
86
89
  "kirjapro": {
87
90
  "command": "npx",
88
- "args": ["-y", "@kirjapro/mcp-server"],
91
+ "args": ["-y", "@kirjapro/mcp-server@latest"],
89
92
  "env": {
90
93
  "KIRJAPRO_API_KEY": "kp_your_key_here"
91
94
  }
@@ -105,7 +108,7 @@ Add to `~/.vibe/config.toml`:
105
108
  name = "kirjapro"
106
109
  transport = "stdio"
107
110
  command = "npx"
108
- args = ["-y", "@kirjapro/mcp-server"]
111
+ args = ["-y", "@kirjapro/mcp-server@latest"]
109
112
  env = { KIRJAPRO_API_KEY = "kp_your_key_here" }
110
113
  ```
111
114
 
@@ -113,7 +116,7 @@ Restart Vibe and verify the connection from `/mcp`.
113
116
 
114
117
  #### ChatGPT
115
118
 
116
- For read-only use, add the [remote endpoint](#remote-endpoint-no-install) as a connector instead. ChatGPT cannot launch this local `stdio` package directly; for write tools use [OpenAI Secure MCP Tunnel](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels) to bridge ChatGPT to `npx -y @kirjapro/mcp-server`. Full write/modify support currently requires ChatGPT Business or Enterprise/Edu; see the [full setup guide](https://kirjapro.fi/docs/mcp/) for the tunnel commands and plan limitations.
119
+ For read-only use, add the [remote endpoint](#remote-endpoint-no-install) as a connector instead. ChatGPT cannot launch this local `stdio` package directly; for write tools use [OpenAI Secure MCP Tunnel](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels) to bridge ChatGPT to `npx -y @kirjapro/mcp-server@latest`. Full write/modify support currently requires ChatGPT Business or Enterprise/Edu; see the [full setup guide](https://kirjapro.fi/docs/mcp/) for the tunnel commands and plan limitations.
117
120
 
118
121
  Mistral Le Chat accepts only a remote MCP server URL, so it cannot launch this package; it can use the [remote endpoint](#remote-endpoint-no-install) for read-only access. The local npm package works directly with Mistral Vibe.
119
122
 
@@ -147,7 +150,7 @@ A few prompts to feel out the daily workflows the agent handles cleanly:
147
150
  "mcpServers": {
148
151
  "kirjapro": {
149
152
  "command": "npx",
150
- "args": ["-y", "@kirjapro/mcp-server"],
153
+ "args": ["-y", "@kirjapro/mcp-server@latest"],
151
154
  "env": {
152
155
  "KIRJAPRO_API_KEY": "kp_your_key_here",
153
156
  "KIRJAPRO_MCP_SURFACE": "full" // 56 tools instead of 29