@kirjapro/mcp-server 0.8.0 → 0.8.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.
Files changed (66) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/accounts.d.ts +40 -0
  3. package/dist/accounts.js +45 -0
  4. package/dist/auth.d.ts +17 -0
  5. package/dist/auth.js +245 -0
  6. package/dist/compliance/rates.d.ts +53 -0
  7. package/dist/compliance/rates.js +57 -0
  8. package/dist/database.types.d.ts +6525 -0
  9. package/dist/database.types.js +20 -0
  10. package/dist/index.d.ts +2 -0
  11. package/dist/index.js +7441 -2613
  12. package/dist/lib/incomeStatementSynthesis.d.ts +47 -0
  13. package/dist/lib/incomeStatementSynthesis.js +140 -0
  14. package/dist/resources/company.d.ts +2 -0
  15. package/dist/resources/company.js +75 -0
  16. package/dist/resources/compliance.d.ts +2 -0
  17. package/dist/resources/compliance.js +338 -0
  18. package/dist/resources/index.d.ts +2 -0
  19. package/dist/resources/index.js +10 -0
  20. package/dist/resources/schema.d.ts +2 -0
  21. package/dist/resources/schema.js +63 -0
  22. package/dist/resources/security.d.ts +2 -0
  23. package/dist/resources/security.js +33 -0
  24. package/dist/schemas.d.ts +12 -0
  25. package/dist/schemas.js +12 -0
  26. package/dist/tools/accounts.d.ts +2 -0
  27. package/dist/tools/accounts.js +48 -0
  28. package/dist/tools/banking.d.ts +2 -0
  29. package/dist/tools/banking.js +196 -0
  30. package/dist/tools/bookings.d.ts +2 -0
  31. package/dist/tools/bookings.js +294 -0
  32. package/dist/tools/customers.d.ts +2 -0
  33. package/dist/tools/customers.js +320 -0
  34. package/dist/tools/financialNotes.d.ts +2 -0
  35. package/dist/tools/financialNotes.js +255 -0
  36. package/dist/tools/fingerprints.d.ts +6 -0
  37. package/dist/tools/fingerprints.js +28 -0
  38. package/dist/tools/fiscal-years.d.ts +2 -0
  39. package/dist/tools/fiscal-years.js +35 -0
  40. package/dist/tools/index.d.ts +9 -0
  41. package/dist/tools/index.js +105 -0
  42. package/dist/tools/invoices.d.ts +2 -0
  43. package/dist/tools/invoices.js +489 -0
  44. package/dist/tools/offers.d.ts +2 -0
  45. package/dist/tools/offers.js +443 -0
  46. package/dist/tools/received-invoices.d.ts +2 -0
  47. package/dist/tools/received-invoices.js +134 -0
  48. package/dist/tools/recurring-invoices.d.ts +2 -0
  49. package/dist/tools/recurring-invoices.js +348 -0
  50. package/dist/tools/reports.d.ts +2 -0
  51. package/dist/tools/reports.js +869 -0
  52. package/dist/tools/templates.d.ts +89 -0
  53. package/dist/tools/templates.js +636 -0
  54. package/dist/tools/transactions.d.ts +2 -0
  55. package/dist/tools/transactions.js +597 -0
  56. package/dist/tools/validation.d.ts +26 -0
  57. package/dist/tools/validation.js +127 -0
  58. package/dist/types.d.ts +388 -0
  59. package/dist/types.js +34 -0
  60. package/dist/utils.d.ts +276 -0
  61. package/dist/utils.js +637 -0
  62. package/dist/version.d.ts +1 -0
  63. package/dist/version.js +3 -0
  64. package/package.json +1 -1
  65. package/server.json +1 -1
  66. package/tool-fingerprints.json +14 -14
@@ -0,0 +1,89 @@
1
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ import type { TemplateEntry } from "../types.js";
3
+ /**
4
+ * Split a gross EUR amount into net + VAT using residual method.
5
+ * vat = gross - net ensures no rounding drift.
6
+ */
7
+ export declare function splitVat(gross: number, vatRate: number): {
8
+ net: number;
9
+ vat: number;
10
+ };
11
+ /**
12
+ * Validate that each accountOverrides pair (source → target) satisfies:
13
+ * 1. source exists in this company's chart,
14
+ * 2. target exists and is active, and
15
+ * 3. source.account_type === target.account_type.
16
+ *
17
+ * Prevents a caller from redirecting e.g. salary expense (`ELAKEKULUT`,
18
+ * expense) into an owner-withdrawal account (equity) or VAT receivable
19
+ * (asset) into a revenue account.
20
+ */
21
+ export declare function validateAccountOverrides(overrides: Record<string, string>): Promise<{
22
+ ok: true;
23
+ } | {
24
+ error: string;
25
+ }>;
26
+ /**
27
+ * Expand a template into journal entries for a given gross amount.
28
+ * Returns an error string if the template is unknown.
29
+ */
30
+ export declare function expandTemplate(templateId: string, amount: number, opts?: {
31
+ accountOverrides?: Record<string, string>;
32
+ }): {
33
+ entries: TemplateEntry[];
34
+ } | {
35
+ error: string;
36
+ };
37
+ /**
38
+ * Validate the fiscal year (exists, open, date in range) for a given
39
+ * transaction date. Shared by `resolveAndCreate` and the atomic booking
40
+ * wrappers in `bookings.ts` so they get the same preflight checks before
41
+ * entering an advisory-locked RPC.
42
+ */
43
+ export declare function validateFiscalYearForDate(fiscalYearId: string, transactionDate: string): Promise<{
44
+ content: Array<{
45
+ type: "text";
46
+ text: string;
47
+ }>;
48
+ isError: true;
49
+ } | {
50
+ start_date: string;
51
+ end_date: string;
52
+ }>;
53
+ /**
54
+ * Resolve a set of account numbers to `{account_number -> id}` within the
55
+ * current company. Returns `toErrorContent` on lookup failure or missing
56
+ * accounts.
57
+ */
58
+ export declare function resolveAccountNumbers(accountNumbers: string[]): Promise<{
59
+ content: Array<{
60
+ type: "text";
61
+ text: string;
62
+ }>;
63
+ isError: true;
64
+ } | Map<string, string>>;
65
+ /**
66
+ * Build DB-shaped journal entries from `TemplateEntry[]` using an
67
+ * account-number -> id map. Caller is responsible for balance validation.
68
+ */
69
+ export declare function toJournalEntries(entries: TemplateEntry[], accountMap: Map<string, string>): Array<{
70
+ account_id: string;
71
+ debit_amount: number;
72
+ credit_amount: number;
73
+ }>;
74
+ export declare function resolveAndCreate(params: {
75
+ fiscalYearId?: string;
76
+ transactionDate: string;
77
+ description: string;
78
+ documentNumber?: string;
79
+ entries: TemplateEntry[];
80
+ }): Promise<{
81
+ content: Array<{
82
+ type: "text";
83
+ text: string;
84
+ }>;
85
+ isError: true;
86
+ } | {
87
+ id: string;
88
+ }>;
89
+ export declare function registerTemplateTools(server: McpServer): void;