bkper 3.6.0 → 3.7.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 +13 -0
- package/lib/cli.js +93 -41
- package/lib/cli.js.map +1 -1
- package/lib/commands/apps.d.ts +20 -0
- package/lib/commands/apps.d.ts.map +1 -0
- package/lib/commands/apps.js +101 -0
- package/lib/commands/apps.js.map +1 -0
- package/lib/mcp/bkper-factory.d.ts +6 -0
- package/lib/mcp/bkper-factory.d.ts.map +1 -1
- package/lib/mcp/bkper-factory.js +8 -1
- package/lib/mcp/bkper-factory.js.map +1 -1
- package/package.json +5 -4
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
## 2025
|
|
4
4
|
|
|
5
|
+
### **October 2025**
|
|
6
|
+
|
|
7
|
+
**MCP Server**
|
|
8
|
+
- Added smart transaction merging - combine multiple transactions intelligently based on date and account matching
|
|
9
|
+
- Simplified transaction creation - accounts are now optional, making it easier to record simple income and expenses
|
|
10
|
+
- Improved transaction data responses for better AI assistant integration
|
|
11
|
+
|
|
12
|
+
### **September 2025**
|
|
13
|
+
|
|
14
|
+
**MCP Server**
|
|
15
|
+
- Streamlined transaction data for cleaner AI assistant responses
|
|
16
|
+
- Fixed credential storage to follow standard configuration directories
|
|
17
|
+
|
|
5
18
|
### **July 2025**
|
|
6
19
|
|
|
7
20
|
**MCP Server**
|
package/lib/cli.js
CHANGED
|
@@ -8,75 +8,127 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import dotenv from 'dotenv';
|
|
17
|
-
import { setupBkper } from './mcp/bkper-factory.js';
|
|
11
|
+
import program from "commander";
|
|
12
|
+
import { login, logout } from "./auth/local-auth-service.js";
|
|
13
|
+
import { setupBkper } from "./mcp/bkper-factory.js";
|
|
14
|
+
import { listApps, createApp, updateApp } from "./commands/apps.js";
|
|
15
|
+
import dotenv from "dotenv";
|
|
18
16
|
dotenv.config();
|
|
19
17
|
program
|
|
20
|
-
.command(
|
|
21
|
-
.description(
|
|
18
|
+
.command("login")
|
|
19
|
+
.description("Login Bkper")
|
|
22
20
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
21
|
yield login();
|
|
24
22
|
}));
|
|
25
23
|
program
|
|
26
|
-
.command(
|
|
27
|
-
.description(
|
|
28
|
-
.action((
|
|
24
|
+
.command("logout")
|
|
25
|
+
.description("Logout Bkper")
|
|
26
|
+
.action(() => {
|
|
29
27
|
logout();
|
|
30
28
|
});
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
.
|
|
35
|
-
.
|
|
36
|
-
.action((
|
|
29
|
+
// New 'apps' command group (plural, standard)
|
|
30
|
+
const appsCommand = program.command("apps").description("Manage Bkper Apps");
|
|
31
|
+
appsCommand
|
|
32
|
+
.command("list")
|
|
33
|
+
.description("List all apps you have access to")
|
|
34
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
37
35
|
try {
|
|
38
36
|
setupBkper();
|
|
39
|
-
|
|
40
|
-
if (
|
|
41
|
-
|
|
37
|
+
const apps = yield listApps();
|
|
38
|
+
if (apps.length === 0) {
|
|
39
|
+
console.log("No apps found.");
|
|
40
|
+
return;
|
|
42
41
|
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
42
|
+
// Table-style output
|
|
43
|
+
console.log("\nApps:\n");
|
|
44
|
+
console.log("ID".padEnd(25) + "Name".padEnd(30) + "Published");
|
|
45
|
+
console.log("-".repeat(65));
|
|
46
|
+
for (const app of apps) {
|
|
47
|
+
const id = (app.id || "").padEnd(25);
|
|
48
|
+
const name = (app.name || "").padEnd(30);
|
|
49
|
+
const published = app.published ? "Yes" : "No";
|
|
50
|
+
console.log(`${id}${name}${published}`);
|
|
48
51
|
}
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
console.log(`\nTotal: ${apps.length} app(s)`);
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
console.error("Error listing apps:", err);
|
|
56
|
+
process.exit(1);
|
|
57
|
+
}
|
|
58
|
+
}));
|
|
59
|
+
appsCommand
|
|
60
|
+
.command("create")
|
|
61
|
+
.description("Create a new App from bkperapp.json or bkperapp.yaml")
|
|
62
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
63
|
+
try {
|
|
64
|
+
setupBkper();
|
|
65
|
+
const app = yield createApp();
|
|
66
|
+
console.log(`Created ${app.getId()} successfully.`);
|
|
67
|
+
}
|
|
68
|
+
catch (err) {
|
|
69
|
+
console.error("Error creating app:", err);
|
|
70
|
+
process.exit(1);
|
|
71
|
+
}
|
|
72
|
+
}));
|
|
73
|
+
appsCommand
|
|
74
|
+
.command("update")
|
|
75
|
+
.description("Update an existing App from bkperapp.json or bkperapp.yaml")
|
|
76
|
+
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
77
|
+
try {
|
|
78
|
+
setupBkper();
|
|
79
|
+
const app = yield updateApp();
|
|
80
|
+
console.log(`Updated ${app.getId()} successfully.`);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
console.error("Error updating app:", err);
|
|
84
|
+
process.exit(1);
|
|
85
|
+
}
|
|
86
|
+
}));
|
|
87
|
+
// Legacy 'app' command (singular, deprecated but backward compatible)
|
|
88
|
+
program
|
|
89
|
+
.command("app")
|
|
90
|
+
.description("[Deprecated] Use 'apps create' or 'apps update' instead")
|
|
91
|
+
.option("-u, --update", "Update the App")
|
|
92
|
+
.option("-c, --create", "Create a new App")
|
|
93
|
+
.action((options) => __awaiter(void 0, void 0, void 0, function* () {
|
|
94
|
+
try {
|
|
95
|
+
setupBkper();
|
|
54
96
|
if (options.update) {
|
|
55
|
-
app
|
|
56
|
-
|
|
97
|
+
console.warn("Warning: 'bkper app -u' is deprecated. Use 'bkper apps update' instead.\n");
|
|
98
|
+
const app = yield updateApp();
|
|
99
|
+
console.log(`Updated ${app.getId()} successfully.`);
|
|
57
100
|
}
|
|
58
101
|
else if (options.create) {
|
|
59
|
-
app
|
|
60
|
-
|
|
102
|
+
console.warn("Warning: 'bkper app -c' is deprecated. Use 'bkper apps create' instead.\n");
|
|
103
|
+
const app = yield createApp();
|
|
104
|
+
console.log(`Created ${app.getId()} successfully.`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log("Usage: bkper app -c (create) or bkper app -u (update)");
|
|
108
|
+
console.log("\nNote: This command is deprecated. Use 'bkper apps <command>' instead:");
|
|
109
|
+
console.log(" bkper apps list - List all apps");
|
|
110
|
+
console.log(" bkper apps create - Create a new app");
|
|
111
|
+
console.log(" bkper apps update - Update an existing app");
|
|
61
112
|
}
|
|
62
113
|
}
|
|
63
114
|
catch (err) {
|
|
64
|
-
console.
|
|
115
|
+
console.error("Error:", err);
|
|
116
|
+
process.exit(1);
|
|
65
117
|
}
|
|
66
118
|
}));
|
|
67
|
-
const mcpCommand = program.command(
|
|
119
|
+
const mcpCommand = program.command("mcp").description("Bkper MCP server commands");
|
|
68
120
|
mcpCommand
|
|
69
|
-
.command(
|
|
70
|
-
.description(
|
|
121
|
+
.command("start")
|
|
122
|
+
.description("Start Bkper MCP server")
|
|
71
123
|
.action(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
72
124
|
try {
|
|
73
125
|
// Import and start the MCP server directly
|
|
74
|
-
const { BkperMcpServer } = yield import(
|
|
126
|
+
const { BkperMcpServer } = yield import("./mcp/server.js");
|
|
75
127
|
const server = new BkperMcpServer();
|
|
76
128
|
yield server.run();
|
|
77
129
|
}
|
|
78
130
|
catch (err) {
|
|
79
|
-
console.error(
|
|
131
|
+
console.error("Error starting MCP server:", err);
|
|
80
132
|
process.exit(1);
|
|
81
133
|
}
|
|
82
134
|
}));
|
package/lib/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;;;;;AAEA,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEpE,OAAO,MAAM,MAAM,QAAQ,CAAC;AAC5B,MAAM,CAAC,MAAM,EAAE,CAAC;AAEhB,OAAO;KACF,OAAO,CAAC,OAAO,CAAC;KAChB,WAAW,CAAC,aAAa,CAAC;KAC1B,MAAM,CAAC,GAAS,EAAE;IACf,MAAM,KAAK,EAAE,CAAC;AAClB,CAAC,CAAA,CAAC,CAAC;AAEP,OAAO;KACF,OAAO,CAAC,QAAQ,CAAC;KACjB,WAAW,CAAC,cAAc,CAAC;KAC3B,MAAM,CAAC,GAAG,EAAE;IACT,MAAM,EAAE,CAAC;AACb,CAAC,CAAC,CAAC;AAEP,8CAA8C;AAC9C,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;AAE7E,WAAW;KACN,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,kCAAkC,CAAC;KAC/C,MAAM,CAAC,GAAS,EAAE;IACf,IAAI,CAAC;QACD,UAAU,EAAE,CAAC;QACb,MAAM,IAAI,GAAG,MAAM,QAAQ,EAAE,CAAC;QAE9B,IAA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C,KAAK,CAAC,4BAA4B,EAAE,GAAG,CAAC,CAAC;QACjD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;AACL,CAAC,CAAA,CAAC,CAAC;AAEP,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { App } from 'bkper-js';
|
|
2
|
+
/**
|
|
3
|
+
* Lists all apps the authenticated user has access to.
|
|
4
|
+
*
|
|
5
|
+
* @returns Array of app data objects
|
|
6
|
+
*/
|
|
7
|
+
export declare function listApps(): Promise<bkper.App[]>;
|
|
8
|
+
/**
|
|
9
|
+
* Creates a new app from the configuration in the current directory.
|
|
10
|
+
*
|
|
11
|
+
* @returns Created App instance
|
|
12
|
+
*/
|
|
13
|
+
export declare function createApp(): Promise<App>;
|
|
14
|
+
/**
|
|
15
|
+
* Updates an existing app from the configuration in the current directory.
|
|
16
|
+
*
|
|
17
|
+
* @returns Updated App instance
|
|
18
|
+
*/
|
|
19
|
+
export declare function updateApp(): Promise<App>;
|
|
20
|
+
//# sourceMappingURL=apps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.d.ts","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAK/B;;;;GAIG;AACH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAIrD;AAyDD;;;;GAIG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAI9C;AAED;;;;GAIG;AACH,wBAAsB,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,CAI9C"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
import { App } from 'bkper-js';
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import * as YAML from 'yaml';
|
|
13
|
+
import { getBkperInstance } from '../mcp/bkper-factory.js';
|
|
14
|
+
/**
|
|
15
|
+
* Lists all apps the authenticated user has access to.
|
|
16
|
+
*
|
|
17
|
+
* @returns Array of app data objects
|
|
18
|
+
*/
|
|
19
|
+
export function listApps() {
|
|
20
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21
|
+
const bkper = getBkperInstance();
|
|
22
|
+
const apps = yield bkper.getApps();
|
|
23
|
+
return apps.map(app => app.json());
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Loads app configuration from bkperapp.json or bkperapp.yaml in current directory.
|
|
28
|
+
*
|
|
29
|
+
* @returns App configuration object
|
|
30
|
+
* @throws Error if no config file is found
|
|
31
|
+
*/
|
|
32
|
+
function loadAppConfig() {
|
|
33
|
+
if (fs.existsSync('./bkperapp.json')) {
|
|
34
|
+
return JSON.parse(fs.readFileSync('./bkperapp.json', 'utf8'));
|
|
35
|
+
}
|
|
36
|
+
else if (fs.existsSync('./bkperapp.yaml')) {
|
|
37
|
+
return YAML.parse(fs.readFileSync('./bkperapp.yaml', 'utf8'));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw new Error('bkperapp.json or bkperapp.yaml not found');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Loads README.md content if it exists.
|
|
45
|
+
*
|
|
46
|
+
* @returns README content or undefined
|
|
47
|
+
*/
|
|
48
|
+
function loadReadme() {
|
|
49
|
+
if (fs.existsSync('./README.md')) {
|
|
50
|
+
return fs.readFileSync('./README.md', 'utf8');
|
|
51
|
+
}
|
|
52
|
+
return undefined;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Creates an App instance configured with environment variables.
|
|
56
|
+
*
|
|
57
|
+
* @returns Configured App instance
|
|
58
|
+
*/
|
|
59
|
+
function createConfiguredApp() {
|
|
60
|
+
const json = loadAppConfig();
|
|
61
|
+
const app = new App(json);
|
|
62
|
+
const readme = loadReadme();
|
|
63
|
+
if (readme) {
|
|
64
|
+
app.setReadme(readme);
|
|
65
|
+
}
|
|
66
|
+
if (process.env.BKPER_CLIENT_SECRET) {
|
|
67
|
+
app.setClientSecret(process.env.BKPER_CLIENT_SECRET);
|
|
68
|
+
}
|
|
69
|
+
if (process.env.BKPER_DEVELOPER_EMAIL) {
|
|
70
|
+
app.setDeveloperEmail(process.env.BKPER_DEVELOPER_EMAIL);
|
|
71
|
+
}
|
|
72
|
+
if (process.env.BKPER_USER_EMAILS) {
|
|
73
|
+
app.setUserEmails(process.env.BKPER_USER_EMAILS);
|
|
74
|
+
}
|
|
75
|
+
return app;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Creates a new app from the configuration in the current directory.
|
|
79
|
+
*
|
|
80
|
+
* @returns Created App instance
|
|
81
|
+
*/
|
|
82
|
+
export function createApp() {
|
|
83
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
+
const app = createConfiguredApp();
|
|
85
|
+
const createdApp = yield app.create();
|
|
86
|
+
return createdApp;
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Updates an existing app from the configuration in the current directory.
|
|
91
|
+
*
|
|
92
|
+
* @returns Updated App instance
|
|
93
|
+
*/
|
|
94
|
+
export function updateApp() {
|
|
95
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
96
|
+
const app = createConfiguredApp();
|
|
97
|
+
const updatedApp = yield app.update();
|
|
98
|
+
return updatedApp;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=apps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apps.js","sourceRoot":"","sources":["../../src/commands/apps.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D;;;;GAIG;AACH,MAAM,UAAgB,QAAQ;;QAC5B,MAAM,KAAK,GAAG,gBAAgB,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,OAAO,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;IACrC,CAAC;CAAA;AAED;;;;;GAKG;AACH,SAAS,aAAa;IACpB,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QACrC,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;SAAM,IAAI,EAAE,CAAC,UAAU,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC5C,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC,CAAC;IAChE,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,SAAS,UAAU;IACjB,IAAI,EAA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OAAO,UAAU,CAAC;IACpB,CAAC;CAAA"}
|
|
@@ -6,5 +6,11 @@ import { Bkper } from 'bkper-js';
|
|
|
6
6
|
* @returns Configured Bkper instance
|
|
7
7
|
*/
|
|
8
8
|
export declare function getBkperInstance(): Bkper;
|
|
9
|
+
/**
|
|
10
|
+
* Configure Bkper with authentication.
|
|
11
|
+
*
|
|
12
|
+
* If BKPER_API_KEY is set, uses direct API access (for power users with own quotas).
|
|
13
|
+
* Otherwise, bkper-js automatically uses the API proxy which injects a managed key server-side.
|
|
14
|
+
*/
|
|
9
15
|
export declare function setupBkper(): void;
|
|
10
16
|
//# sourceMappingURL=bkper-factory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bkper-factory.d.ts","sourceRoot":"","sources":["../../src/mcp/bkper-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAiBxC;AAED,wBAAgB,UAAU,
|
|
1
|
+
{"version":3,"file":"bkper-factory.d.ts","sourceRoot":"","sources":["../../src/mcp/bkper-factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AAKjC;;;;;GAKG;AACH,wBAAgB,gBAAgB,IAAI,KAAK,CAiBxC;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,SAOzB"}
|
package/lib/mcp/bkper-factory.js
CHANGED
|
@@ -31,9 +31,16 @@ export function getBkperInstance() {
|
|
|
31
31
|
configuredBkperInstance = new Bkper();
|
|
32
32
|
return configuredBkperInstance;
|
|
33
33
|
}
|
|
34
|
+
/**
|
|
35
|
+
* Configure Bkper with authentication.
|
|
36
|
+
*
|
|
37
|
+
* If BKPER_API_KEY is set, uses direct API access (for power users with own quotas).
|
|
38
|
+
* Otherwise, bkper-js automatically uses the API proxy which injects a managed key server-side.
|
|
39
|
+
*/
|
|
34
40
|
export function setupBkper() {
|
|
41
|
+
const apiKey = process.env.BKPER_API_KEY;
|
|
35
42
|
Bkper.setConfig({
|
|
36
|
-
apiKeyProvider: () => __awaiter(this, void 0, void 0, function* () { return
|
|
43
|
+
apiKeyProvider: apiKey ? () => __awaiter(this, void 0, void 0, function* () { return apiKey; }) : undefined,
|
|
37
44
|
oauthTokenProvider: () => getOAuthToken()
|
|
38
45
|
});
|
|
39
46
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bkper-factory.js","sourceRoot":"","sources":["../../src/mcp/bkper-factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,IAAI,uBAAuB,GAAsB,SAAS,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,8CAA8C;IAC9C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC;QACvE,OAAQ,UAAkB,CAAC,WAAW,IAAI,KAAK,CAAC;IAClD,CAAC;IAED,+CAA+C;IAC/C,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,sCAAsC;IACtC,UAAU,EAAE,CAAC;IACb,gCAAgC;IAChC,uBAAuB,GAAG,IAAI,KAAK,EAAE,CAAC;IAEtC,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,KAAK,CAAC,SAAS,CAAC;QACd,cAAc,EAAE,GAAS,EAAE,gDAAC,OAAA,
|
|
1
|
+
{"version":3,"file":"bkper-factory.js","sourceRoot":"","sources":["../../src/mcp/bkper-factory.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,UAAU,CAAC;AACjC,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAE9D,IAAI,uBAAuB,GAAsB,SAAS,CAAC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB;IAC9B,8CAA8C;IAC9C,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,IAAK,UAAkB,CAAC,WAAW,EAAE,CAAC;QACvE,OAAQ,UAAkB,CAAC,WAAW,IAAI,KAAK,CAAC;IAClD,CAAC;IAED,+CAA+C;IAC/C,IAAI,uBAAuB,EAAE,CAAC;QAC5B,OAAO,uBAAuB,CAAC;IACjC,CAAC;IAED,sCAAsC;IACtC,UAAU,EAAE,CAAC;IACb,gCAAgC;IAChC,uBAAuB,GAAG,IAAI,KAAK,EAAE,CAAC;IAEtC,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,UAAU;IACxB,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;IAEzC,KAAK,CAAC,SAAS,CAAC;QACd,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC,GAAS,EAAE,gDAAC,OAAA,MAAM,CAAA,GAAA,CAAC,CAAC,CAAC,SAAS;QACvD,kBAAkB,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE;KAC1C,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "bkper",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Node.js command line client for Bkper",
|
|
5
5
|
"bin": {
|
|
6
6
|
"bkper": "./lib/cli.js"
|
|
@@ -37,7 +37,8 @@
|
|
|
37
37
|
"build:copy-docs": "mkdir -p lib/docs && cp -f docs/*.md lib/docs/ 2>/dev/null || true",
|
|
38
38
|
"build:copy-mcp-assets": "mkdir -p lib/mcp && cp -f src/mcp/*.md lib/mcp/ 2>/dev/null || true",
|
|
39
39
|
"predev": "bun run build",
|
|
40
|
-
"dev": "
|
|
40
|
+
"dev": "tsc -w",
|
|
41
|
+
"dev:mcp": "concurrently -k -n cli,mcp -c blue,green \"bun run dev\" \"bun run dev:mcp\"",
|
|
41
42
|
"mcp": "bun run build && node lib/cli.js mcp start",
|
|
42
43
|
"ports": "devpod ssh ../ -L 6274",
|
|
43
44
|
"test": "TS_NODE_PROJECT=tsconfig.test.json mocha",
|
|
@@ -54,14 +55,14 @@
|
|
|
54
55
|
"dependencies": {
|
|
55
56
|
"@google-cloud/local-auth": "^3.0.1",
|
|
56
57
|
"@modelcontextprotocol/sdk": "^1.13.1",
|
|
57
|
-
"bkper-js": "^2.
|
|
58
|
+
"bkper-js": "^2.19.0",
|
|
58
59
|
"commander": "^6.2.1",
|
|
59
60
|
"dotenv": "^8.2.0",
|
|
60
61
|
"google-auth-library": "^9.14.0",
|
|
61
62
|
"yaml": "^2.5.1"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@bkper/bkper-api-types": "^5.
|
|
65
|
+
"@bkper/bkper-api-types": "^5.32.3",
|
|
65
66
|
"@types/chai": "^4.3.0",
|
|
66
67
|
"@types/mocha": "^10.0.0",
|
|
67
68
|
"@types/node": "^22.5.1",
|