@tenkeybridge/mcp 0.3.0 → 0.5.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/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  **MCP server for [TenkeyBridge](https://tenkeybridge.com) — give AI agents QuickBooks
4
4
  Desktop & Enterprise through the QuickBooks Online–compatible REST API.**
5
5
 
6
- Six tools — `query`, `get`, `create`, `update`, `delete`, `void` (Invoice, SalesReceipt, Purchase, BillPayment) — over the live API, plus a
6
+ Seven tools: `query`, `get`, `create`, `update`, `delete`, `void` (Invoice, SalesReceipt, Purchase, BillPayment) and `run_report` (QBO-style reports), over the live API, plus a
7
7
  compatibility-catalog resource (`compat://catalog`, `compat://entity/{name}`) so agents
8
8
  can check entity and field support *before* calling instead of learning by 400. Errors
9
9
  come back structured (`status`, `code`, `fixes`, `docsUrl`) for self-correction.
@@ -23,7 +23,7 @@ issues the client id/secret; the refresh token comes from the OAuth code flow
23
23
  "command": "npx",
24
24
  "args": ["-y", "@tenkeybridge/mcp"],
25
25
  "env": {
26
- "TKB_REALM_ID": "9130350000000000",
26
+ "TKB_COMPANY_ID": "9130350000000000",
27
27
  "TKB_CLIENT_ID": "tkb-ci-example",
28
28
  "TKB_CLIENT_SECRET": "…",
29
29
  "TKB_REFRESH_TOKEN": "…"
@@ -34,7 +34,7 @@ issues the client id/secret; the refresh token comes from the OAuth code flow
34
34
  ```
35
35
 
36
36
  Refresh tokens rotate; the server persists the newest pair to
37
- `~/.tenkeybridge/mcp-tokens-<realmId>.json` (override with `TKB_TOKEN_FILE`) and picks
37
+ `~/.tenkeybridge/mcp-tokens-<companyId>.json` (override with `TKB_TOKEN_FILE`) and picks
38
38
  it up on restart. Alternatives: a static `TKB_ACCESS_TOKEN`, and `TKB_BASE_URL` to
39
39
  point at a non-production gateway.
40
40
 
@@ -42,7 +42,7 @@ point at a non-production gateway.
42
42
 
43
43
  | Variable | Required | Purpose |
44
44
  | --- | --- | --- |
45
- | `TKB_REALM_ID` | yes | Realm id of the connected company file (shown in the portal). |
45
+ | `TKB_COMPANY_ID` | yes | Company ID of the connected company file (shown in the portal). `TKB_REALM_ID` still works as a deprecated alias. |
46
46
  | `TKB_CLIENT_ID` / `TKB_CLIENT_SECRET` / `TKB_REFRESH_TOKEN` | yes* | OAuth client id/secret from the portal, plus a refresh token from the OAuth code flow (see the [Authentication guide](https://docs.tenkeybridge.com/guide/authentication)). |
47
47
  | `TKB_ACCESS_TOKEN` | yes* | Static token alternative to the trio above. |
48
48
  | `TKB_TOKEN_FILE` | no | Where rotated refresh tokens are persisted. |
package/dist/cli.js CHANGED
@@ -9,19 +9,25 @@ import { mkdirSync, readFileSync, writeFileSync } from "fs";
9
9
  import { homedir } from "os";
10
10
  import { dirname, join } from "path";
11
11
  var PORTAL_URL = "https://api.tenkeybridge.com/portal";
12
- function defaultTokenFile(realmId) {
13
- return join(homedir(), ".tenkeybridge", `mcp-tokens-${realmId}.json`);
12
+ function defaultTokenFile(companyId) {
13
+ return join(homedir(), ".tenkeybridge", `mcp-tokens-${companyId}.json`);
14
14
  }
15
15
  function loadConfig(env) {
16
- const realmId = env.TKB_REALM_ID;
17
- if (!realmId) {
16
+ const fromNew = env.TKB_COMPANY_ID;
17
+ const fromOld = env.TKB_REALM_ID;
18
+ if (fromNew && fromOld && fromNew !== fromOld) {
19
+ throw new Error("TKB_COMPANY_ID and TKB_REALM_ID (deprecated) disagree \u2014 set TKB_COMPANY_ID only.");
20
+ }
21
+ const companyId = fromNew || fromOld;
22
+ if (!companyId) {
18
23
  throw new Error(
19
- `TKB_REALM_ID is required \u2014 the realm id of the connected company file (shown in the portal: ${PORTAL_URL}).`
24
+ `TKB_COMPANY_ID is required \u2014 the Company ID of the connected QuickBooks company file (shown in the portal: ${PORTAL_URL}).`
20
25
  );
21
26
  }
27
+ const deprecations = !fromNew && fromOld ? ["TKB_REALM_ID is deprecated; set TKB_COMPANY_ID instead."] : [];
22
28
  const baseUrl = env.TKB_BASE_URL;
23
29
  if (env.TKB_ACCESS_TOKEN) {
24
- return { realmId, ...baseUrl ? { baseUrl } : {}, auth: { accessToken: env.TKB_ACCESS_TOKEN } };
30
+ return { companyId, deprecations, ...baseUrl ? { baseUrl } : {}, auth: { accessToken: env.TKB_ACCESS_TOKEN } };
25
31
  }
26
32
  const clientId = env.TKB_CLIENT_ID;
27
33
  const clientSecret = env.TKB_CLIENT_SECRET;
@@ -33,13 +39,14 @@ function loadConfig(env) {
33
39
  !refreshToken && "TKB_REFRESH_TOKEN"
34
40
  ].filter(Boolean).join(", ");
35
41
  throw new Error(
36
- `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}).`
42
+ `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}).`
37
43
  );
38
44
  }
39
- const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(realmId);
45
+ const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(companyId);
40
46
  const stored = readStoredRefreshToken(tokenFile);
41
47
  return {
42
- realmId,
48
+ companyId,
49
+ deprecations,
43
50
  ...baseUrl ? { baseUrl } : {},
44
51
  tokenFile,
45
52
  auth: { clientId, clientSecret, refreshToken: stored ?? refreshToken }
@@ -169,14 +176,14 @@ var CATALOG = {
169
176
  "group": "gaps",
170
177
  "read": "none",
171
178
  "write": "none",
172
- "headline": "QuickBooks Desktop's qbXML API has no attachments interface \u2014 the word 'Attachment' does not occur anywhere in the qbxmlops130 message set.",
179
+ "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.",
173
180
  "fields": [],
174
181
  "unsupported": [
175
182
  {
176
183
  "case": "read",
177
184
  "error": "UNSUPPORTED_BY_DESKTOP",
178
185
  "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.",
179
- "workaround": "Store documents in your own system keyed by the TenkeyBridge entity Id \u2014 that is what QBD integrations have always had to do."
186
+ "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."
180
187
  },
181
188
  {
182
189
  "case": "query",
@@ -207,7 +214,7 @@ var CATALOG = {
207
214
  "read": "full",
208
215
  "write": "full",
209
216
  "headline": "Batch envelope \u2014 up to 30 create/update/delete/query operations in one request, executed sequentially with per-item faults.",
210
- "usage": "POST /v3/company/{realmId}/batch",
217
+ "usage": "POST /v3/company/{companyId}/batch",
211
218
  "fields": [
212
219
  {
213
220
  "qbo": "bId",
@@ -254,7 +261,7 @@ var CATALOG = {
254
261
  {
255
262
  "case": "entity CRUD or /query on Batch itself",
256
263
  "error": "UNSUPPORTED_BY_DESKTOP",
257
- "note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{realmId}/batch."
264
+ "note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{companyId}/batch."
258
265
  }
259
266
  ]
260
267
  },
@@ -467,7 +474,7 @@ var CATALOG = {
467
474
  "case": "query \u2014 SELECT * cannot enumerate every budget",
468
475
  "error": "UNSUPPORTED_QUERY",
469
476
  "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.",
470
- "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."
477
+ "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."
471
478
  },
472
479
  {
473
480
  "case": "query \u2014 WHERE on anything but Id, ORDERBY, COUNT(*), column lists",
@@ -516,7 +523,7 @@ var CATALOG = {
516
523
  "read": "full",
517
524
  "write": "none",
518
525
  "headline": "Change Data Capture \u2014 one poll returns changed + deleted records across entities.",
519
- "usage": "GET /v3/company/{realmId}/cdc?entities=Invoice,Customer&changedSince=2026-07-01",
526
+ "usage": "GET /v3/company/{companyId}/cdc?entities=Invoice,Customer&changedSince=2026-07-01",
520
527
  "fields": [
521
528
  {
522
529
  "qbo": "entities",
@@ -633,7 +640,7 @@ var CATALOG = {
633
640
  "group": "company",
634
641
  "read": "full",
635
642
  "write": "none",
636
- "headline": "Read-only; Id equals the realm ID, no Desktop write path",
643
+ "headline": "Read-only; Id equals the Company ID, no Desktop write path",
637
644
  "fields": [
638
645
  {
639
646
  "qbo": "CompanyName",
@@ -773,6 +780,17 @@ var CATALOG = {
773
780
  "qbo": "CustomerRef",
774
781
  "support": "full"
775
782
  },
783
+ {
784
+ "qbo": "ClassRef",
785
+ "support": "full",
786
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
787
+ },
788
+ {
789
+ "qbo": "DepartmentRef",
790
+ "support": "none",
791
+ "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.",
792
+ "error": "UNMAPPED_FIELD"
793
+ },
776
794
  {
777
795
  "qbo": "TxnDate",
778
796
  "support": "full"
@@ -1064,35 +1082,84 @@ var CATALOG = {
1064
1082
  "group": "gaps",
1065
1083
  "read": "none",
1066
1084
  "write": "none",
1067
- "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.",
1068
- "fields": [],
1085
+ "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).",
1086
+ "fields": [
1087
+ {
1088
+ "qbo": "Id",
1089
+ "support": "partial",
1090
+ "note": "Only with Departments from classes on: the Class ListID."
1091
+ },
1092
+ {
1093
+ "qbo": "Name",
1094
+ "support": "partial",
1095
+ "note": "Only with Departments from classes on: the Class Name (31 characters max)."
1096
+ },
1097
+ {
1098
+ "qbo": "SubDepartment",
1099
+ "support": "partial",
1100
+ "note": "Only with Departments from classes on: read-only, true when the class has a parent."
1101
+ },
1102
+ {
1103
+ "qbo": "ParentRef",
1104
+ "support": "partial",
1105
+ "note": "Only with Departments from classes on: the parent class."
1106
+ },
1107
+ {
1108
+ "qbo": "FullyQualifiedName",
1109
+ "support": "partial",
1110
+ "note": "Only with Departments from classes on: the class full name (Parent:Child). Read-only."
1111
+ },
1112
+ {
1113
+ "qbo": "Active",
1114
+ "support": "partial",
1115
+ "note": "Only with Departments from classes on: class IsActive. Deactivate with Active:false."
1116
+ },
1117
+ {
1118
+ "qbo": "SyncToken",
1119
+ "support": "partial",
1120
+ "note": "Only with Departments from classes on: the class EditSequence."
1121
+ },
1122
+ {
1123
+ "qbo": "MetaData",
1124
+ "support": "partial",
1125
+ "note": "Only with Departments from classes on: class TimeCreated / TimeModified."
1126
+ }
1127
+ ],
1069
1128
  "unsupported": [
1070
1129
  {
1071
1130
  "case": "read",
1072
1131
  "error": "UNSUPPORTED_BY_DESKTOP",
1073
- "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.",
1074
- "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."
1132
+ "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.",
1133
+ "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."
1075
1134
  },
1076
1135
  {
1077
1136
  "case": "query",
1078
1137
  "error": "UNSUPPORTED_BY_DESKTOP",
1079
- "note": "qbXML has no Department/Location list to query \u2014 confirmed absent from the qbxmlops130 message set.",
1080
- "workaround": "Query Class instead if you remap locations client-side; that remapping is your call, TenkeyBridge never reinterprets DepartmentRef silently."
1138
+ "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.",
1139
+ "workaround": "Turn on Departments from classes, or query Class directly."
1081
1140
  },
1082
1141
  {
1083
1142
  "case": "create",
1084
1143
  "error": "UNSUPPORTED_BY_DESKTOP",
1085
- "note": "Desktop has no Department create. Use Class if you need a dimensional axis on Desktop."
1144
+ "note": "Off by default. With Departments from classes on, creating a Department creates a Class (ParentRef makes it a sub-class).",
1145
+ "workaround": "Turn on Departments from classes, or create a Class."
1086
1146
  },
1087
1147
  {
1088
1148
  "case": "update",
1089
1149
  "error": "UNSUPPORTED_BY_DESKTOP",
1090
- "note": "Desktop has no Department update."
1150
+ "note": "Off by default. With Departments from classes on, an update edits the Class (sparse; Name, Active, ParentRef).",
1151
+ "workaround": "Turn on Departments from classes, or update the Class."
1091
1152
  },
1092
1153
  {
1093
1154
  "case": "delete",
1094
1155
  "error": "UNSUPPORTED_BY_DESKTOP",
1095
- "note": "Desktop has no Department delete."
1156
+ "note": "Always unsupported: a Desktop class cannot be deleted through qbXML. Deactivate with Active:false."
1157
+ },
1158
+ {
1159
+ "case": "DepartmentRef on a transaction",
1160
+ "error": "UNSUPPORTED_BY_DESKTOP",
1161
+ "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.",
1162
+ "workaround": "Set ClassRef on each line for those transactions."
1096
1163
  }
1097
1164
  ]
1098
1165
  },
@@ -1267,8 +1334,8 @@ var CATALOG = {
1267
1334
  "group": "platform",
1268
1335
  "read": "partial",
1269
1336
  "write": "none",
1270
- "headline": "GET /v3/company/{realmId}/entitlements \u2014 a static, honest capability document for a QuickBooks Desktop company (no per-file subscription data).",
1271
- "usage": "GET /v3/company/{realmId}/entitlements",
1337
+ "headline": "GET /v3/company/{companyId}/entitlements \u2014 a static, honest capability document for a QuickBooks Desktop company (no per-file subscription data).",
1338
+ "usage": "GET /v3/company/{companyId}/entitlements",
1272
1339
  "fields": [
1273
1340
  {
1274
1341
  "qbo": "Entitlements.platform",
@@ -1301,6 +1368,17 @@ var CATALOG = {
1301
1368
  "qbo": "CustomerRef",
1302
1369
  "support": "full"
1303
1370
  },
1371
+ {
1372
+ "qbo": "ClassRef",
1373
+ "support": "full",
1374
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
1375
+ },
1376
+ {
1377
+ "qbo": "DepartmentRef",
1378
+ "support": "none",
1379
+ "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.",
1380
+ "error": "UNMAPPED_FIELD"
1381
+ },
1304
1382
  {
1305
1383
  "qbo": "TxnDate",
1306
1384
  "support": "full"
@@ -1530,6 +1608,17 @@ var CATALOG = {
1530
1608
  "qbo": "CustomerRef",
1531
1609
  "support": "full"
1532
1610
  },
1611
+ {
1612
+ "qbo": "ClassRef",
1613
+ "support": "full",
1614
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
1615
+ },
1616
+ {
1617
+ "qbo": "DepartmentRef",
1618
+ "support": "none",
1619
+ "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.",
1620
+ "error": "UNMAPPED_FIELD"
1621
+ },
1533
1622
  {
1534
1623
  "qbo": "TxnDate",
1535
1624
  "support": "full"
@@ -2010,7 +2099,7 @@ var CATALOG = {
2010
2099
  {
2011
2100
  "qbo": "AccountingInfoPrefs",
2012
2101
  "support": "partial",
2013
- "note": "ClassTrackingPerTxn/ClassTrackingPerTxnLine \u2190 IsUsingClassTracking (same bool projected to both); TrackDepartments always false (no Desktop Locations)."
2102
+ "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)."
2014
2103
  },
2015
2104
  {
2016
2105
  "qbo": "CurrencyPrefs",
@@ -2173,6 +2262,17 @@ var CATALOG = {
2173
2262
  "qbo": "VendorRef",
2174
2263
  "support": "full"
2175
2264
  },
2265
+ {
2266
+ "qbo": "ClassRef",
2267
+ "support": "full",
2268
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
2269
+ },
2270
+ {
2271
+ "qbo": "DepartmentRef",
2272
+ "support": "none",
2273
+ "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.",
2274
+ "error": "UNMAPPED_FIELD"
2275
+ },
2176
2276
  {
2177
2277
  "qbo": "TxnDate",
2178
2278
  "support": "full"
@@ -2409,8 +2509,8 @@ var CATALOG = {
2409
2509
  "group": "platform",
2410
2510
  "read": "partial",
2411
2511
  "write": "none",
2412
- "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.",
2413
- "usage": "GET /v3/company/{realmId}/reports/ProfitAndLoss?start_date=2026-01-01&end_date=2026-12-31&summarize_column_by=Month",
2512
+ "headline": "Forty-eight QBO-compatible reports served from QuickBooks Desktop: 24 translated live from Desktop's report engine (summary, detail, aging, balance, sales and sales-tax reports), 22 Desktop extension reports with no QBO twin, and two composites, AccountList (built from Desktop's account list) and CashFlow (built from several queries). CashFlow is derived, not translated: Desktop's SDK has no cash-flow report, so it is computed from Profit and Loss and two Trial Balances and checked against Desktop before it is returned.",
2513
+ "usage": "GET /v3/company/{companyId}/reports/ProfitAndLoss?start_date=2026-01-01&end_date=2026-12-31&summarize_column_by=Month",
2414
2514
  "fields": [
2415
2515
  {
2416
2516
  "qbo": "ProfitAndLoss / BalanceSheet / TrialBalance",
@@ -2452,6 +2552,16 @@ var CATALOG = {
2452
2552
  "support": "partial",
2453
2553
  "note": "GeneralDetailReportQueryRq Journal / TxnListByDate. ColKeys best-effort. Journal's per-transaction unlabeled subtotals become header-less Sections; TransactionList is a flat Data list. Desktop refuses ReportBasis on both, so accounting_method faults."
2454
2554
  },
2555
+ {
2556
+ "qbo": "InventoryValuationDetail / TransactionListByCustomer / TransactionListByVendor",
2557
+ "support": "partial",
2558
+ "note": "GeneralDetailReportQueryRq InventoryValuationDetail / TxnListByCustomer / TxnListByVendor. ColKeys best-effort. Desktop refuses ReportBasis on all three (3151), so accounting_method faults. InventoryValuationDetail takes the item filter only."
2559
+ },
2560
+ {
2561
+ "qbo": "TaxSummary",
2562
+ "support": "partial",
2563
+ "note": "Desktop's Sales Tax Liability report (GeneralSummaryReportQueryRq SalesTaxLiability): taxable and non-taxable sales and tax collected. accounting_method is honored. Desktop refuses SummarizeColumnsBy here, so summarize_column_by takes Total only."
2564
+ },
2455
2565
  {
2456
2566
  "qbo": "CustomerBalanceDetail / VendorBalanceDetail",
2457
2567
  "support": "partial",
@@ -2462,6 +2572,21 @@ var CATALOG = {
2462
2572
  "support": "partial",
2463
2573
  "note": "AgingReportQueryRq ARAgingDetail / APAgingDetail, as-of (report_date), with the receivable (customer) or payable (vendor) filter. ColKeys best-effort."
2464
2574
  },
2575
+ {
2576
+ "qbo": "CashFlow",
2577
+ "support": "partial",
2578
+ "note": "Derived (TkbDerivedReport): Desktop's SDK has no cash-flow report, so TenkeyBridge builds the indirect-method statement from Desktop's Profit and Loss and two Trial Balances, classified by account type. Bank accounts plus Undeposited Funds count as cash, as in QBO. Fixed Asset accounts, including accumulated depreciation, are investing (Desktop's own default classification). Self-checking: if the derived net income differs from Desktop's by a cent, or a trial-balance row cannot be matched to an account, the call fails with REPORT_COMPOSE_FAILED (502) instead of answering. Five QuickBooks round trips. Sandbox realms serve it from captured sample inputs (SandboxStaticReport)."
2579
+ },
2580
+ {
2581
+ "qbo": "AccountList",
2582
+ "support": "partial",
2583
+ "note": "Built from Desktop's account list (AccountQueryRq). Desktop has no account detail type, so that column is absent."
2584
+ },
2585
+ {
2586
+ "qbo": "Desktop extension reports",
2587
+ "support": "full",
2588
+ "note": "ProfitAndLossByClass, ProfitAndLossByJob, ProfitAndLossPrevYearComp, ProfitAndLossYTDComp, BalanceSheetPrevYearComp, BalanceSheetByClass, PurchaseByVendorSummary, PurchaseByItemSummary, SalesByRepSummary, InventoryStockStatusByItem, OpenInvoices, UnpaidBillsDetail, OpenPOs, SalesByCustomerDetail, SalesByItemDetail, IncomeByCustomerDetail, ExpenseByVendorDetail, PurchaseByVendorDetail, DepositDetail, CheckDetail, BalanceSheetDetail, CollectionsReport. Desktop reports with no QBO twin, served under their Desktop names in the same QBO report JSON."
2589
+ },
2465
2590
  {
2466
2591
  "qbo": "start_date / end_date / date_macro",
2467
2592
  "support": "full",
@@ -2490,6 +2615,30 @@ var CATALOG = {
2490
2615
  "note": "Comma-separated Ids \u2192 ReportEntityFilter (customer + vendor) / ReportItemFilter / ReportClassFilter. AR reports accept customer only, AP reports vendor only; InventoryValuationSummary accepts item only.",
2491
2616
  "error": "REPORT_UNSUPPORTED_OPTION"
2492
2617
  },
2618
+ {
2619
+ "qbo": "account / account_type",
2620
+ "support": "partial",
2621
+ "note": "account is comma-separated account Ids (ReportAccountFilter ListID); account_type is one QBO account type (Bank, AccountsReceivable, OtherCurrentAsset, FixedAsset, OtherAsset, AccountsPayable, CreditCard, OtherCurrentLiability, LongTermLiability, Equity, Income, CostOfGoodsSold, Expense, OtherIncome, OtherExpense) mapped to AccountTypeFilter. Sending both faults. Accepted on the summary reports (except InventoryValuationSummary) and on every detail report except AgedReceivableDetail / AgedPayableDetail. The aging reports refuse both: Desktop's aging account filter does not filter meaningfully.",
2622
+ "error": "REPORT_UNSUPPORTED_OPTION"
2623
+ },
2624
+ {
2625
+ "qbo": "transaction_type",
2626
+ "support": "partial",
2627
+ "note": "Comma-separated QBO transaction types (Invoice, CreditMemo, SalesReceipt, Payment, Deposit, Transfer, Estimate, Bill, VendorCredit, BillPayment, BillPaymentCheck, BillPaymentCreditCard, Check, CreditCardCharge, CreditCardCredit, PurchaseOrder, JournalEntry, InventoryQuantityAdjustment) mapped to ReportTxnTypeFilter. BillPayment fans out to both check and credit-card bill payments. Types with no single Desktop twin (Expense, CashPurchase, RefundReceipt) fault. Accepted on summary, detail and aging reports (not InventoryValuationSummary).",
2628
+ "error": "REPORT_UNSUPPORTED_OPTION"
2629
+ },
2630
+ {
2631
+ "qbo": "start_moddate / end_moddate",
2632
+ "support": "partial",
2633
+ "note": "ISO dates that filter on the transaction last-modified date (ReportModifiedDateRangeFilter). Both are required together, otherwise REPORT_INVALID_DATE. Detail reports only (not AgedReceivableDetail / AgedPayableDetail); summary and aging reports refuse them.",
2634
+ "error": "REPORT_INVALID_DATE"
2635
+ },
2636
+ {
2637
+ "qbo": "columns",
2638
+ "support": "partial",
2639
+ "note": "Comma-separated QBO ColKeys (tx_date, txn_type, doc_num, txn_num, name, cust_name, vend_name, memo, account_name, split_acc, klass_name, is_cleared, debt_amt, credit_amt, subt_nat_amount, rbal_nat_amount, subt_open_bal, due_date, past_due, po_num, term_name) mapped to IncludeColumn; aliases dedupe and an unknown key faults listing the accepted ones. Detail reports and AgedReceivableDetail / AgedPayableDetail only. When columns is sent, data rows carry the QuickBooks transaction id as id on the txn_type cell (GeneralLedger cost-posting rows have none). If txn_type is not among the requested columns, the id is on the first cell.",
2640
+ "error": "REPORT_UNSUPPORTED_OPTION"
2641
+ },
2493
2642
  {
2494
2643
  "qbo": "Column titles",
2495
2644
  "support": "partial",
@@ -2498,14 +2647,9 @@ var CATALOG = {
2498
2647
  ],
2499
2648
  "unsupported": [
2500
2649
  {
2501
- "case": "CashFlow",
2502
- "error": "REPORT_UNKNOWN",
2503
- "note": "QuickBooks Desktop's SDK has no cash-flow report (StatementOfCashFlows is refused with 3110 on every qbXML version)."
2504
- },
2505
- {
2506
- "case": "columns / department / qzurl / adjusted_gain_loss",
2650
+ "case": "department / qzurl / adjusted_gain_loss",
2507
2651
  "error": "REPORT_UNSUPPORTED_OPTION",
2508
- "note": "Column selection has no qbXML equivalent; Desktop has no departments (use class); QuickZoom URLs and multicurrency gain/loss adjustment are QBO-only."
2652
+ "note": "Desktop has no departments (use class); QuickZoom URLs and multicurrency gain/loss adjustment are QBO-only."
2509
2653
  },
2510
2654
  {
2511
2655
  "case": "aging_period / num_periods / aging_method",
@@ -2518,7 +2662,17 @@ var CATALOG = {
2518
2662
  "note": "qbXML's SummarizeColumnsBy has no per-item, per-employee or per-location split (ItemType splits by item type, not by item)."
2519
2663
  },
2520
2664
  {
2521
- "case": "other QBO report names (class/department sales, tax, account list, ...)",
2665
+ "case": "ClassSales / DepartmentSales",
2666
+ "error": "REPORT_UNKNOWN",
2667
+ "note": "No Desktop SDK report. Use ProfitAndLoss?summarize_column_by=Classes."
2668
+ },
2669
+ {
2670
+ "case": "TransactionListWithSplits",
2671
+ "error": "REPORT_UNKNOWN",
2672
+ "note": "No Desktop SDK report of that name. Use JournalReport."
2673
+ },
2674
+ {
2675
+ "case": "other QBO report names",
2522
2676
  "error": "REPORT_UNKNOWN",
2523
2677
  "note": "Not shipped. The fault lists the supported reports."
2524
2678
  }
@@ -2536,6 +2690,17 @@ var CATALOG = {
2536
2690
  "qbo": "CustomerRef",
2537
2691
  "support": "full"
2538
2692
  },
2693
+ {
2694
+ "qbo": "ClassRef",
2695
+ "support": "full",
2696
+ "note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
2697
+ },
2698
+ {
2699
+ "qbo": "DepartmentRef",
2700
+ "support": "none",
2701
+ "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.",
2702
+ "error": "UNMAPPED_FIELD"
2703
+ },
2539
2704
  {
2540
2705
  "qbo": "TxnDate",
2541
2706
  "support": "full"
@@ -2984,6 +3149,12 @@ var CATALOG = {
2984
3149
  "qbo": "ClassRef",
2985
3150
  "support": "full"
2986
3151
  },
3152
+ {
3153
+ "qbo": "DepartmentRef",
3154
+ "support": "none",
3155
+ "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.",
3156
+ "error": "UNMAPPED_FIELD"
3157
+ },
2987
3158
  {
2988
3159
  "qbo": "Description",
2989
3160
  "support": "full",
@@ -3421,7 +3592,7 @@ function unknownEntity(name) {
3421
3592
  if (gap) {
3422
3593
  if (gap.verdict === "live") {
3423
3594
  return fail(
3424
- `${gap.entity} is a platform endpoint, not reachable through this server's entity tools. Call the REST API directly: ${gap.usage}. Detail: compat://entity/${gap.entity.toLowerCase()}`
3595
+ `${gap.entity} is a platform endpoint, not reachable through this server's entity tools. ${gap.entity === "Reports" ? "Use the run_report tool." : `Call the REST API directly: ${gap.usage}.`} Detail: compat://entity/${gap.entity.toLowerCase()}`
3425
3596
  );
