bkper 3.5.4 → 3.5.6
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[Bkper REST API]: https://bkper.com/docs/#rest-api-enabling
|
|
2
2
|
|
|
3
|
-
A **command line** utility for managing [Bkper Apps and Bots](https://bkper.com/docs/) and running the [Model Context Protocol (MCP) server](https://modelcontextprotocol.io).
|
|
3
|
+
A **command line** utility for managing [Bkper Apps and Bots](https://bkper.com/docs/) and running the [Model Context Protocol (MCP) server](https://modelcontextprotocol.io).
|
|
4
4
|
|
|
5
5
|
The MCP server enables AI assistants and agents to interact with your Bkper books through a standardized protocol.
|
|
6
6
|
|
|
@@ -13,37 +13,45 @@ The MCP server enables AI assistants and agents to interact with your Bkper book
|
|
|
13
13
|
```
|
|
14
14
|
npm i bkper
|
|
15
15
|
```
|
|
16
|
+
|
|
16
17
|
or
|
|
18
|
+
|
|
17
19
|
```
|
|
18
20
|
yarn add bkper
|
|
19
21
|
```
|
|
22
|
+
|
|
20
23
|
or
|
|
24
|
+
|
|
21
25
|
```
|
|
22
26
|
bun add bkper
|
|
23
27
|
```
|
|
24
28
|
|
|
25
|
-
Optionally, you can install it globally to be able to use the
|
|
29
|
+
Optionally, you can install it globally to be able to use the `bkper` command line utility:
|
|
26
30
|
|
|
27
31
|
```
|
|
28
32
|
npm i -g bkper
|
|
29
33
|
```
|
|
34
|
+
|
|
30
35
|
or
|
|
36
|
+
|
|
31
37
|
```
|
|
32
38
|
yarn global add bkper
|
|
33
39
|
```
|
|
34
40
|
|
|
35
41
|
## Commands
|
|
36
42
|
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
43
|
+
- `login` - Logs the user in. Saves the client credentials to a `~/.config/bkper/.bkper-credentials.json` file.
|
|
44
|
+
- `logout` - Logs out the user by deleting client credentials.
|
|
45
|
+
- `mcp start` - Start the Bkper MCP (Model Context Protocol) server.
|
|
46
|
+
- `app -c` - Create a new App based on `./bkperapp.yaml` file.
|
|
47
|
+
- `app -u` - Update an existing App based on `./bkperapp.yaml` file.
|
|
42
48
|
|
|
43
49
|
### Examples
|
|
50
|
+
|
|
44
51
|
```
|
|
45
52
|
npm bkper login
|
|
46
53
|
```
|
|
54
|
+
|
|
47
55
|
```
|
|
48
56
|
yarn bkper login
|
|
49
57
|
```
|
|
@@ -68,6 +76,7 @@ The server runs on stdio and provides the following tools:
|
|
|
68
76
|
#### Prerequisites
|
|
69
77
|
|
|
70
78
|
Before using the MCP server:
|
|
79
|
+
|
|
71
80
|
1. Login using `bkper login` to set up authentication
|
|
72
81
|
2. Enable the [Bkper REST API]
|
|
73
82
|
3. Ensure the `BKPER_API_KEY` environment variable is set.
|
|
@@ -79,6 +88,7 @@ The MCP server uses the same authentication as the CLI, reading credentials from
|
|
|
79
88
|
##### Claude Desktop
|
|
80
89
|
|
|
81
90
|
Add to your configuration file:
|
|
91
|
+
|
|
82
92
|
- **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
83
93
|
- **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
84
94
|
|
|
@@ -99,6 +109,7 @@ Add to your configuration file:
|
|
|
99
109
|
##### Other MCP Clients
|
|
100
110
|
|
|
101
111
|
For other MCP-compatible clients, configure them to run:
|
|
112
|
+
|
|
102
113
|
```bash
|
|
103
114
|
BKPER_API_KEY=your-api-key npx bkper mcp start
|
|
104
115
|
```
|
|
@@ -108,6 +119,7 @@ The server communicates via stdio, so any MCP client that supports stdio transpo
|
|
|
108
119
|
#### Available MCP Tools
|
|
109
120
|
|
|
110
121
|
Once connected, the MCP client can:
|
|
122
|
+
|
|
111
123
|
- List your Bkper books
|
|
112
124
|
- Get account balances for any date or period
|
|
113
125
|
- Search and filter transactions
|
|
@@ -115,18 +127,17 @@ Once connected, the MCP client can:
|
|
|
115
127
|
|
|
116
128
|
For more information about the Model Context Protocol, visit [modelcontextprotocol.io](https://modelcontextprotocol.io).
|
|
117
129
|
|
|
118
|
-
|
|
119
|
-
|
|
120
130
|
## Apps and Bots
|
|
121
131
|
|
|
122
132
|
### Environment Variables
|
|
133
|
+
|
|
123
134
|
The following environment variable is necessary in order to communicate with the [Bkper REST API]:
|
|
124
135
|
|
|
125
136
|
```
|
|
126
137
|
BKPER_API_KEY=XXXX
|
|
127
138
|
```
|
|
128
139
|
|
|
129
|
-
The
|
|
140
|
+
The `app` command also uses the following variables in order to perform App create/update operations:
|
|
130
141
|
|
|
131
142
|
```
|
|
132
143
|
BKPER_CLIENT_SECRET=YYYY
|
|
@@ -134,16 +145,14 @@ BKPER_USER_EMAILS="someone@gmail.com anotherone@altrostat.com"
|
|
|
134
145
|
BKPER_DEVELOPER_EMAIL=somedeveloer@mycompany.com
|
|
135
146
|
```
|
|
136
147
|
|
|
137
|
-
You can add a
|
|
148
|
+
You can add a `.env` file at the root of your project with those variables and bkper will automatically load from it.
|
|
138
149
|
Follow [these](https://bkper.com/docs/#rest-api-enabling) steps in order to configure a valid Bkper API key.
|
|
139
150
|
|
|
140
151
|
> WARNING: Never upload variables to the source code repository.
|
|
141
152
|
|
|
142
|
-
|
|
143
|
-
### ```./bkperapp.yaml``` Reference
|
|
153
|
+
### `./bkperapp.yaml` Reference
|
|
144
154
|
|
|
145
155
|
```yaml
|
|
146
|
-
|
|
147
156
|
# BASIC APP CONFIGURATION
|
|
148
157
|
|
|
149
158
|
# The agent id of the App or Bot. It can NOT be changed after the App or Bot is created.
|
|
@@ -158,8 +167,6 @@ logoUrl: https://static.thenounproject.com/png/2318500-200.png
|
|
|
158
167
|
# The logo url to be used when in dark mode
|
|
159
168
|
logoUrlDark: https://static.thenounproject.com/png/2318500-200.png
|
|
160
169
|
|
|
161
|
-
|
|
162
|
-
|
|
163
170
|
# CONTEXT MENU CONFIGURATION
|
|
164
171
|
|
|
165
172
|
# The menu production url to open in the popup window. See accepted expressions bellow.
|
|
@@ -174,20 +181,12 @@ menuText: Open My Custom App
|
|
|
174
181
|
menuPopupWidth: 500 # width in pixels. Default to 80% of screen width.
|
|
175
182
|
menuPopupHeight: 300 # height in pixels. Default to 90% of screen height.
|
|
176
183
|
|
|
177
|
-
|
|
178
|
-
#ASSISTANT CONFIGURATION
|
|
179
|
-
|
|
180
|
-
# The conversation url to be called by Bkper when a new conversation message is added
|
|
181
|
-
conversationUrl: https://us-central1-bkper-tax-trigger.cloudfunctions.net/chat
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
184
|
# BOT EVENTS CONFIGURATION
|
|
186
185
|
|
|
187
186
|
# The webhook url to be called by Bkper when an event occurs.
|
|
188
187
|
webhookUrl: https://us-central1-bkper-tax-trigger.cloudfunctions.net/events
|
|
189
188
|
|
|
190
|
-
# The events the Bot is capable of processing by the webhook.
|
|
189
|
+
# The events the Bot is capable of processing by the webhook.
|
|
191
190
|
# This is optional and, if not specified, no events will be processed.
|
|
192
191
|
events:
|
|
193
192
|
- "TRANSACTION_POSTED"
|
|
@@ -211,7 +210,6 @@ filePatterns:
|
|
|
211
210
|
- "-*.qif"
|
|
212
211
|
- "*.csv"
|
|
213
212
|
|
|
214
|
-
|
|
215
213
|
# Schema to provide autocompletion on properties editor.
|
|
216
214
|
propertiesSchema:
|
|
217
215
|
book:
|
|
@@ -242,19 +240,18 @@ propertiesSchema:
|
|
|
242
240
|
values:
|
|
243
241
|
- "value2"
|
|
244
242
|
- "value2"
|
|
245
|
-
|
|
246
243
|
```
|
|
247
244
|
|
|
248
245
|
#### Accepted expressions in menuUrl property:
|
|
249
246
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
247
|
+
- `${book.id}` - the current book id
|
|
248
|
+
- `${book.properties.xxxxx}` - any property value from the current book
|
|
249
|
+
- `${transactions.query}` - the current query being executed on transactions list
|
|
250
|
+
- `${transactions.ids}` - the ids of selected transactions, splitted by comma
|
|
251
|
+
- `${account.id}` - the current account being filterd
|
|
252
|
+
- `${account.properties.xxxxx}` - any property value from the current account being filtered
|
|
253
|
+
- `${group.id}` - the current group being filterd
|
|
254
|
+
- `${group.properties.xxxxx}` - any property value from the current group being filtered
|
|
258
255
|
|
|
259
256
|
#### Example:
|
|
260
257
|
|
|
@@ -264,20 +261,19 @@ propertiesSchema:
|
|
|
264
261
|
|
|
265
262
|
#### Library
|
|
266
263
|
|
|
267
|
-
The
|
|
264
|
+
The `getOAuthToken` returns a Promise that resolves to a valid OAuth token, to be used by the [`bkper-js`](https://github.com/bkper/bkper-js) library
|
|
268
265
|
|
|
269
266
|
Example:
|
|
270
267
|
|
|
271
268
|
```javascript
|
|
272
|
-
import { Bkper } from
|
|
273
|
-
import { getOAuthToken } from
|
|
269
|
+
import { Bkper } from "bkper-js";
|
|
270
|
+
import { getOAuthToken } from "bkper";
|
|
274
271
|
|
|
275
272
|
Bkper.setConfig({
|
|
276
273
|
oauthTokenProvider: async () => getOAuthToken(),
|
|
277
|
-
})
|
|
274
|
+
});
|
|
278
275
|
```
|
|
279
276
|
|
|
280
277
|
## Documentation
|
|
281
278
|
|
|
282
279
|
- [Developer Docs](https://bkper.com/docs)
|
|
283
|
-
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_transactions.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/list_transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,oCAAoC,CAAC;AAGzF,UAAU,sBAAsB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAUD,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,
|
|
1
|
+
{"version":3,"file":"list_transactions.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/list_transactions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,oCAAoC,CAAC;AAGzF,UAAU,sBAAsB;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAUD,wBAAsB,sBAAsB,CAAC,MAAM,EAAE,sBAAsB,GAAG,OAAO,CAAC,cAAc,CAAC,CAuFpG;AAED,eAAO,MAAM,8BAA8B;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2B1C,CAAC"}
|
|
@@ -7,6 +7,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
11
|
+
var t = {};
|
|
12
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
13
|
+
t[p] = s[p];
|
|
14
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
15
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
16
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
17
|
+
t[p[i]] = s[p[i]];
|
|
18
|
+
}
|
|
19
|
+
return t;
|
|
20
|
+
};
|
|
10
21
|
import { ErrorCode, McpError } from '@modelcontextprotocol/sdk/types.js';
|
|
11
22
|
import { getBkperInstance } from '../bkper-factory.js';
|
|
12
23
|
export function handleListTransactions(params) {
|
|
@@ -32,7 +43,10 @@ export function handleListTransactions(params) {
|
|
|
32
43
|
const transactionList = yield book.listTransactions(params.query, limit, params.cursor);
|
|
33
44
|
// Get transactions from list
|
|
34
45
|
const transactionItems = transactionList.getItems();
|
|
35
|
-
const transactions = transactionItems.map((transaction) =>
|
|
46
|
+
const transactions = transactionItems.map((transaction) => {
|
|
47
|
+
const _a = transaction.json(), { agentId, agentName, agentLogo, agentLogoDark, createdAt, createdBy, updatedAt, dateValue } = _a, cleanTransaction = __rest(_a, ["agentId", "agentName", "agentLogo", "agentLogoDark", "createdAt", "createdBy", "updatedAt", "dateValue"]);
|
|
48
|
+
return cleanTransaction;
|
|
49
|
+
});
|
|
36
50
|
// Get pagination info from list
|
|
37
51
|
const hasMore = transactionItems.length > 0;
|
|
38
52
|
const nextCursor = transactionList.getCursor() || null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list_transactions.js","sourceRoot":"","sources":["../../../src/mcp/tools/list_transactions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"list_transactions.js","sourceRoot":"","sources":["../../../src/mcp/tools/list_transactions.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACzF,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAiBvD,MAAM,UAAgB,sBAAsB,CAAC,MAA8B;;QACzE,IAAI,CAAC;YACH,+BAA+B;YAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC;gBACnB,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,aAAa,EACvB,oCAAoC,CACrC,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBAClB,MAAM,IAAI,QAAQ,CAChB,SAAS,CAAC,aAAa,EACvB,mCAAmC,CACpC,CAAC;YACJ,CAAC;YAED,gCAAgC;YAChC,MAAM,aAAa,GAAG,gBAAgB,EAAE,CAAC;YAEzC,qBAAqB;YACrB,MAAM,IAAI,GAAG,MAAM,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YACx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