@kirjapro/mcp-server 0.2.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 +36 -0
- package/README.md +160 -0
- package/dist/index.js +22746 -0
- package/package.json +66 -0
- package/server.json +19 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.2.0] - 2026-02-19
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **npm publish infrastructure** — version validation, GitHub Releases on tag push
|
|
8
|
+
- `kirjapro_get_invoice` — get single invoice with lines, payments, and VAT breakdown
|
|
9
|
+
- `kirjapro_get_transaction` — get single transaction with journal entries and account details
|
|
10
|
+
- `kirjapro_list_bank_accounts` — list active bank accounts with balances
|
|
11
|
+
- `kirjapro_list_bank_transactions` — list/filter bank transactions (unreconciled, date range, search)
|
|
12
|
+
- `kirjapro_list_fiscal_years` — list fiscal years as a tool (complements the resource)
|
|
13
|
+
- `kirjapro_get_general_ledger` — general ledger for one account with running balance
|
|
14
|
+
- `kirjapro_update_invoice_status` — update invoice status with state machine validation
|
|
15
|
+
- `kirjapro_update_customer` — partial update customer fields with Y-tunnus re-validation
|
|
16
|
+
- `kirjapro_get_customer` — get single customer with invoice stats
|
|
17
|
+
- `kirjapro_delete_invoice` — delete draft invoices (audit-safe: sent/paid must be cancelled first)
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Version bumped to 0.2.0 across package.json, server.json, and index.ts
|
|
22
|
+
- Fixed `server.json` repository URL
|
|
23
|
+
- Added `publishConfig`, `repository`, `bugs`, `homepage`, and `peerDependencies` to package.json
|
|
24
|
+
- Fixed `InvoiceStatus` type to include `partial` status
|
|
25
|
+
- Fixed `BankTransaction` type: `counterpart_name` → `counterparty_name` to match DB schema
|
|
26
|
+
|
|
27
|
+
## [0.1.0] - 2026-02-16
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- Initial release with 17 tools, 4 resources
|
|
32
|
+
- Authentication via API key or legacy JWT
|
|
33
|
+
- Chart of accounts, transactions, invoices, customers, reports
|
|
34
|
+
- Finnish reference number generation and Y-tunnus validation
|
|
35
|
+
- Bank transaction matching
|
|
36
|
+
- Income statement, balance sheet, AR aging reports
|
package/README.md
ADDED
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# @kirjapro/mcp-server
|
|
2
|
+
|
|
3
|
+
MCP server for Finnish accounting. Exposes Kirjapro bookkeeping, invoicing, and reporting tools to Claude Code, Claude Desktop, and any MCP client.
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js 20+
|
|
8
|
+
- Kirjapro account with **Company** or **Custom** subscription tier
|
|
9
|
+
- API key (generate at Settings > API-avaimet)
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
### 1. Generate an API Key
|
|
14
|
+
|
|
15
|
+
1. Go to **Settings > API-avaimet** in the Kirjapro app
|
|
16
|
+
2. Click **"Luo uusi avain"**
|
|
17
|
+
3. Copy the key (shown only once)
|
|
18
|
+
|
|
19
|
+
### 2. Configure your MCP client
|
|
20
|
+
|
|
21
|
+
#### Claude Code
|
|
22
|
+
|
|
23
|
+
Add to `.claude/mcp.json`:
|
|
24
|
+
|
|
25
|
+
```json
|
|
26
|
+
{
|
|
27
|
+
"mcpServers": {
|
|
28
|
+
"kirjapro": {
|
|
29
|
+
"command": "npx",
|
|
30
|
+
"args": ["-y", "@kirjapro/mcp-server"],
|
|
31
|
+
"env": {
|
|
32
|
+
"KIRJAPRO_API_KEY": "kp_your_key_here"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
#### Claude Desktop
|
|
40
|
+
|
|
41
|
+
Add to `claude_desktop_config.json`:
|
|
42
|
+
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"mcpServers": {
|
|
46
|
+
"kirjapro": {
|
|
47
|
+
"command": "npx",
|
|
48
|
+
"args": ["-y", "@kirjapro/mcp-server"],
|
|
49
|
+
"env": {
|
|
50
|
+
"KIRJAPRO_API_KEY": "kp_your_key_here"
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### 3. Verify
|
|
58
|
+
|
|
59
|
+
In Claude Code, run `/mcp` to see the available Kirjapro tools.
|
|
60
|
+
|
|
61
|
+
## Environment Variables
|
|
62
|
+
|
|
63
|
+
| Variable | Required | Description |
|
|
64
|
+
|----------|----------|-------------|
|
|
65
|
+
| `KIRJAPRO_API_KEY` | Yes* | API key from Settings > API-avaimet |
|
|
66
|
+
|
|
67
|
+
### Legacy (development only)
|
|
68
|
+
|
|
69
|
+
| Variable | Required | Description |
|
|
70
|
+
|----------|----------|-------------|
|
|
71
|
+
| `SUPABASE_URL` | Yes* | Supabase project URL |
|
|
72
|
+
| `SUPABASE_ACCESS_TOKEN` | Yes* | User's JWT access token |
|
|
73
|
+
| `KIRJAPRO_COMPANY_ID` | Yes* | Company UUID to operate on |
|
|
74
|
+
|
|
75
|
+
*Either `KIRJAPRO_API_KEY` or all three legacy variables must be set.
|
|
76
|
+
|
|
77
|
+
## Tools (28)
|
|
78
|
+
|
|
79
|
+
### Read Tools
|
|
80
|
+
|
|
81
|
+
| Tool | Description |
|
|
82
|
+
|------|-------------|
|
|
83
|
+
| `kirjapro_list_accounts` | List chart of accounts with filtering by type |
|
|
84
|
+
| `kirjapro_list_transactions` | List transactions with journal entries for a fiscal year |
|
|
85
|
+
| `kirjapro_search_transactions` | Search transactions by text, date range, or amount |
|
|
86
|
+
| `kirjapro_get_transaction` | Get single transaction with journal entries and account details |
|
|
87
|
+
| `kirjapro_list_invoices` | List invoices with customer names, filter by status |
|
|
88
|
+
| `kirjapro_get_invoice` | Get single invoice with lines, payments, and VAT breakdown |
|
|
89
|
+
| `kirjapro_list_customers` | List customers with search |
|
|
90
|
+
| `kirjapro_get_customer` | Get single customer with invoice stats |
|
|
91
|
+
| `kirjapro_list_bank_accounts` | List active bank accounts with balances |
|
|
92
|
+
| `kirjapro_list_bank_transactions` | List bank transactions with filtering |
|
|
93
|
+
| `kirjapro_list_fiscal_years` | List fiscal years with open/closed status |
|
|
94
|
+
| `kirjapro_get_dashboard` | Financial dashboard: revenue, expenses, invoice stats, bank balances |
|
|
95
|
+
| `kirjapro_get_income_statement` | Income statement (tuloslaskelma) for a date range |
|
|
96
|
+
| `kirjapro_get_balance_sheet` | Balance sheet (tase) as of a specific date |
|
|
97
|
+
| `kirjapro_get_ar_aging` | Accounts receivable aging (0-30, 31-60, 61-90, 90+ days) |
|
|
98
|
+
| `kirjapro_get_general_ledger` | General ledger (pääkirja) for one account with running balance |
|
|
99
|
+
|
|
100
|
+
### Write Tools
|
|
101
|
+
|
|
102
|
+
| Tool | Description |
|
|
103
|
+
|------|-------------|
|
|
104
|
+
| `kirjapro_create_transaction` | Create an accounting transaction with journal entries |
|
|
105
|
+
| `kirjapro_create_transactions_batch` | Bulk create up to 50 transactions (partial success) |
|
|
106
|
+
| `kirjapro_create_invoice` | Create invoice with auto-generated number and reference |
|
|
107
|
+
| `kirjapro_create_customer` | Create customer with Y-tunnus validation |
|
|
108
|
+
| `kirjapro_update_customer` | Update customer fields (partial update, re-validates Y-tunnus) |
|
|
109
|
+
| `kirjapro_record_payment` | Record payment against an invoice |
|
|
110
|
+
| `kirjapro_update_invoice_status` | Update invoice status with state machine validation |
|
|
111
|
+
| `kirjapro_delete_invoice` | Delete draft invoices (audit-safe) |
|
|
112
|
+
| `kirjapro_match_bank_transaction` | Match bank transaction to an invoice |
|
|
113
|
+
|
|
114
|
+
### Validation Tools
|
|
115
|
+
|
|
116
|
+
| Tool | Description |
|
|
117
|
+
|------|-------------|
|
|
118
|
+
| `kirjapro_validate_business_id` | Validate Finnish Y-tunnus |
|
|
119
|
+
| `kirjapro_validate_iban` | Validate Finnish IBAN |
|
|
120
|
+
| `kirjapro_generate_reference` | Generate viitenumero with check digit |
|
|
121
|
+
|
|
122
|
+
## Resources (4)
|
|
123
|
+
|
|
124
|
+
| URI | Description |
|
|
125
|
+
|-----|-------------|
|
|
126
|
+
| `kirjapro://accounts/chart` | Finnish standard chart of accounts (YSE 2017) |
|
|
127
|
+
| `kirjapro://vat-rates` | Finnish VAT rates (25.5%, 13.5%, 10%, 0%) |
|
|
128
|
+
| `kirjapro://company/info` | Current company details |
|
|
129
|
+
| `kirjapro://fiscal-years` | Fiscal years with open/closed status |
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
cd mcp-server
|
|
135
|
+
npm install
|
|
136
|
+
npm run dev # Run with tsx
|
|
137
|
+
npm run build # Build with esbuild
|
|
138
|
+
npm test # Run vitest
|
|
139
|
+
npm run lint # Type check
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Publishing
|
|
143
|
+
|
|
144
|
+
Releases are automated via GitHub Actions. To publish:
|
|
145
|
+
|
|
146
|
+
1. Update version in `package.json`, `server.json`, and `src/index.ts`
|
|
147
|
+
2. Update `CHANGELOG.md`
|
|
148
|
+
3. Commit and tag: `git tag mcp-server/v0.2.0`
|
|
149
|
+
4. Push: `git push origin mcp-server/v0.2.0`
|
|
150
|
+
|
|
151
|
+
The workflow validates version consistency, runs tests, publishes to npm, and creates a GitHub Release.
|
|
152
|
+
|
|
153
|
+
## Security
|
|
154
|
+
|
|
155
|
+
- API keys are hashed with SHA-256; the full key is never stored
|
|
156
|
+
- Keys exchange for short-lived JWTs (1 hour) via the `mcp-auth` edge function
|
|
157
|
+
- All queries use the user's JWT with Row Level Security (RLS)
|
|
158
|
+
- Automatic token refresh keeps long-running MCP sessions alive
|
|
159
|
+
- Feature gate: requires `hasApiAccess` (Company/Custom tier)
|
|
160
|
+
- Rate limiting: 10 auth requests per minute per key
|