@kirjapro/mcp-server 0.6.1 → 0.6.3

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 CHANGED
@@ -7,7 +7,7 @@ MCP server for Finnish accounting. Exposes Kirjapro bookkeeping, invoicing, and
7
7
  ## Requirements
8
8
 
9
9
  - Node.js 20+
10
- - Kirjapro account on a paid tier with API access — **Yrittäjä**, **Kasvu**, **Tilitoimisto**, or **Räätälöity**
10
+ - Kirjapro account on a paid tier with API access — **Yrittäjä** or **Kasvu**
11
11
  - API key (generate at Settings > API-avaimet)
12
12
 
13
13
  ## Quick Start
package/dist/index.js CHANGED
@@ -30996,8 +30996,9 @@ async function initLegacyAuth() {
30996
30996
  `Cannot access company ${kirjaproCompanyId}. Verify the KIRJAPRO_COMPANY_ID is correct and your user has access. ` + (companyError?.message || "")
30997
30997
  );
30998
30998
  }
30999
- const { data: subscription } = await supabase.from("subscriptions").select("tier").eq("user_id", userData.user.id).single();
31000
- const tier = subscription?.tier || "free";
30999
+ const { data: subscription } = await supabase.from("subscriptions").select("tier, status").eq("user_id", userData.user.id).single();
31000
+ const hasActiveSub = subscription?.status === "active" || subscription?.status === "trialing";
31001
+ const tier = hasActiveSub ? subscription?.tier ?? "free" : "free";
31001
31002
  const apiTiers = ["entrepreneur", "growth", "company", "custom"];
