@tenkeybridge/mcp 0.8.0 → 0.9.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/dist/cli.js +60 -24
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +62 -25
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -5
- package/dist/index.d.ts +14 -5
- package/dist/index.js +60 -24
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -32,7 +32,8 @@ __export(index_exports, {
|
|
|
32
32
|
registerResources: () => registerResources,
|
|
33
33
|
registerTools: () => registerTools,
|
|
34
34
|
resolveCatalog: () => resolveCatalog,
|
|
35
|
-
resolveEntityName: () => resolveEntityName
|
|
35
|
+
resolveEntityName: () => resolveEntityName,
|
|
36
|
+
toolVisible: () => toolVisible
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(index_exports);
|
|
38
39
|
|
|
@@ -4017,6 +4018,36 @@ function registerResources(server) {
|
|
|
4017
4018
|
// src/tools.ts
|
|
4018
4019
|
var import_client2 = require("@tenkeybridge/client");
|
|
4019
4020
|
var import_zod = require("zod");
|
|
4021
|
+
|
|
4022
|
+
// src/access.ts
|
|
4023
|
+
var NEEDS = {
|
|
4024
|
+
query: { op: "read" },
|
|
4025
|
+
get: { op: "read" },
|
|
4026
|
+
create: { op: "create" },
|
|
4027
|
+
update: { op: "update" },
|
|
4028
|
+
delete: { op: "delete" },
|
|
4029
|
+
void: { op: "void" },
|
|
4030
|
+
run_report: { op: "read", entity: "Report" },
|
|
4031
|
+
get_cleared_status: { op: "read", entity: "ClearedStatus" },
|
|
4032
|
+
set_cleared_status: { op: "update", entity: "ClearedStatus" }
|
|
4033
|
+
};
|
|
4034
|
+
function layerAllows(rules, op, entity) {
|
|
4035
|
+
return rules.some((r) => {
|
|
4036
|
+
if (!r.ops.includes(op)) return false;
|
|
4037
|
+
if (!entity) return true;
|
|
4038
|
+
return r.entity === "*" || r.entity === entity;
|
|
4039
|
+
});
|
|
4040
|
+
}
|
|
4041
|
+
function toolVisible(access, tool) {
|
|
4042
|
+
if (!access) return true;
|
|
4043
|
+
const need = NEEDS[tool];
|
|
4044
|
+
if (!need) return true;
|
|
4045
|
+
if (!layerAllows(access.rules, need.op, need.entity)) return false;
|
|
4046
|
+
if (access.companyRules && !layerAllows(access.companyRules, need.op, need.entity)) return false;
|
|
4047
|
+
return true;
|
|
4048
|
+
}
|
|
4049
|
+
|
|
4050
|
+
// src/tools.ts
|
|
4020
4051
|
function ok(result) {
|
|
4021
4052
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
4022
4053
|
}
|
|
@@ -4032,7 +4063,9 @@ function failure(err) {
|
|
|
4032
4063
|
code: err.code,
|
|
4033
4064
|
message: err.message,
|
|
4034
4065
|
fixes: err.tkb?.fixes,
|
|
4035
|
-
docsUrl: err.tkb?.docsUrl
|
|
4066
|
+
docsUrl: err.tkb?.docsUrl,
|
|
4067
|
+
...err.code === "SCOPE_DENIED" ? { hint: "This credential is restricted. Ask the owner of this OAuth app to widen its access in the TenkeyBridge portal. Do not retry." } : {},
|
|
4068
|
+
...err.code === "IP_NOT_ALLOWED" ? { hint: "This OAuth app only accepts calls from certain IP addresses and this server is not one of them. Ask the owner to add this server's public address under Allowed IP addresses in the TenkeyBridge portal. Do not retry or re-authorize." } : {}
|
|
4036
4069
|
},
|
|
4037
4070
|
null,
|
|
4038
4071
|
2
|
|
@@ -4067,9 +4100,12 @@ function readOnly(name) {
|
|
|
4067
4100
|
`${name} is read-only through TenkeyBridge (write: ${import_client2.ENTITIES[name].write}).` + (entry ? ` ${entry.headline}` : "") + ` Detail: compat://entity/${name.toLowerCase()}`
|
|
4068
4101
|
);
|
|
4069
4102
|
}
|
|
4070
|
-
function registerTools(server, client) {
|
|
4103
|
+
function registerTools(server, client, access) {
|
|
4104
|
+
const hide = (name, tool) => {
|
|
4105
|
+
if (!toolVisible(access, name)) tool.disable();
|
|
4106
|
+
};
|
|
4071
4107
|
const entityArg = import_zod.z.string().describe('Entity name, e.g. "Invoice" or "Customer" (case-insensitive). See compat://catalog.');
|
|
4072
|
-
server.registerTool(
|
|
4108
|
+
hide("query", server.registerTool(
|
|
4073
4109
|
"query",
|
|
4074
4110
|
{
|
|
4075
4111
|
description: "Run a QBO-style query against the connected QuickBooks Desktop company file. Supports AND-joined WHERE conditions (=, !=, <, >, <=, >=, IN, LIKE; no OR) plus startPosition/maxResults paging. Check the compat://catalog resource for entity support first.",
|
|
@@ -4093,8 +4129,8 @@ function registerTools(server, client) {
|
|
|
4093
4129
|
return failure(err);
|
|
4094
4130
|
}
|
|
4095
4131
|
}
|
|
4096
|
-
);
|
|
4097
|
-
server.registerTool(
|
|
4132
|
+
));
|
|
4133
|
+
hide("run_report", server.registerTool(
|
|
4098
4134
|
"run_report",
|
|
4099
4135
|
{
|
|
4100
4136
|
description: "Run a QuickBooks Desktop report and get QBO-style report JSON (Header, Columns, Rows). Report names are QBO names such as ProfitAndLoss, BalanceSheet or CashFlow, plus Desktop extension reports. Params use QBO names, e.g. start_date, end_date, date_macro, accounting_method, summarize_column_by, customer, vendor, item, class, account, account_type, transaction_type, columns, report_date, start_moddate, end_moddate. BudgetOverview and BudgetVsActuals take fiscal_year instead of dates; MissingChecks requires account, and JobProfitabilityDetail and JobEstimatesVsActualsDetail require customer. ClassSales gives income by class; TransactionListWithSplits lists every split line. Read compat://entity/reports for the available reports and which params each takes.",
|
|
@@ -4111,8 +4147,8 @@ function registerTools(server, client) {
|
|
|
4111
4147
|
return failure(err);
|
|
4112
4148
|
}
|
|
4113
4149
|
}
|
|
4114
|
-
);
|
|
4115
|
-
server.registerTool(
|
|
4150
|
+
));
|
|
4151
|
+
hide("get", server.registerTool(
|
|
4116
4152
|
"get",
|
|
4117
4153
|
{
|
|
4118
4154
|
description: "Fetch one entity by Id (singletons like CompanyInfo and Preferences need no id).",
|
|
@@ -4134,8 +4170,8 @@ function registerTools(server, client) {
|
|
|
4134
4170
|
return failure(err);
|
|
4135
4171
|
}
|
|
4136
4172
|
}
|
|
4137
|
-
);
|
|
4138
|
-
server.registerTool(
|
|
4173
|
+
));
|
|
4174
|
+
hide("create", server.registerTool(
|
|
4139
4175
|
"create",
|
|
4140
4176
|
{
|
|
4141
4177
|
description: "Create an entity from QBO-shaped JSON (same payloads as the QuickBooks Online API). Check compat://entity/{name} for field support first.",
|
|
@@ -4154,8 +4190,8 @@ function registerTools(server, client) {
|
|
|
4154
4190
|
return failure(err);
|
|
4155
4191
|
}
|
|
4156
4192
|
}
|
|
4157
|
-
);
|
|
4158
|
-
server.registerTool(
|
|
4193
|
+
));
|
|
4194
|
+
hide("update", server.registerTool(
|
|
4159
4195
|
"update",
|
|
4160
4196
|
{
|
|
4161
4197
|
description: "Sparse-update an entity: payload must include Id plus only the fields to change.",
|
|
@@ -4177,8 +4213,8 @@ function registerTools(server, client) {
|
|
|
4177
4213
|
return failure(err);
|
|
4178
4214
|
}
|
|
4179
4215
|
}
|
|
4180
|
-
);
|
|
4181
|
-
server.registerTool(
|
|
4216
|
+
));
|
|
4217
|
+
hide("delete", server.registerTool(
|
|
4182
4218
|
"delete",
|
|
4183
4219
|
{
|
|
4184
4220
|
description: "Delete an entity by Id (SyncToken optional, as in QBO).",
|
|
@@ -4198,8 +4234,8 @@ function registerTools(server, client) {
|
|
|
4198
4234
|
return failure(err);
|
|
4199
4235
|
}
|
|
4200
4236
|
}
|
|
4201
|
-
);
|
|
4202
|
-
server.registerTool(
|
|
4237
|
+
));
|
|
4238
|
+
hide("void", server.registerTool(
|
|
4203
4239
|
"void",
|
|
4204
4240
|
{
|
|
4205
4241
|
description: 'Void a transaction by Id + SyncToken (QBO ?operation=void). Supported: Invoice, SalesReceipt, Purchase, BillPayment, and as TenkeyBridge extensions Bill, VendorCredit, Deposit, JournalEntry, InventoryAdjustment. Destructive: on QuickBooks Desktop the record stays but its totals are zeroed and its memo is prefixed "VOID:". Returns the post-void record. Fetch the current SyncToken with the get tool first.',
|
|
@@ -4222,9 +4258,9 @@ function registerTools(server, client) {
|
|
|
4222
4258
|
return failure(err);
|
|
4223
4259
|
}
|
|
4224
4260
|
}
|
|
4225
|
-
);
|
|
4261
|
+
));
|
|
4226
4262
|
const CLEARED_NEEDS = "This TenkeyBridge client has no cleared status methods; upgrade @tenkeybridge/client to 0.8.0.";
|
|
4227
|
-
server.registerTool(
|
|
4263
|
+
hide("set_cleared_status", server.registerTool(
|
|
4228
4264
|
"set_cleared_status",
|
|
4229
4265
|
{
|
|
4230
4266
|
description: "Set QuickBooks Desktop's cleared status (Cleared, NotCleared, Pending) on an existing Purchase (check), Deposit, BillPayment (check) or JournalEntry. A TenkeyBridge extension (QBO has no equivalent). With only the transaction id it sets the transaction's own bank/card side (a journal entry's first line); with line_id it sets that one line's account side, which must be a bank or other balance sheet account other than A/R and A/P (an expense or income line is refused). A Transfer cannot be cleared through the API. Setting a status is idempotent, so retrying is safe; pass request_id (and txn_type) for replay protection. Use get_cleared_status to confirm what stuck.",
|
|
@@ -4247,8 +4283,8 @@ function registerTools(server, client) {
|
|
|
4247
4283
|
return failure(err);
|
|
4248
4284
|
}
|
|
4249
4285
|
}
|
|
4250
|
-
);
|
|
4251
|
-
server.registerTool(
|
|
4286
|
+
));
|
|
4287
|
+
hide("get_cleared_status", server.registerTool(
|
|
4252
4288
|
"get_cleared_status",
|
|
4253
4289
|
{
|
|
4254
4290
|
description: "Read the cleared status of each bank / balance sheet split of one transaction (Purchase, Deposit, BillPayment, JournalEntry, or Transfer). Costs one extra bounded QuickBooks read (the transaction's own accounts on its own date). Each split has Role, LineId (to send to set_cleared_status) and ClearedStatus; SetByTxnId marks the split a set without line_id would change. Other values QuickBooks reports (such as a reconciled state) are passed through as it spells them.",
|
|
@@ -4265,17 +4301,17 @@ function registerTools(server, client) {
|
|
|
4265
4301
|
return failure(err);
|
|
4266
4302
|
}
|
|
4267
4303
|
}
|
|
4268
|
-
);
|
|
4304
|
+
));
|
|
4269
4305
|
}
|
|
4270
4306
|
|
|
4271
4307
|
// src/version.ts
|
|
4272
|
-
var PKG_VERSION = "0.
|
|
4308
|
+
var PKG_VERSION = "0.9.0";
|
|
4273
4309
|
|
|
4274
4310
|
// src/server.ts
|
|
4275
4311
|
var SERVER_NAME = "tenkeybridge";
|
|
4276
|
-
function buildServer(client) {
|
|
4312
|
+
function buildServer(client, access) {
|
|
4277
4313
|
const server = new import_mcp2.McpServer({ name: SERVER_NAME, version: PKG_VERSION });
|
|
4278
|
-
registerTools(server, client);
|
|
4314
|
+
registerTools(server, client, access);
|
|
4279
4315
|
registerResources(server);
|
|
4280
4316
|
return server;
|
|
4281
4317
|
}
|
|
@@ -4357,6 +4393,7 @@ function persistRefreshToken(file, refreshToken) {
|
|
|
4357
4393
|
registerResources,
|
|
4358
4394
|
registerTools,
|
|
4359
4395
|
resolveCatalog,
|
|
4360
|
-
resolveEntityName
|
|
4396
|
+
resolveEntityName,
|
|
4397
|
+
toolVisible
|
|
4361
4398
|
});
|
|
4362
4399
|
//# sourceMappingURL=index.cjs.map
|