@tenkeybridge/mcp 0.8.0 → 0.10.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 +166 -31
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +168 -32
- 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 +166 -31
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { QueryOptions, EntityName } from '@tenkeybridge/client';
|
|
2
|
+
import { AccessSummary, QueryOptions, EntityName } from '@tenkeybridge/client';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Should this tool be listed for a credential with this access? True when
|
|
6
|
+
* `access` is absent (older gateway: unknown means list everything). For
|
|
7
|
+
* entity-scoped tools one granting rule anywhere keeps the tool; the gateway
|
|
8
|
+
* still refuses entities outside the rule, and SCOPE_DENIED text surfaces.
|
|
9
|
+
*/
|
|
10
|
+
declare function toolVisible(access: AccessSummary | undefined, tool: string): boolean;
|
|
3
11
|
|
|
4
12
|
interface EntityAccessorLike {
|
|
5
13
|
get?(id?: string): Promise<unknown>;
|
|
@@ -31,10 +39,11 @@ type GatewayClient = Record<string, unknown> & {
|
|
|
31
39
|
txnType: string;
|
|
32
40
|
}): Promise<unknown>;
|
|
33
41
|
};
|
|
34
|
-
declare function registerTools(server: McpServer, client: GatewayClient): void;
|
|
42
|
+
declare function registerTools(server: McpServer, client: GatewayClient, access?: AccessSummary): void;
|
|
35
43
|
|
|
36
44
|
declare const SERVER_NAME = "tenkeybridge";
|
|
37
|
-
|
|
45
|
+
/** `access`: from `client.access()`; omit (or undefined) to list every tool. */
|
|
46
|
+
declare function buildServer(client: GatewayClient, access?: AccessSummary): McpServer;
|
|
38
47
|
|
|
39
48
|
declare function registerResources(server: McpServer): void;
|
|
40
49
|
|
|
@@ -88,6 +97,6 @@ declare function resolveEntityName(name: string): EntityName | undefined;
|
|
|
88
97
|
type CatalogSummaryRow = Pick<CatalogEntry, "entity" | "verdict" | "group" | "read" | "write" | "headline" | "usage">;
|
|
89
98
|
declare function catalogSummary(): CatalogSummaryRow[];
|
|
90
99
|
|
|
91
|
-
declare const PKG_VERSION = "0.
|
|
100
|
+
declare const PKG_VERSION = "0.10.0";
|
|
92
101
|
|
|
93
|
-
export { CATALOG, type CatalogEntry, type CatalogField, type CatalogSummaryRow, type CatalogUnsupported, type EntityAccessorLike, type GatewayClient, type McpAuth, type McpConfig, PKG_VERSION, SERVER_NAME, buildServer, catalogSummary, defaultTokenFile, loadConfig, persistRefreshToken, readStoredRefreshToken, registerResources, registerTools, resolveCatalog, resolveEntityName };
|
|
102
|
+
export { CATALOG, type CatalogEntry, type CatalogField, type CatalogSummaryRow, type CatalogUnsupported, type EntityAccessorLike, type GatewayClient, type McpAuth, type McpConfig, PKG_VERSION, SERVER_NAME, buildServer, catalogSummary, defaultTokenFile, loadConfig, persistRefreshToken, readStoredRefreshToken, registerResources, registerTools, resolveCatalog, resolveEntityName, toolVisible };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
-
import { QueryOptions, EntityName } from '@tenkeybridge/client';
|
|
2
|
+
import { AccessSummary, QueryOptions, EntityName } from '@tenkeybridge/client';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Should this tool be listed for a credential with this access? True when
|
|
6
|
+
* `access` is absent (older gateway: unknown means list everything). For
|
|
7
|
+
* entity-scoped tools one granting rule anywhere keeps the tool; the gateway
|
|
8
|
+
* still refuses entities outside the rule, and SCOPE_DENIED text surfaces.
|
|
9
|
+
*/
|
|
10
|
+
declare function toolVisible(access: AccessSummary | undefined, tool: string): boolean;
|
|
3
11
|
|
|
4
12
|
interface EntityAccessorLike {
|
|
5
13
|
get?(id?: string): Promise<unknown>;
|
|
@@ -31,10 +39,11 @@ type GatewayClient = Record<string, unknown> & {
|
|
|
31
39
|
txnType: string;
|
|
32
40
|
}): Promise<unknown>;
|
|
33
41
|
};
|
|
34
|
-
declare function registerTools(server: McpServer, client: GatewayClient): void;
|
|
42
|
+
declare function registerTools(server: McpServer, client: GatewayClient, access?: AccessSummary): void;
|
|
35
43
|
|
|
36
44
|
declare const SERVER_NAME = "tenkeybridge";
|
|
37
|
-
|
|
45
|
+
/** `access`: from `client.access()`; omit (or undefined) to list every tool. */
|
|
46
|
+
declare function buildServer(client: GatewayClient, access?: AccessSummary): McpServer;
|
|
38
47
|
|
|
39
48
|
declare function registerResources(server: McpServer): void;
|
|
40
49
|
|
|
@@ -88,6 +97,6 @@ declare function resolveEntityName(name: string): EntityName | undefined;
|
|
|
88
97
|
type CatalogSummaryRow = Pick<CatalogEntry, "entity" | "verdict" | "group" | "read" | "write" | "headline" | "usage">;
|
|
89
98
|
declare function catalogSummary(): CatalogSummaryRow[];
|
|
90
99
|
|
|
91
|
-
declare const PKG_VERSION = "0.
|
|
100
|
+
declare const PKG_VERSION = "0.10.0";
|
|
92
101
|
|
|
93
|
-
export { CATALOG, type CatalogEntry, type CatalogField, type CatalogSummaryRow, type CatalogUnsupported, type EntityAccessorLike, type GatewayClient, type McpAuth, type McpConfig, PKG_VERSION, SERVER_NAME, buildServer, catalogSummary, defaultTokenFile, loadConfig, persistRefreshToken, readStoredRefreshToken, registerResources, registerTools, resolveCatalog, resolveEntityName };
|
|
102
|
+
export { CATALOG, type CatalogEntry, type CatalogField, type CatalogSummaryRow, type CatalogUnsupported, type EntityAccessorLike, type GatewayClient, type McpAuth, type McpConfig, PKG_VERSION, SERVER_NAME, buildServer, catalogSummary, defaultTokenFile, loadConfig, persistRefreshToken, readStoredRefreshToken, registerResources, registerTools, resolveCatalog, resolveEntityName, toolVisible };
|
package/dist/index.js
CHANGED
|
@@ -1390,6 +1390,11 @@ var CATALOG = {
|
|
|
1390
1390
|
"support": "full",
|
|
1391
1391
|
"note": "Desktop TargetBonus, a money amount. Accepted on create and update without a payroll subscription (verified live on QuickBooks Enterprise 24, 2026-10-15); Desktop's create response omits it but reads return it."
|
|
1392
1392
|
},
|
|
1393
|
+
{
|
|
1394
|
+
"qbo": "PayrollInfo",
|
|
1395
|
+
"support": "partial",
|
|
1396
|
+
"note": "TenkeyBridge extension, read-only: Desktop's EmployeePayrollInfo as { PayPeriod, ClassRef, Earnings: [{ PayrollItemRef, Rate | RatePercent }], UseTimeDataToCreatePaychecks, SickHours, VacationHours } with hours as decimal numbers (PT40H30M0S reads 40.5). Present only when the file has a payroll subscription and the integrated app may access personal data (Edit, Preferences, Integrated Applications); otherwise absent. A create carrying PayrollInfo, or an update that changes it, answers 422 UNSUPPORTED_BY_DESKTOP; an unchanged echo on update is ignored. Not filterable."
|
|
1397
|
+
},
|
|
1393
1398
|
{
|
|
1394
1399
|
"qbo": "AdditionalContactRef",
|
|
1395
1400
|
"support": "none",
|
|
@@ -1404,9 +1409,9 @@ var CATALOG = {
|
|
|
1404
1409
|
"note": "QBO employees are deactivated, not deleted. Desktop can delete an employee with no transactions, but TenkeyBridge keeps deactivate-only to match QBO (sparse update with Active:false)."
|
|
1405
1410
|
},
|
|
1406
1411
|
{
|
|
1407
|
-
"case": "
|
|
1412
|
+
"case": "Writing payroll fields",
|
|
1408
1413
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1409
|
-
"note": "Pay
|
|
1414
|
+
"note": "Pay periods, earnings rates and sick or vacation hours are read-only (see PayrollInfo). Set them in QuickBooks Desktop."
|
|
1410
1415
|
}
|
|
1411
1416
|
]
|
|
1412
1417
|
},
|
|
@@ -2223,6 +2228,64 @@ var CATALOG = {
|
|
|
2223
2228
|
}
|
|
2224
2229
|
]
|
|
2225
2230
|
},
|
|
2231
|
+
"Paycheck": {
|
|
2232
|
+
"entity": "Paycheck",
|
|
2233
|
+
"verdict": "live",
|
|
2234
|
+
"group": "transactions",
|
|
2235
|
+
"read": "partial",
|
|
2236
|
+
"write": "none",
|
|
2237
|
+
"headline": "TenkeyBridge extension: read-only list of QuickBooks Desktop payroll paychecks (header rows: employee, bank account, date, check number, net pay). QuickBooks Online has no Paycheck entity. Needs a payroll subscription and the personal-data permission",
|
|
2238
|
+
"fields": [
|
|
2239
|
+
{
|
|
2240
|
+
"qbo": "MetaData",
|
|
2241
|
+
"support": "full",
|
|
2242
|
+
"note": "Id is Desktop's TxnID. CreateTime and LastUpdatedTime come from Desktop's TimeCreated / TimeModified. There is no SyncToken: Desktop's paycheck rows carry no EditSequence."
|
|
2243
|
+
},
|
|
2244
|
+
{
|
|
2245
|
+
"qbo": "TxnDate",
|
|
2246
|
+
"support": "full",
|
|
2247
|
+
"note": "The check date. Pushed to Desktop as a TransactionDateRangeFilter."
|
|
2248
|
+
},
|
|
2249
|
+
{
|
|
2250
|
+
"qbo": "DocNumber",
|
|
2251
|
+
"support": "full",
|
|
2252
|
+
"note": "Desktop RefNumber. Filters on it are applied by the gateway after the read."
|
|
2253
|
+
},
|
|
2254
|
+
{
|
|
2255
|
+
"qbo": "EmployeeRef",
|
|
2256
|
+
"support": "full",
|
|
2257
|
+
"note": "Desktop EntityRef, the employee. An equality filter is pushed to Desktop as a TransactionEntityFilter."
|
|
2258
|
+
},
|
|
2259
|
+
{
|
|
2260
|
+
"qbo": "BankAccountRef",
|
|
2261
|
+
"support": "full",
|
|
2262
|
+
"note": "Desktop AccountRef, the bank account the check is drawn on."
|
|
2263
|
+
},
|
|
2264
|
+
{
|
|
2265
|
+
"qbo": "NetPay",
|
|
2266
|
+
"support": "full",
|
|
2267
|
+
"note": "Desktop Amount with the sign flipped: Desktop reports money out as negative, NetPay is the positive take-home amount. Filterable, applied by the gateway."
|
|
2268
|
+
}
|
|
2269
|
+
],
|
|
2270
|
+
"unsupported": [
|
|
2271
|
+
{
|
|
2272
|
+
"case": "Earnings, taxes and deductions",
|
|
2273
|
+
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
2274
|
+
"note": "qbXML has no paycheck detail query: the paycheck list answers header rows only. Pay stub lines (earnings, taxes, deductions, hours) come from the payroll reports."
|
|
2275
|
+
},
|
|
2276
|
+
{
|
|
2277
|
+
"case": "create, update, delete or void",
|
|
2278
|
+
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
2279
|
+
"note": "Paycheck is read-only through TenkeyBridge. Paychecks are created in QuickBooks Desktop payroll.",
|
|
2280
|
+
"workaround": "Create or void the paycheck in QuickBooks Desktop (Employees, Pay Employees); it shows up on the next read."
|
|
2281
|
+
},
|
|
2282
|
+
{
|
|
2283
|
+
"case": "File without payroll",
|
|
2284
|
+
"error": "PAYROLL_SUBSCRIPTION_REQUIRED",
|
|
2285
|
+
"note": "Desktop answers status 3262 when the company file has no payroll subscription (422 PAYROLL_SUBSCRIPTION_REQUIRED), and 3261 when the integrated app lacks the personal-data permission (403 QB_PERSONAL_DATA_DENIED)."
|
|
2286
|
+
}
|
|
2287
|
+
]
|
|
2288
|
+
},
|
|
2226
2289
|
"Payment": {
|
|
2227
2290
|
"entity": "Payment",
|
|
2228
2291
|
"verdict": "live",
|
|
@@ -2351,6 +2414,43 @@ var CATALOG = {
|
|
|
2351
2414
|
}
|
|
2352
2415
|
]
|
|
2353
2416
|
},
|
|
2417
|
+
"PayrollItemWage": {
|
|
2418
|
+
"entity": "PayrollItemWage",
|
|
2419
|
+
"verdict": "live",
|
|
2420
|
+
"group": "lists",
|
|
2421
|
+
"read": "full",
|
|
2422
|
+
"write": "none",
|
|
2423
|
+
"headline": "TenkeyBridge extension: read/query the payroll wage items (Regular Pay, Overtime Pay, ...) a TimeActivity can name; QuickBooks Desktop only",
|
|
2424
|
+
"fields": [
|
|
2425
|
+
{
|
|
2426
|
+
"qbo": "Name",
|
|
2427
|
+
"support": "full",
|
|
2428
|
+
"note": "Up to 31 characters."
|
|
2429
|
+
},
|
|
2430
|
+
{
|
|
2431
|
+
"qbo": "Active",
|
|
2432
|
+
"support": "full",
|
|
2433
|
+
"note": "Queries return active items only unless you filter on Active."
|
|
2434
|
+
},
|
|
2435
|
+
{
|
|
2436
|
+
"qbo": "WageType",
|
|
2437
|
+
"support": "full",
|
|
2438
|
+
"note": "Desktop's enum string, unchanged: Bonus, Commission, HourlyOvertime, HourlyRegular, HourlySick, HourlyVacation, SalaryRegular, SalarySick, SalaryVacation."
|
|
2439
|
+
},
|
|
2440
|
+
{
|
|
2441
|
+
"qbo": "ExpenseAccountRef",
|
|
2442
|
+
"support": "full"
|
|
2443
|
+
}
|
|
2444
|
+
],
|
|
2445
|
+
"unsupported": [
|
|
2446
|
+
{
|
|
2447
|
+
"case": "Create, update, deactivate or delete",
|
|
2448
|
+
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
2449
|
+
"note": "PayrollItemWage is read-only through TenkeyBridge. Reading wage items works on a company file without a payroll subscription.",
|
|
2450
|
+
"workaround": "Create or edit the wage item in QuickBooks Desktop (Lists, Payroll Item List); it shows up on the next read."
|
|
2451
|
+
}
|
|
2452
|
+
]
|
|
2453
|
+
},
|
|
2354
2454
|
"Preferences": {
|
|
2355
2455
|
"entity": "Preferences",
|
|
2356
2456
|
"verdict": "live",
|
|
@@ -2910,7 +3010,7 @@ var CATALOG = {
|
|
|
2910
3010
|
{
|
|
2911
3011
|
"qbo": "Desktop extension reports",
|
|
2912
3012
|
"support": "full",
|
|
2913
|
-
"note": "ProfitAndLossByClass, ProfitAndLossByJob, ProfitAndLossPrevYearComp, ProfitAndLossYTDComp, BalanceSheetPrevYearComp, BalanceSheetByClass, PurchaseByVendorSummary, PurchaseByItemSummary, SalesByRepSummary, InventoryStockStatusByItem, OpenInvoices, UnpaidBillsDetail, OpenPOs, SalesByCustomerDetail, SalesByItemDetail, IncomeByCustomerDetail, ExpenseByVendorDetail, PurchaseByVendorDetail, DepositDetail, CheckDetail, BalanceSheetDetail, CollectionsReport, and since Reports wave 4 TxnDetailByAccount, UnbilledCostsByJob, AuditTrail, 1099Detail, SalesByRepDetail, PurchaseByItemDetail, OpenPOsByJob, EstimatesByJob, JobProgressInvoicesVsEstimates, OpenSalesOrderByCustomer, OpenSalesOrderByItem, PendingSales, IncomeTaxDetail, MissingChecks, SalesTaxRevenueSummary, IncomeTaxSummary, BalanceSheetSummary, InventoryStockStatusByVendor, and the Job and Time reports JobProfitabilitySummary, JobEstimatesVsActualsSummary, ItemProfitability, ItemEstimatesVsActuals, JobProfitabilityDetail, JobEstimatesVsActualsDetail, TimeByJobSummary, TimeByJobDetail, TimeByItem, TimeByName, and since Reports wave 5 PhysicalInventoryWorksheet (a bare snapshot: Desktop refuses every period, filter, basis and column option on it, so the gateway refuses them too) and the Advanced Inventory reports InventoryValuationSummaryBySite, LotNumberInStockBySite and SerialNumberInStockBySite (sent bare; a company file without Advanced Inventory answers 3250, which becomes a 422 REPORT_FEATURE_UNAVAILABLE naming the feature; not live-proven past that gate, and unavailable in the sandbox). Filters are enabled only where they were proven live on QuickBooks Enterprise 24 (2026-10-20): customer/vendor, item, class, account type, transaction type and modified date on the detail reports (not the account filter on UnbilledCostsByJob and PendingSales, which Desktop fails with an internal error), the same minus modified date on the summaries, all but vendor on the four Job summaries, customer, item and class on the Time reports; the two Job detail reports require a customer or job Id and take no other filter; MissingChecks requires account Ids (Desktop refuses a bare query and an account type, as it does ReportBasis) and takes transaction type, class, modified date and columns. 1099Detail takes no filter at all (an entity filter crashed QuickBooks, so the gateway refuses every filter on it before it reaches Desktop). The Time reports take no columns (Desktop refuses Duration). Desktop reports with no QBO twin, served under their Desktop names in the same QBO report JSON."
|
|
3013
|
+
"note": "ProfitAndLossByClass, ProfitAndLossByJob, ProfitAndLossPrevYearComp, ProfitAndLossYTDComp, BalanceSheetPrevYearComp, BalanceSheetByClass, PurchaseByVendorSummary, PurchaseByItemSummary, SalesByRepSummary, InventoryStockStatusByItem, OpenInvoices, UnpaidBillsDetail, OpenPOs, SalesByCustomerDetail, SalesByItemDetail, IncomeByCustomerDetail, ExpenseByVendorDetail, PurchaseByVendorDetail, DepositDetail, CheckDetail, BalanceSheetDetail, CollectionsReport, and since Reports wave 4 TxnDetailByAccount, UnbilledCostsByJob, AuditTrail, 1099Detail, SalesByRepDetail, PurchaseByItemDetail, OpenPOsByJob, EstimatesByJob, JobProgressInvoicesVsEstimates, OpenSalesOrderByCustomer, OpenSalesOrderByItem, PendingSales, IncomeTaxDetail, MissingChecks, SalesTaxRevenueSummary, IncomeTaxSummary, BalanceSheetSummary, InventoryStockStatusByVendor, and the Job and Time reports JobProfitabilitySummary, JobEstimatesVsActualsSummary, ItemProfitability, ItemEstimatesVsActuals, JobProfitabilityDetail, JobEstimatesVsActualsDetail, TimeByJobSummary, TimeByJobDetail, TimeByItem, TimeByName, and since Reports wave 5 PhysicalInventoryWorksheet (a bare snapshot: Desktop refuses every period, filter, basis and column option on it, so the gateway refuses them too) and the Advanced Inventory reports InventoryValuationSummaryBySite, LotNumberInStockBySite and SerialNumberInStockBySite (sent bare; a company file without Advanced Inventory answers 3250, which becomes a 422 REPORT_FEATURE_UNAVAILABLE naming the feature; not live-proven past that gate, and unavailable in the sandbox). Six payroll reports (2026-12-03): PayrollTransactionDetail, PayrollItemDetail, PayrollTransactionsByPayee and PayrollReviewDetail (PayrollDetailReportQueryRq) and PayrollSummary and EmployeeEarningsSummary (PayrollSummaryReportQueryRq). They take a period only (start_date/end_date or date_macro): no filter, column split, accounting_method or columns, because only the period was proven live, and anything else is refused before Desktop. They need a QuickBooks Desktop payroll subscription (status 3262 becomes 422 PAYROLL_SUBSCRIPTION_REQUIRED) and the integrated-application personal-data permission (status 3261 becomes 403 QB_PERSONAL_DATA_DENIED). The sandbox replays one fixed capture of each. Filters are enabled only where they were proven live on QuickBooks Enterprise 24 (2026-10-20): customer/vendor, item, class, account type, transaction type and modified date on the detail reports (not the account filter on UnbilledCostsByJob and PendingSales, which Desktop fails with an internal error), the same minus modified date on the summaries, all but vendor on the four Job summaries, customer, item and class on the Time reports; the two Job detail reports require a customer or job Id and take no other filter; MissingChecks requires account Ids (Desktop refuses a bare query and an account type, as it does ReportBasis) and takes transaction type, class, modified date and columns. 1099Detail takes no filter at all (an entity filter crashed QuickBooks, so the gateway refuses every filter on it before it reaches Desktop). The Time reports take no columns (Desktop refuses Duration). Desktop reports with no QBO twin, served under their Desktop names in the same QBO report JSON."
|
|
2914
3014
|
},
|
|
2915
3015
|
{
|
|
2916
3016
|
"qbo": "start_date / end_date / date_macro",
|
|
@@ -3643,9 +3743,8 @@ var CATALOG = {
|
|
|
3643
3743
|
},
|
|
3644
3744
|
{
|
|
3645
3745
|
"qbo": "PayrollItemRef",
|
|
3646
|
-
"support": "
|
|
3647
|
-
"note":
|
|
3648
|
-
"error": "UNSUPPORTED_BY_DESKTOP"
|
|
3746
|
+
"support": "full",
|
|
3747
|
+
"note": 'TenkeyBridge extension (QBO Accounting has no equivalent): maps to Desktop PayrollItemWageRef, read from and written to the entry as { value, name }. Pick a wage item from the PayrollItemWage list (Regular Pay, Overtime Pay, ...). Required on every entry for an employee whose "Use time data to create paychecks" is on: without it QuickBooks refuses the save (statusCode 3180, "Activities for this employee must have a payroll item"). For an employee set not to use time data it is optional and stored when sent. Vendor entries accept and store one too. A sparse update that omits it keeps the stored item; sending a different one changes it; it cannot be cleared.'
|
|
3649
3748
|
},
|
|
3650
3749
|
{
|
|
3651
3750
|
"qbo": "TxnNumber",
|
|
@@ -3979,6 +4078,36 @@ function registerResources(server) {
|
|
|
3979
4078
|
// src/tools.ts
|
|
3980
4079
|
import { ENTITIES as ENTITIES2, TenkeyBridgeApiError } from "@tenkeybridge/client";
|
|
3981
4080
|
import { z } from "zod";
|
|
4081
|
+
|
|
4082
|
+
// src/access.ts
|
|
4083
|
+
var NEEDS = {
|
|
4084
|
+
query: { op: "read" },
|
|
4085
|
+
get: { op: "read" },
|
|
4086
|
+
create: { op: "create" },
|
|
4087
|
+
update: { op: "update" },
|
|
4088
|
+
delete: { op: "delete" },
|
|
4089
|
+
void: { op: "void" },
|
|
4090
|
+
run_report: { op: "read", entity: "Report" },
|
|
4091
|
+
get_cleared_status: { op: "read", entity: "ClearedStatus" },
|
|
4092
|
+
set_cleared_status: { op: "update", entity: "ClearedStatus" }
|
|
4093
|
+
};
|
|
4094
|
+
function layerAllows(rules, op, entity) {
|
|
4095
|
+
return rules.some((r) => {
|
|
4096
|
+
if (!r.ops.includes(op)) return false;
|
|
4097
|
+
if (!entity) return true;
|
|
4098
|
+
return r.entity === "*" || r.entity === entity;
|
|
4099
|
+
});
|
|
4100
|
+
}
|
|
4101
|
+
function toolVisible(access, tool) {
|
|
4102
|
+
if (!access) return true;
|
|
4103
|
+
const need = NEEDS[tool];
|
|
4104
|
+
if (!need) return true;
|
|
4105
|
+
if (!layerAllows(access.rules, need.op, need.entity)) return false;
|
|
4106
|
+
if (access.companyRules && !layerAllows(access.companyRules, need.op, need.entity)) return false;
|
|
4107
|
+
return true;
|
|
4108
|
+
}
|
|
4109
|
+
|
|
4110
|
+
// src/tools.ts
|
|
3982
4111
|
function ok(result) {
|
|
3983
4112
|
return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
|
|
3984
4113
|
}
|
|
@@ -3994,7 +4123,9 @@ function failure(err) {
|
|
|
3994
4123
|
code: err.code,
|
|
3995
4124
|
message: err.message,
|
|
3996
4125
|
fixes: err.tkb?.fixes,
|
|
3997
|
-
docsUrl: err.tkb?.docsUrl
|
|
4126
|
+
docsUrl: err.tkb?.docsUrl,
|
|
4127
|
+
...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." } : {},
|
|
4128
|
+
...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." } : {}
|
|
3998
4129
|
},
|
|
3999
4130
|
null,
|
|
4000
4131
|
2
|
|
@@ -4029,9 +4160,12 @@ function readOnly(name) {
|
|
|
4029
4160
|
`${name} is read-only through TenkeyBridge (write: ${ENTITIES2[name].write}).` + (entry ? ` ${entry.headline}` : "") + ` Detail: compat://entity/${name.toLowerCase()}`
|
|
4030
4161
|
);
|
|
4031
4162
|
}
|
|
4032
|
-
function registerTools(server, client) {
|
|
4163
|
+
function registerTools(server, client, access) {
|
|
4164
|
+
const hide = (name, tool) => {
|
|
4165
|
+
if (!toolVisible(access, name)) tool.disable();
|
|
4166
|
+
};
|
|
4033
4167
|
const entityArg = z.string().describe('Entity name, e.g. "Invoice" or "Customer" (case-insensitive). See compat://catalog.');
|
|
4034
|
-
server.registerTool(
|
|
4168
|
+
hide("query", server.registerTool(
|
|
4035
4169
|
"query",
|
|
4036
4170
|
{
|
|
4037
4171
|
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.",
|
|
@@ -4055,11 +4189,11 @@ function registerTools(server, client) {
|
|
|
4055
4189
|
return failure(err);
|
|
4056
4190
|
}
|
|
4057
4191
|
}
|
|
4058
|
-
);
|
|
4059
|
-
server.registerTool(
|
|
4192
|
+
));
|
|
4193
|
+
hide("run_report", server.registerTool(
|
|
4060
4194
|
"run_report",
|
|
4061
4195
|
{
|
|
4062
|
-
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.",
|
|
4196
|
+
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. The payroll reports (PayrollTransactionDetail, PayrollSummary and four more) take a period only (start_date, end_date or date_macro). Read compat://entity/reports for the available reports and which params each takes.",
|
|
4063
4197
|
inputSchema: {
|
|
4064
4198
|
report: z.string().describe('Report name, e.g. "ProfitAndLoss" (case-insensitive).'),
|
|
4065
4199
|
params: z.record(z.string()).optional().describe('Query params, e.g. { "date_macro": "Last Month" }.')
|
|
@@ -4073,8 +4207,8 @@ function registerTools(server, client) {
|
|
|
4073
4207
|
return failure(err);
|
|
4074
4208
|
}
|
|
4075
4209
|
}
|
|
4076
|
-
);
|
|
4077
|
-
server.registerTool(
|
|
4210
|
+
));
|
|
4211
|
+
hide("get", server.registerTool(
|
|
4078
4212
|
"get",
|
|
4079
4213
|
{
|
|
4080
4214
|
description: "Fetch one entity by Id (singletons like CompanyInfo and Preferences need no id).",
|
|
@@ -4096,8 +4230,8 @@ function registerTools(server, client) {
|
|
|
4096
4230
|
return failure(err);
|
|
4097
4231
|
}
|
|
4098
4232
|
}
|
|
4099
|
-
);
|
|
4100
|
-
server.registerTool(
|
|
4233
|
+
));
|
|
4234
|
+
hide("create", server.registerTool(
|
|
4101
4235
|
"create",
|
|
4102
4236
|
{
|
|
4103
4237
|
description: "Create an entity from QBO-shaped JSON (same payloads as the QuickBooks Online API). Check compat://entity/{name} for field support first.",
|
|
@@ -4116,8 +4250,8 @@ function registerTools(server, client) {
|
|
|
4116
4250
|
return failure(err);
|
|
4117
4251
|
}
|
|
4118
4252
|
}
|
|
4119
|
-
);
|
|
4120
|
-
server.registerTool(
|
|
4253
|
+
));
|
|
4254
|
+
hide("update", server.registerTool(
|
|
4121
4255
|
"update",
|
|
4122
4256
|
{
|
|
4123
4257
|
description: "Sparse-update an entity: payload must include Id plus only the fields to change.",
|
|
@@ -4139,8 +4273,8 @@ function registerTools(server, client) {
|
|
|
4139
4273
|
return failure(err);
|
|
4140
4274
|
}
|
|
4141
4275
|
}
|
|
4142
|
-
);
|
|
4143
|
-
server.registerTool(
|
|
4276
|
+
));
|
|
4277
|
+
hide("delete", server.registerTool(
|
|
4144
4278
|
"delete",
|
|
4145
4279
|
{
|
|
4146
4280
|
description: "Delete an entity by Id (SyncToken optional, as in QBO).",
|
|
@@ -4160,8 +4294,8 @@ function registerTools(server, client) {
|
|
|
4160
4294
|
return failure(err);
|
|
4161
4295
|
}
|
|
4162
4296
|
}
|
|
4163
|
-
);
|
|
4164
|
-
server.registerTool(
|
|
4297
|
+
));
|
|
4298
|
+
hide("void", server.registerTool(
|
|
4165
4299
|
"void",
|
|
4166
4300
|
{
|
|
4167
4301
|
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.',
|
|
@@ -4184,9 +4318,9 @@ function registerTools(server, client) {
|
|
|
4184
4318
|
return failure(err);
|
|
4185
4319
|
}
|
|
4186
4320
|
}
|
|
4187
|
-
);
|
|
4321
|
+
));
|
|
4188
4322
|
const CLEARED_NEEDS = "This TenkeyBridge client has no cleared status methods; upgrade @tenkeybridge/client to 0.8.0.";
|
|
4189
|
-
server.registerTool(
|
|
4323
|
+
hide("set_cleared_status", server.registerTool(
|
|
4190
4324
|
"set_cleared_status",
|
|
4191
4325
|
{
|
|
4192
4326
|
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.",
|
|
@@ -4209,8 +4343,8 @@ function registerTools(server, client) {
|
|
|
4209
4343
|
return failure(err);
|
|
4210
4344
|
}
|
|
4211
4345
|
}
|
|
4212
|
-
);
|
|
4213
|
-
server.registerTool(
|
|
4346
|
+
));
|
|
4347
|
+
hide("get_cleared_status", server.registerTool(
|
|
4214
4348
|
"get_cleared_status",
|
|
4215
4349
|
{
|
|
4216
4350
|
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.",
|
|
@@ -4227,17 +4361,17 @@ function registerTools(server, client) {
|
|
|
4227
4361
|
return failure(err);
|
|
4228
4362
|
}
|
|
4229
4363
|
}
|
|
4230
|
-
);
|
|
4364
|
+
));
|
|
4231
4365
|
}
|
|
4232
4366
|
|
|
4233
4367
|
// src/version.ts
|
|
4234
|
-
var PKG_VERSION = "0.
|
|
4368
|
+
var PKG_VERSION = "0.10.0";
|
|
4235
4369
|
|
|
4236
4370
|
// src/server.ts
|
|
4237
4371
|
var SERVER_NAME = "tenkeybridge";
|
|
4238
|
-
function buildServer(client) {
|
|
4372
|
+
function buildServer(client, access) {
|
|
4239
4373
|
const server = new McpServer2({ name: SERVER_NAME, version: PKG_VERSION });
|
|
4240
|
-
registerTools(server, client);
|
|
4374
|
+
registerTools(server, client, access);
|
|
4241
4375
|
registerResources(server);
|
|
4242
4376
|
return server;
|
|
4243
4377
|
}
|
|
@@ -4318,6 +4452,7 @@ export {
|
|
|
4318
4452
|
registerResources,
|
|
4319
4453
|
registerTools,
|
|
4320
4454
|
resolveCatalog,
|
|
4321
|
-
resolveEntityName
|
|
4455
|
+
resolveEntityName,
|
|
4456
|
+
toolVisible
|
|
4322
4457
|
};
|
|
4323
4458
|
//# sourceMappingURL=index.js.map
|