31002
31003
  if (!apiTiers.includes(tier)) {
31003
31004
  throw new Error(
@@ -33772,7 +33773,15 @@ function registerBankingTools(server2) {
33772
33773
  p_match_type: "invoice",
33773
33774
  p_matched_invoice_id: params.invoiceId,
33774
33775
  p_confidence: 100,
33775
- p_match_method: "mcp_manual"
33776
+ // Must be a value in the reconciliation_matches/bank_transactions
33777
+ // match_method CHECK constraint (see migration
33778
+ // 20260408044634_align_check_constraints_with_ts_unions.sql — 12
33779
+ // legal values). 'mcp_manual' is NOT in the set, so the RPC's
33780
+ // INSERT raised 23514 on every call (no tsc guard: p_match_method
33781
+ // is typed `string`; mocked tests never hit the real CHECK). The
33782
+ // agent-origin is already captured by the mcp-auth JWT + API-key
33783
+ // audit trail — don't smuggle it into a constraint-gated column.
33784
+ p_match_method: "manual"
33776
33785
  }
33777
33786
  );
33778
33787
  if (matchError || !matchResult) {
@@ -34072,7 +34081,8 @@ var ACCOUNTS = {
34072
34081
  VIENTI: "5070",
34073
34082
  // ── Materials & Services (6xxx) ──
34074
34083
  OSTOT: "6010",
34075
- OSTOT_PALVELUT: "6030",
34084
+ OSTOT_PALVELUT: "6200",
34085
+ // Ulkopuoliset palvelut (was 6030 = "Ostot 13,5 %", a materials acct)
34076
34086
  // ── Expenses (7xxx) ──
34077
34087
  PALKAT: "7010",
34078
34088
  ELAKEKULUT: "7100",
@@ -34192,7 +34202,7 @@ var TEMPLATES = [
34192
34202
  expand: saleCashTemplate(ACCOUNTS.MYYNTI_25_5, 25.5)
34193
34203
  },
34194
34204
  {
34195
- id: "cash_sale_14",
34205
+ id: "cash_sale_13_5",
34196
34206
  description: "K\xE4teismyynti ALV 13,5%",
34197
34207
  vatRate: 13.5,
34198
34208
  expand: saleCashTemplate(ACCOUNTS.MYYNTI_13_5, 13.5)
@@ -34217,7 +34227,7 @@ var TEMPLATES = [
34217
34227
  expand: saleBankTemplate(ACCOUNTS.MYYNTI_25_5, 25.5)
34218
34228
  },
34219
34229
  {
34220
- id: "bank_sale_14",
34230
+ id: "bank_sale_13_5",
34221
34231
  description: "Pankkimyynti ALV 13,5%",
34222
34232
  vatRate: 13.5,
34223
34233
  expand: saleBankTemplate(ACCOUNTS.MYYNTI_13_5, 13.5)
@@ -35802,54 +35812,6 @@ function registerRecurringInvoiceTools(server2) {
35802
35812
  );
35803
35813
  }
35804
35814
  );
35805
- server2.registerTool(
35806
- "kirjapro_trigger_recurring_invoice",
35807
- {
35808
- description: "Manually trigger generation of a recurring invoice now, regardless of its next scheduled date. Returns the generated invoice.",
35809
- inputSchema: {
35810
- recurringInvoiceId: external_exports.string().uuid().describe("Recurring invoice UUID"),
35811
- idempotencyKey: IDEMPOTENCY_KEY_SCHEMA
35812
- },
35813
- annotations: WRITE_ANNOTATIONS
35814
- },
35815
- async (params) => {
35816
- const supabase2 = getSupabase();
35817
- const companyId2 = getCompanyId();
35818
- return withIdempotency(
35819
- supabase2,
35820
- companyId2,
35821
- "kirjapro_trigger_recurring_invoice",
35822
- params.idempotencyKey,
35823
- params,
35824
- async () => {
35825
- const { data: existing, error: fetchError } = await supabase2.from("recurring_invoices").select("id, name, is_active").eq("id", params.recurringInvoiceId).eq("company_id", companyId2).single();
35826
- if (fetchError || !existing) {
35827
- return toErrorContent(
35828
- `Recurring invoice ${params.recurringInvoiceId} not found. Use kirjapro_list_recurring_invoices to find IDs.`
35829
- );
35830
- }
35831
- if (!existing.is_active) {
35832
- return toErrorContent(
35833
- `Recurring invoice "${existing.name}" is paused. Activate it first with kirjapro_update_recurring_invoice.`
35834
- );
35835
- }
35836
- const result = await invokeEdgeFunction(
35837
- supabase2,
35838
- "generate-recurring-invoices",
35839
- { recurring_invoice_id: params.recurringInvoiceId, company_id: companyId2 }
35840
- );
35841
- if (result.error !== null) {
35842
- return toErrorContent(result.error);
35843
- }
35844
- return toResult({
35845
- message: `Invoice generated from "${existing.name}"`,
35846
- invoice_id: result.data.invoice_id,
35847
- invoice_number: result.data.invoice_number
35848
- });
35849
- }
35850
- );
35851
- }
35852
- );
35853
35815
  }
35854
35816
 
35855
35817
  // src/tools/received-invoices.ts
@@ -36758,7 +36720,7 @@ function registerResources(server2) {
36758
36720
  }
36759
36721
 
36760
36722
  // src/version.ts
36761
- var VERSION = "0.6.1";
36723
+ var VERSION = "0.6.3";
36762
36724
 
36763
36725
  // src/index.ts
36764
36726
  var INSTRUCTIONS_COMMON = `
@@ -36899,7 +36861,7 @@ Faster than composing journal entries via \`kirjapro_create_transaction\`:
36899
36861
  - \`kirjapro_get_transaction\` \u2014 single transaction with all journal entries
36900
36862
 
36901
36863
  ### Recurring + Received Invoices
36902
- - \`kirjapro_list_recurring_invoices\`, \`kirjapro_create_recurring_invoice\`, \`kirjapro_trigger_recurring_invoice\` \u2014 manage templates
36864
+ - \`kirjapro_list_recurring_invoices\`, \`kirjapro_create_recurring_invoice\` \u2014 manage templates
36903
36865
  - \`kirjapro_list_received_invoices\`, \`kirjapro_get_received_invoice\` \u2014 read-only view of purchase invoices
36904
36866
  - \`kirjapro_get_financial_notes\` \u2014 liitetiedot (KPL 3:1 / PMA 3:2 disclosures, year-end)
36905
36867
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kirjapro/mcp-server",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "MCP server for Finnish accounting — exposes Kirjapro bookkeeping, invoicing, and reporting tools to Claude Code, Claude Desktop, and any MCP client.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -180,10 +180,6 @@
180
180
  "name": "kirjapro_send_offer",
181
181
  "hash": "363ba364cb4cba81"
182
182
  },
183
- {
184
- "name": "kirjapro_trigger_recurring_invoice",
185
- "hash": "5666456cfb263321"
186
- },
187
183
  {
188
184
  "name": "kirjapro_update_customer",
189
185
  "hash": "f381091d34a3723d"