3426
3597
  }
3427
3598
  const cases = gap.unsupported.map((u) => `- ${u.case}: ${u.error}${u.workaround ? ` \u2014 workaround: ${u.workaround}` : ""}`).join("\n");
@@ -3469,6 +3640,24 @@ function registerTools(server, client) {
3469
3640
  }
3470
3641
  }
3471
3642
  );
3643
+ server.registerTool(
3644
+ "run_report",
3645
+ {
3646
+ 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. Read compat://entity/reports for the available reports and which params each takes.",
3647
+ inputSchema: {
3648
+ report: z.string().describe('Report name, e.g. "ProfitAndLoss" (case-insensitive).'),
3649
+ params: z.record(z.string()).optional().describe('Query params, e.g. { "date_macro": "Last Month" }.')
3650
+ }
3651
+ },
3652
+ async ({ report, params }) => {
3653
+ if (!client.report) return fail("This TenkeyBridge client has no report() method; upgrade @tenkeybridge/client to 0.5.0.");
3654
+ try {
3655
+ return ok(await client.report(report, params ?? {}));
3656
+ } catch (err) {
3657
+ return failure(err);
3658
+ }
3659
+ }
3660
+ );
3472
3661
  server.registerTool(
3473
3662
  "get",
3474
3663
  {
@@ -3583,7 +3772,7 @@ function registerTools(server, client) {
3583
3772
  }
3584
3773
 
3585
3774
  // src/version.ts
3586
- var PKG_VERSION = "0.3.0";
3775
+ var PKG_VERSION = "0.5.0";
3587
3776
 
3588
3777
  // src/server.ts
3589
3778
  var SERVER_NAME = "tenkeybridge";
@@ -3597,8 +3786,9 @@ function buildServer(client) {
3597
3786
  // src/cli.ts
3598
3787
  async function main() {
3599
3788
  const config = loadConfig(process.env);
3789
+ for (const note of config.deprecations) console.error(`tenkeybridge-mcp: ${note}`);
3600
3790
  const client = new TenkeyBridgeClient({
3601
- realmId: config.realmId,
3791
+ companyId: config.companyId,
3602
3792
  ...config.baseUrl ? { baseUrl: config.baseUrl } : {},
3603
3793
  auth: "accessToken" in config.auth ? config.auth : {
3604
3794
  ...config.auth,
@@ -3617,7 +3807,7 @@ async function main() {
3617
3807
  void _seamCheck;
3618
3808
  const server = buildServer(client);
3619
3809
  await server.connect(new StdioServerTransport());
3620
- console.error(`tenkeybridge-mcp: serving realm ${config.realmId}`);
3810
+ console.error(`tenkeybridge-mcp: serving company ${config.companyId}`);
3621
3811
  }
3622
3812
  main().catch((err) => {
3623
3813
  console.error(`tenkeybridge-mcp: ${err instanceof Error ? err.message : String(err)}`);