@tenkeybridge/mcp 0.3.0 → 0.4.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/index.cjs CHANGED
@@ -144,14 +144,14 @@ var CATALOG = {
144
144
  "group": "gaps",
145
145
  "read": "none",
146
146
  "write": "none",
147
- "headline": "QuickBooks Desktop's qbXML API has no attachments interface \u2014 the word 'Attachment' does not occur anywhere in the qbxmlops130 message set.",
147
+ "headline": "Unsupported on QuickBooks Desktop, with no opt-in and no workaround inside TenkeyBridge. qbXML has no attachments interface (the word 'Attachment' does not occur anywhere in the qbxmlops130 message set), and TenkeyBridge does not store files itself.",
148
148
  "fields": [],
149
149
  "unsupported": [
150
150
  {
151
151
  "case": "read",
152
152
  "error": "UNSUPPORTED_BY_DESKTOP",
153
153
  "note": "Re-audited 2026-07-29: zero occurrences of any attachment message (no AttachmentAdd/Query/Ref of any kind) across the full qbxmlops130 schema. Desktop's Attached Documents feature is UI-only; files attached in Desktop cannot be listed or fetched through TenkeyBridge.",
154
- "workaround": "Store documents in your own system keyed by the TenkeyBridge entity Id \u2014 that is what QBD integrations have always had to do."
154
+ "workaround": "Store documents in your own system keyed by the TenkeyBridge entity Id, which is what QuickBooks Desktop integrations have always had to do. Branch on UNSUPPORTED_BY_DESKTOP and skip the Attachable call for Desktop-backed companies."
155
155
  },
156
156
  {
157
157
  "case": "query",
@@ -182,7 +182,7 @@ var CATALOG = {
182
182
  "read": "full",
183
183
  "write": "full",
184
184
  "headline": "Batch envelope \u2014 up to 30 create/update/delete/query operations in one request, executed sequentially with per-item faults.",
185
- "usage": "POST /v3/company/{realmId}/batch",
185
+ "usage": "POST /v3/company/{companyId}/batch",
186
186
  "fields": [
187
187
  {
188
188
  "qbo": "bId",
@@ -229,7 +229,7 @@ var CATALOG = {
229
229
  {
230
230
  "case": "entity CRUD or /query on Batch itself",
231
231
  "error": "UNSUPPORTED_BY_DESKTOP",
232
- "note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{realmId}/batch."
232
+ "note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{companyId}/batch."
233
233
  }
234
234
  ]
235
235
  },
@@ -442,7 +442,7 @@ var CATALOG = {
442
442
  "case": "query \u2014 SELECT * cannot enumerate every budget",
443
443
  "error": "UNSUPPORTED_QUERY",
444
444
  "note": "qbXML cannot list budgets: BudgetSummaryReportQueryRq requires a FiscalYear. SELECT * FROM Budget probes a fixed window \u2014 the current calendar year, the one before it, and the one after it \u2014 against both statement types (six report requests in one round-trip) and returns the ones that come back with budgeted amounts. A budget outside that window is invisible to SELECT *. Because the probe is speculative, the query never faults on an individual report's status: a company with no budgets gets an empty list, exactly as QBO answers. GET by id has one report and does surface its status.",
445
- "workaround": "Fetch it by id: GET /v3/company/{realmId}/budget/{fiscalYear}-{BudgetType}, e.g. 2023-ProfitAndLoss, which issues exactly one report request for that year."
445
+ "workaround": "Fetch it by id: GET /v3/company/{companyId}/budget/{fiscalYear}-{BudgetType}, e.g. 2023-ProfitAndLoss, which issues exactly one report request for that year."
446
446
  },
447
447
  {
448
448
  "case": "query \u2014 WHERE on anything but Id, ORDERBY, COUNT(*), column lists",
@@ -491,7 +491,7 @@ var CATALOG = {
491
491
  "read": "full",
492
492
  "write": "none",
493
493
  "headline": "Change Data Capture \u2014 one poll returns changed + deleted records across entities.",
494
- "usage": "GET /v3/company/{realmId}/cdc?entities=Invoice,Customer&changedSince=2026-07-01",
494
+ "usage": "GET /v3/company/{companyId}/cdc?entities=Invoice,Customer&changedSince=2026-07-01",
495
495
  "fields": [
496
496
  {
497
497
  "qbo": "entities",
@@ -608,7 +608,7 @@ var CATALOG = {
608
608
  "group": "company",
609
609
  "read": "full",
610
610
  "write": "none",
611
- "headline": "Read-only; Id equals the realm ID, no Desktop write path",
611
+ "headline": "Read-only; Id equals the Company ID, no Desktop write path",
612
612
  "fields": [
613
613
  {
614
614
  "qbo": "CompanyName",
@@ -748,6 +748,17 @@ var CATALOG = {
748
748
  "qbo": "CustomerRef",
749
749
  "support": "full"
750
750
  },
751
+ {
752
+ "qbo": "ClassRef",
753
+ "support": "full",
754
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
755
+ },
756
+ {
757
+ "qbo": "DepartmentRef",
758
+ "support": "none",
759
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
760
+ "error": "UNMAPPED_FIELD"
761
+ },
751
762
  {
752
763
  "qbo": "TxnDate",
753
764
  "support": "full"
@@ -1039,35 +1050,84 @@ var CATALOG = {
1039
1050
  "group": "gaps",
1040
1051
  "read": "none",
1041
1052
  "write": "none",
1042
- "headline": "QBO Departments (locations) have no Desktop equivalent \u2014 the only 'Department'/'Location' strings in qbXML are free-text fields on Employee, FixedAsset, and Lead, and Desktop's one real dimensional list (Class) is already exposed faithfully as Class.",
1043
- "fields": [],
1053
+ "headline": "QuickBooks Desktop has no Department (location) list, so Department is unsupported by default. Opt in per company file with Departments from classes and Department becomes an alias of Class (DepartmentRef on a transaction becomes its header ClassRef).",
1054
+ "fields": [
1055
+ {
1056
+ "qbo": "Id",
1057
+ "support": "partial",
1058
+ "note": "Only with Departments from classes on: the Class ListID."
1059
+ },
1060
+ {
1061
+ "qbo": "Name",
1062
+ "support": "partial",
1063
+ "note": "Only with Departments from classes on: the Class Name (31 characters max)."
1064
+ },
1065
+ {
1066
+ "qbo": "SubDepartment",
1067
+ "support": "partial",
1068
+ "note": "Only with Departments from classes on: read-only, true when the class has a parent."
1069
+ },
1070
+ {
1071
+ "qbo": "ParentRef",
1072
+ "support": "partial",
1073
+ "note": "Only with Departments from classes on: the parent class."
1074
+ },
1075
+ {
1076
+ "qbo": "FullyQualifiedName",
1077
+ "support": "partial",
1078
+ "note": "Only with Departments from classes on: the class full name (Parent:Child). Read-only."
1079
+ },
1080
+ {
1081
+ "qbo": "Active",
1082
+ "support": "partial",
1083
+ "note": "Only with Departments from classes on: class IsActive. Deactivate with Active:false."
1084
+ },
1085
+ {
1086
+ "qbo": "SyncToken",
1087
+ "support": "partial",
1088
+ "note": "Only with Departments from classes on: the class EditSequence."
1089
+ },
1090
+ {
1091
+ "qbo": "MetaData",
1092
+ "support": "partial",
1093
+ "note": "Only with Departments from classes on: class TimeCreated / TimeModified."
1094
+ }
1095
+ ],
1044
1096
  "unsupported": [
1045
1097
  {
1046
1098
  "case": "read",
1047
1099
  "error": "UNSUPPORTED_BY_DESKTOP",
1048
- "note": "Re-audited 2026-07-29 against the qbxmlops130 message set: qbXML has no Department or Location list \u2014 no Add/Mod/Query message pair exists. The tokens only appear as plain STRTYPE fields (Employee.Department, FixedAsset.Location, Lead.Location), which are annotations, not a queryable list.",
1049
- "workaround": "If your integration treats QBO locations as just another dimension, remap DepartmentRef onto Class in your own code \u2014 Class is live in TenkeyBridge. We decided against a built-in Department\u2192Class alias, even opt-in: ClassRef already maps to Class, so aliasing would make two QBO fields silently write one Desktop list and collide when a client sends both."
1100
+ "note": "Off by default. Re-audited 2026-07-29 against the qbxmlops130 message set: qbXML has no Department or Location list (no Add/Mod/Query message pair). The tokens only appear as plain STRTYPE fields (Employee.Department, FixedAsset.Location, Lead.Location), which are annotations, not a queryable list.",
1101
+ "workaround": "Turn on Departments from classes for the company file (portal: company file page, Departments card; or PATCH /admin/v1/companies/{companyId}/settings with departmentsFromClasses: true). Department then reads your QuickBooks classes. See the Departments guide."
1050
1102
  },
1051
1103
  {
1052
1104
  "case": "query",
1053
1105
  "error": "UNSUPPORTED_BY_DESKTOP",
1054
- "note": "qbXML has no Department/Location list to query \u2014 confirmed absent from the qbxmlops130 message set.",
1055
- "workaround": "Query Class instead if you remap locations client-side; that remapping is your call, TenkeyBridge never reinterprets DepartmentRef silently."
1106
+ "note": "Off by default: no Department list to query. With Departments from classes on, SELECT ... FROM Department is run against Class and answered as Department; DepartmentRef in a transaction query means its ClassRef.",
1107
+ "workaround": "Turn on Departments from classes, or query Class directly."
1056
1108
  },
1057
1109
  {
1058
1110
  "case": "create",
1059
1111
  "error": "UNSUPPORTED_BY_DESKTOP",
1060
- "note": "Desktop has no Department create. Use Class if you need a dimensional axis on Desktop."
1112
+ "note": "Off by default. With Departments from classes on, creating a Department creates a Class (ParentRef makes it a sub-class).",
1113
+ "workaround": "Turn on Departments from classes, or create a Class."
1061
1114
  },
1062
1115
  {
1063
1116
  "case": "update",
1064
1117
  "error": "UNSUPPORTED_BY_DESKTOP",
1065
- "note": "Desktop has no Department update."
1118
+ "note": "Off by default. With Departments from classes on, an update edits the Class (sparse; Name, Active, ParentRef).",
1119
+ "workaround": "Turn on Departments from classes, or update the Class."
1066
1120
  },
1067
1121
  {
1068
1122
  "case": "delete",
1069
1123
  "error": "UNSUPPORTED_BY_DESKTOP",
1070
- "note": "Desktop has no Department delete."
1124
+ "note": "Always unsupported: a Desktop class cannot be deleted through qbXML. Deactivate with Active:false."
1125
+ },
1126
+ {
1127
+ "case": "DepartmentRef on a transaction",
1128
+ "error": "UNSUPPORTED_BY_DESKTOP",
1129
+ "note": "With Departments from classes on it maps to the header ClassRef on Invoice, SalesReceipt, Estimate, CreditMemo, PurchaseOrder and TimeActivity. Sending a different ClassRef as well is a 400. Bill, Purchase, VendorCredit, JournalEntry, Deposit, RefundReceipt and Transfer have no header class in QuickBooks Desktop (class lives on the lines), so DepartmentRef there is a 422 that says to set ClassRef per line. Off: UNMAPPED_FIELD.",
1130
+ "workaround": "Set ClassRef on each line for those transactions."
1071
1131
  }
1072
1132
  ]
1073
1133
  },
@@ -1242,8 +1302,8 @@ var CATALOG = {
1242
1302
  "group": "platform",
1243
1303
  "read": "partial",
1244
1304
  "write": "none",
1245
- "headline": "GET /v3/company/{realmId}/entitlements \u2014 a static, honest capability document for a QuickBooks Desktop company (no per-file subscription data).",
1246
- "usage": "GET /v3/company/{realmId}/entitlements",
1305
+ "headline": "GET /v3/company/{companyId}/entitlements \u2014 a static, honest capability document for a QuickBooks Desktop company (no per-file subscription data).",
1306
+ "usage": "GET /v3/company/{companyId}/entitlements",
1247
1307
  "fields": [
1248
1308
  {
1249
1309
  "qbo": "Entitlements.platform",
@@ -1276,6 +1336,17 @@ var CATALOG = {
1276
1336
  "qbo": "CustomerRef",
1277
1337
  "support": "full"
1278
1338
  },
1339
+ {
1340
+ "qbo": "ClassRef",
1341
+ "support": "full",
1342
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
1343
+ },
1344
+ {
1345
+ "qbo": "DepartmentRef",
1346
+ "support": "none",
1347
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
1348
+ "error": "UNMAPPED_FIELD"
1349
+ },
1279
1350
  {
1280
1351
  "qbo": "TxnDate",
1281
1352
  "support": "full"
@@ -1505,6 +1576,17 @@ var CATALOG = {
1505
1576
  "qbo": "CustomerRef",
1506
1577
  "support": "full"
1507
1578
  },
1579
+ {
1580
+ "qbo": "ClassRef",
1581
+ "support": "full",
1582
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
1583
+ },
1584
+ {
1585
+ "qbo": "DepartmentRef",
1586
+ "support": "none",
1587
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
1588
+ "error": "UNMAPPED_FIELD"
1589
+ },
1508
1590
  {
1509
1591
  "qbo": "TxnDate",
1510
1592
  "support": "full"
@@ -1985,7 +2067,7 @@ var CATALOG = {
1985
2067
  {
1986
2068
  "qbo": "AccountingInfoPrefs",
1987
2069
  "support": "partial",
1988
- "note": "ClassTrackingPerTxn/ClassTrackingPerTxnLine \u2190 IsUsingClassTracking (same bool projected to both); TrackDepartments always false (no Desktop Locations)."
2070
+ "note": "ClassTrackingPerTxn/ClassTrackingPerTxnLine \u2190 IsUsingClassTracking (same bool projected to both); TrackDepartments is false, or true when the company file has Departments from classes turned on (Department is then an alias of Class)."
1989
2071
  },
1990
2072
  {
1991
2073
  "qbo": "CurrencyPrefs",
@@ -2148,6 +2230,17 @@ var CATALOG = {
2148
2230
  "qbo": "VendorRef",
2149
2231
  "support": "full"
2150
2232
  },
2233
+ {
2234
+ "qbo": "ClassRef",
2235
+ "support": "full",
2236
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
2237
+ },
2238
+ {
2239
+ "qbo": "DepartmentRef",
2240
+ "support": "none",
2241
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
2242
+ "error": "UNMAPPED_FIELD"
2243
+ },
2151
2244
  {
2152
2245
  "qbo": "TxnDate",
2153
2246
  "support": "full"
@@ -2385,7 +2478,7 @@ var CATALOG = {
2385
2478
  "read": "partial",
2386
2479
  "write": "none",
2387
2480
  "headline": "Twenty QBO-compatible reports translated live from Desktop's report engine: summary, detail, aging, balance and sales reports, all run against QuickBooks Enterprise 24. There is no CashFlow \u2014 Desktop's SDK has no cash-flow report.",
2388
- "usage": "GET /v3/company/{realmId}/reports/ProfitAndLoss?start_date=2026-01-01&end_date=2026-12-31&summarize_column_by=Month",
2481
+ "usage": "GET /v3/company/{companyId}/reports/ProfitAndLoss?start_date=2026-01-01&end_date=2026-12-31&summarize_column_by=Month",
2389
2482
  "fields": [
2390
2483
  {
2391
2484
  "qbo": "ProfitAndLoss / BalanceSheet / TrialBalance",
@@ -2511,6 +2604,17 @@ var CATALOG = {
2511
2604
  "qbo": "CustomerRef",
2512
2605
  "support": "full"
2513
2606
  },
2607
+ {
2608
+ "qbo": "ClassRef",
2609
+ "support": "full",
2610
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
2611
+ },
2612
+ {
2613
+ "qbo": "DepartmentRef",
2614
+ "support": "none",
2615
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
2616
+ "error": "UNMAPPED_FIELD"
2617
+ },
2514
2618
  {
2515
2619
  "qbo": "TxnDate",
2516
2620
  "support": "full"
@@ -2959,6 +3063,12 @@ var CATALOG = {
2959
3063
  "qbo": "ClassRef",
2960
3064
  "support": "full"
2961
3065
  },
3066
+ {
3067
+ "qbo": "DepartmentRef",
3068
+ "support": "none",
3069
+ "note": "UNMAPPED_FIELD by default. With Departments from classes turned on for the company file, the gateway maps it to the header ClassRef (written to it, read from it); sending a different ClassRef as well is a 400.",
3070
+ "error": "UNMAPPED_FIELD"
3071
+ },
2962
3072
  {
2963
3073
  "qbo": "Description",
2964
3074
  "support": "full",
@@ -3558,7 +3668,7 @@ function registerTools(server, client) {
3558
3668
  }
3559
3669
 
3560
3670
  // src/version.ts
3561
- var PKG_VERSION = "0.3.0";
3671
+ var PKG_VERSION = "0.4.0";
3562
3672
 
3563
3673
  // src/server.ts
3564
3674
  var SERVER_NAME = "tenkeybridge";
@@ -3574,19 +3684,25 @@ var import_node_fs = require("fs");
3574
3684
  var import_node_os = require("os");
3575
3685
  var import_node_path = require("path");
3576
3686
  var PORTAL_URL = "https://api.tenkeybridge.com/portal";
3577
- function defaultTokenFile(realmId) {
3578
- return (0, import_node_path.join)((0, import_node_os.homedir)(), ".tenkeybridge", `mcp-tokens-${realmId}.json`);
3687
+ function defaultTokenFile(companyId) {
3688
+ return (0, import_node_path.join)((0, import_node_os.homedir)(), ".tenkeybridge", `mcp-tokens-${companyId}.json`);
3579
3689
  }
3580
3690
  function loadConfig(env) {
3581
- const realmId = env.TKB_REALM_ID;
3582
- if (!realmId) {
3691
+ const fromNew = env.TKB_COMPANY_ID;
3692
+ const fromOld = env.TKB_REALM_ID;
3693
+ if (fromNew && fromOld && fromNew !== fromOld) {
3694
+ throw new Error("TKB_COMPANY_ID and TKB_REALM_ID (deprecated) disagree \u2014 set TKB_COMPANY_ID only.");
3695
+ }
3696
+ const companyId = fromNew || fromOld;
3697
+ if (!companyId) {
3583
3698
  throw new Error(
3584
- `TKB_REALM_ID is required \u2014 the realm id of the connected company file (shown in the portal: ${PORTAL_URL}).`
3699
+ `TKB_COMPANY_ID is required \u2014 the Company ID of the connected QuickBooks company file (shown in the portal: ${PORTAL_URL}).`
3585
3700
  );
3586
3701
  }
3702
+ const deprecations = !fromNew && fromOld ? ["TKB_REALM_ID is deprecated; set TKB_COMPANY_ID instead."] : [];
3587
3703
  const baseUrl = env.TKB_BASE_URL;
3588
3704
  if (env.TKB_ACCESS_TOKEN) {
3589
- return { realmId, ...baseUrl ? { baseUrl } : {}, auth: { accessToken: env.TKB_ACCESS_TOKEN } };
3705
+ return { companyId, deprecations, ...baseUrl ? { baseUrl } : {}, auth: { accessToken: env.TKB_ACCESS_TOKEN } };
3590
3706
  }
3591
3707
  const clientId = env.TKB_CLIENT_ID;
3592
3708
  const clientSecret = env.TKB_CLIENT_SECRET;
@@ -3598,13 +3714,14 @@ function loadConfig(env) {
3598
3714
  !refreshToken && "TKB_REFRESH_TOKEN"
3599
3715
  ].filter(Boolean).join(", ");
3600
3716
  throw new Error(
3601
- `Missing ${missing}. Set either TKB_ACCESS_TOKEN, or all of TKB_CLIENT_ID + TKB_CLIENT_SECRET + TKB_REFRESH_TOKEN (create an OAuth client in the portal: ${PORTAL_URL}).`
3717
+ `Missing ${missing}. Set either TKB_ACCESS_TOKEN, or all of TKB_CLIENT_ID + TKB_CLIENT_SECRET + TKB_REFRESH_TOKEN (create an OAuth app in the portal: ${PORTAL_URL}).`
3602
3718
  );
3603
3719
  }
3604
- const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(realmId);
3720
+ const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(companyId);
3605
3721
  const stored = readStoredRefreshToken(tokenFile);
3606
3722
  return {
3607
- realmId,
3723
+ companyId,
3724
+ deprecations,
3608
3725
  ...baseUrl ? { baseUrl } : {},
3609
3726
  tokenFile,
3610
3727
  auth: { clientId, clientSecret, refreshToken: stored ?? refreshToken }