@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 +4 -4
- package/dist/cli.js +232 -42
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +229 -40
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +229 -40
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -17,6 +17,7 @@ interface EntityAccessorLike {
|
|
|
17
17
|
}
|
|
18
18
|
type GatewayClient = Record<string, unknown> & {
|
|
19
19
|
query(entity: string, opts?: QueryOptions): Promise<unknown>;
|
|
20
|
+
report?(name: string, params?: Record<string, string>): Promise<unknown>;
|
|
20
21
|
};
|
|
21
22
|
declare function registerTools(server: McpServer, client: GatewayClient): void;
|
|
22
23
|
|
|
@@ -33,12 +34,14 @@ type McpAuth = {
|
|
|
33
34
|
refreshToken: string;
|
|
34
35
|
};
|
|
35
36
|
interface McpConfig {
|
|
36
|
-
|
|
37
|
+
companyId: string;
|
|
37
38
|
baseUrl?: string;
|
|
38
39
|
auth: McpAuth;
|
|
39
40
|
tokenFile?: string;
|
|
41
|
+
/** Human-readable notes the CLI prints to stderr (deprecated env vars). */
|
|
42
|
+
deprecations: string[];
|
|
40
43
|
}
|
|
41
|
-
declare function defaultTokenFile(
|
|
44
|
+
declare function defaultTokenFile(companyId: string): string;
|
|
42
45
|
declare function loadConfig(env: Record<string, string | undefined>): McpConfig;
|
|
43
46
|
declare function readStoredRefreshToken(file: string): string | undefined;
|
|
44
47
|
declare function persistRefreshToken(file: string, refreshToken: string): void;
|
|
@@ -73,6 +76,6 @@ declare function resolveEntityName(name: string): EntityName | undefined;
|
|
|
73
76
|
type CatalogSummaryRow = Pick<CatalogEntry, "entity" | "verdict" | "group" | "read" | "write" | "headline" | "usage">;
|
|
74
77
|
declare function catalogSummary(): CatalogSummaryRow[];
|
|
75
78
|
|
|
76
|
-
declare const PKG_VERSION = "0.
|
|
79
|
+
declare const PKG_VERSION = "0.5.0";
|
|
77
80
|
|
|
78
81
|
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 };
|
package/dist/index.d.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface EntityAccessorLike {
|
|
|
17
17
|
}
|
|
18
18
|
type GatewayClient = Record<string, unknown> & {
|
|
19
19
|
query(entity: string, opts?: QueryOptions): Promise<unknown>;
|
|
20
|
+
report?(name: string, params?: Record<string, string>): Promise<unknown>;
|
|
20
21
|
};
|
|
21
22
|
declare function registerTools(server: McpServer, client: GatewayClient): void;
|
|
22
23
|
|
|
@@ -33,12 +34,14 @@ type McpAuth = {
|
|
|
33
34
|
refreshToken: string;
|
|
34
35
|
};
|
|
35
36
|
interface McpConfig {
|
|
36
|
-
|
|
37
|
+
companyId: string;
|
|
37
38
|
baseUrl?: string;
|
|
38
39
|
auth: McpAuth;
|
|
39
40
|
tokenFile?: string;
|
|
41
|
+
/** Human-readable notes the CLI prints to stderr (deprecated env vars). */
|
|
42
|
+
deprecations: string[];
|
|
40
43
|
}
|
|
41
|
-
declare function defaultTokenFile(
|
|
44
|
+
declare function defaultTokenFile(companyId: string): string;
|
|
42
45
|
declare function loadConfig(env: Record<string, string | undefined>): McpConfig;
|
|
43
46
|
declare function readStoredRefreshToken(file: string): string | undefined;
|
|
44
47
|
declare function persistRefreshToken(file: string, refreshToken: string): void;
|
|
@@ -73,6 +76,6 @@ declare function resolveEntityName(name: string): EntityName | undefined;
|
|
|
73
76
|
type CatalogSummaryRow = Pick<CatalogEntry, "entity" | "verdict" | "group" | "read" | "write" | "headline" | "usage">;
|
|
74
77
|
declare function catalogSummary(): CatalogSummaryRow[];
|
|
75
78
|
|
|
76
|
-
declare const PKG_VERSION = "0.
|
|
79
|
+
declare const PKG_VERSION = "0.5.0";
|
|
77
80
|
|
|
78
81
|
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 };
|
package/dist/index.js
CHANGED
|
@@ -106,14 +106,14 @@ var CATALOG = {
|
|
|
106
106
|
"group": "gaps",
|
|
107
107
|
"read": "none",
|
|
108
108
|
"write": "none",
|
|
109
|
-
"headline": "QuickBooks Desktop
|
|
109
|
+
"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.",
|
|
110
110
|
"fields": [],
|
|
111
111
|
"unsupported": [
|
|
112
112
|
{
|
|
113
113
|
"case": "read",
|
|
114
114
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
115
115
|
"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.",
|
|
116
|
-
"workaround": "Store documents in your own system keyed by the TenkeyBridge entity Id
|
|
116
|
+
"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."
|
|
117
117
|
},
|
|
118
118
|
{
|
|
119
119
|
"case": "query",
|
|
@@ -144,7 +144,7 @@ var CATALOG = {
|
|
|
144
144
|
"read": "full",
|
|
145
145
|
"write": "full",
|
|
146
146
|
"headline": "Batch envelope \u2014 up to 30 create/update/delete/query operations in one request, executed sequentially with per-item faults.",
|
|
147
|
-
"usage": "POST /v3/company/{
|
|
147
|
+
"usage": "POST /v3/company/{companyId}/batch",
|
|
148
148
|
"fields": [
|
|
149
149
|
{
|
|
150
150
|
"qbo": "bId",
|
|
@@ -191,7 +191,7 @@ var CATALOG = {
|
|
|
191
191
|
{
|
|
192
192
|
"case": "entity CRUD or /query on Batch itself",
|
|
193
193
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
194
|
-
"note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{
|
|
194
|
+
"note": "Batch is a platform endpoint, not an entity \u2014 POST /v3/company/{companyId}/batch."
|
|
195
195
|
}
|
|
196
196
|
]
|
|
197
197
|
},
|
|
@@ -404,7 +404,7 @@ var CATALOG = {
|
|
|
404
404
|
"case": "query \u2014 SELECT * cannot enumerate every budget",
|
|
405
405
|
"error": "UNSUPPORTED_QUERY",
|
|
406
406
|
"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.",
|
|
407
|
-
"workaround": "Fetch it by id: GET /v3/company/{
|
|
407
|
+
"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."
|
|
408
408
|
},
|
|
409
409
|
{
|
|
410
410
|
"case": "query \u2014 WHERE on anything but Id, ORDERBY, COUNT(*), column lists",
|
|
@@ -453,7 +453,7 @@ var CATALOG = {
|
|
|
453
453
|
"read": "full",
|
|
454
454
|
"write": "none",
|
|
455
455
|
"headline": "Change Data Capture \u2014 one poll returns changed + deleted records across entities.",
|
|
456
|
-
"usage": "GET /v3/company/{
|
|
456
|
+
"usage": "GET /v3/company/{companyId}/cdc?entities=Invoice,Customer&changedSince=2026-07-01",
|
|
457
457
|
"fields": [
|
|
458
458
|
{
|
|
459
459
|
"qbo": "entities",
|
|
@@ -570,7 +570,7 @@ var CATALOG = {
|
|
|
570
570
|
"group": "company",
|
|
571
571
|
"read": "full",
|
|
572
572
|
"write": "none",
|
|
573
|
-
"headline": "Read-only; Id equals the
|
|
573
|
+
"headline": "Read-only; Id equals the Company ID, no Desktop write path",
|
|
574
574
|
"fields": [
|
|
575
575
|
{
|
|
576
576
|
"qbo": "CompanyName",
|
|
@@ -710,6 +710,17 @@ var CATALOG = {
|
|
|
710
710
|
"qbo": "CustomerRef",
|
|
711
711
|
"support": "full"
|
|
712
712
|
},
|
|
713
|
+
{
|
|
714
|
+
"qbo": "ClassRef",
|
|
715
|
+
"support": "full",
|
|
716
|
+
"note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
"qbo": "DepartmentRef",
|
|
720
|
+
"support": "none",
|
|
721
|
+
"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.",
|
|
722
|
+
"error": "UNMAPPED_FIELD"
|
|
723
|
+
},
|
|
713
724
|
{
|
|
714
725
|
"qbo": "TxnDate",
|
|
715
726
|
"support": "full"
|
|
@@ -1001,35 +1012,84 @@ var CATALOG = {
|
|
|
1001
1012
|
"group": "gaps",
|
|
1002
1013
|
"read": "none",
|
|
1003
1014
|
"write": "none",
|
|
1004
|
-
"headline": "
|
|
1005
|
-
"fields": [
|
|
1015
|
+
"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).",
|
|
1016
|
+
"fields": [
|
|
1017
|
+
{
|
|
1018
|
+
"qbo": "Id",
|
|
1019
|
+
"support": "partial",
|
|
1020
|
+
"note": "Only with Departments from classes on: the Class ListID."
|
|
1021
|
+
},
|
|
1022
|
+
{
|
|
1023
|
+
"qbo": "Name",
|
|
1024
|
+
"support": "partial",
|
|
1025
|
+
"note": "Only with Departments from classes on: the Class Name (31 characters max)."
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
"qbo": "SubDepartment",
|
|
1029
|
+
"support": "partial",
|
|
1030
|
+
"note": "Only with Departments from classes on: read-only, true when the class has a parent."
|
|
1031
|
+
},
|
|
1032
|
+
{
|
|
1033
|
+
"qbo": "ParentRef",
|
|
1034
|
+
"support": "partial",
|
|
1035
|
+
"note": "Only with Departments from classes on: the parent class."
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
"qbo": "FullyQualifiedName",
|
|
1039
|
+
"support": "partial",
|
|
1040
|
+
"note": "Only with Departments from classes on: the class full name (Parent:Child). Read-only."
|
|
1041
|
+
},
|
|
1042
|
+
{
|
|
1043
|
+
"qbo": "Active",
|
|
1044
|
+
"support": "partial",
|
|
1045
|
+
"note": "Only with Departments from classes on: class IsActive. Deactivate with Active:false."
|
|
1046
|
+
},
|
|
1047
|
+
{
|
|
1048
|
+
"qbo": "SyncToken",
|
|
1049
|
+
"support": "partial",
|
|
1050
|
+
"note": "Only with Departments from classes on: the class EditSequence."
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
"qbo": "MetaData",
|
|
1054
|
+
"support": "partial",
|
|
1055
|
+
"note": "Only with Departments from classes on: class TimeCreated / TimeModified."
|
|
1056
|
+
}
|
|
1057
|
+
],
|
|
1006
1058
|
"unsupported": [
|
|
1007
1059
|
{
|
|
1008
1060
|
"case": "read",
|
|
1009
1061
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1010
|
-
"note": "Re-audited 2026-07-29 against the qbxmlops130 message set: qbXML has no Department or Location list
|
|
1011
|
-
"workaround": "
|
|
1062
|
+
"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.",
|
|
1063
|
+
"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."
|
|
1012
1064
|
},
|
|
1013
1065
|
{
|
|
1014
1066
|
"case": "query",
|
|
1015
1067
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1016
|
-
"note": "
|
|
1017
|
-
"workaround": "
|
|
1068
|
+
"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.",
|
|
1069
|
+
"workaround": "Turn on Departments from classes, or query Class directly."
|
|
1018
1070
|
},
|
|
1019
1071
|
{
|
|
1020
1072
|
"case": "create",
|
|
1021
1073
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1022
|
-
"note": "
|
|
1074
|
+
"note": "Off by default. With Departments from classes on, creating a Department creates a Class (ParentRef makes it a sub-class).",
|
|
1075
|
+
"workaround": "Turn on Departments from classes, or create a Class."
|
|
1023
1076
|
},
|
|
1024
1077
|
{
|
|
1025
1078
|
"case": "update",
|
|
1026
1079
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1027
|
-
"note": "
|
|
1080
|
+
"note": "Off by default. With Departments from classes on, an update edits the Class (sparse; Name, Active, ParentRef).",
|
|
1081
|
+
"workaround": "Turn on Departments from classes, or update the Class."
|
|
1028
1082
|
},
|
|
1029
1083
|
{
|
|
1030
1084
|
"case": "delete",
|
|
1031
1085
|
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1032
|
-
"note": "Desktop
|
|
1086
|
+
"note": "Always unsupported: a Desktop class cannot be deleted through qbXML. Deactivate with Active:false."
|
|
1087
|
+
},
|
|
1088
|
+
{
|
|
1089
|
+
"case": "DepartmentRef on a transaction",
|
|
1090
|
+
"error": "UNSUPPORTED_BY_DESKTOP",
|
|
1091
|
+
"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.",
|
|
1092
|
+
"workaround": "Set ClassRef on each line for those transactions."
|
|
1033
1093
|
}
|
|
1034
1094
|
]
|
|
1035
1095
|
},
|
|
@@ -1204,8 +1264,8 @@ var CATALOG = {
|
|
|
1204
1264
|
"group": "platform",
|
|
1205
1265
|
"read": "partial",
|
|
1206
1266
|
"write": "none",
|
|
1207
|
-
"headline": "GET /v3/company/{
|
|
1208
|
-
"usage": "GET /v3/company/{
|
|
1267
|
+
"headline": "GET /v3/company/{companyId}/entitlements \u2014 a static, honest capability document for a QuickBooks Desktop company (no per-file subscription data).",
|
|
1268
|
+
"usage": "GET /v3/company/{companyId}/entitlements",
|
|
1209
1269
|
"fields": [
|
|
1210
1270
|
{
|
|
1211
1271
|
"qbo": "Entitlements.platform",
|
|
@@ -1238,6 +1298,17 @@ var CATALOG = {
|
|
|
1238
1298
|
"qbo": "CustomerRef",
|
|
1239
1299
|
"support": "full"
|
|
1240
1300
|
},
|
|
1301
|
+
{
|
|
1302
|
+
"qbo": "ClassRef",
|
|
1303
|
+
"support": "full",
|
|
1304
|
+
"note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
"qbo": "DepartmentRef",
|
|
1308
|
+
"support": "none",
|
|
1309
|
+
"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.",
|
|
1310
|
+
"error": "UNMAPPED_FIELD"
|
|
1311
|
+
},
|
|
1241
1312
|
{
|
|
1242
1313
|
"qbo": "TxnDate",
|
|
1243
1314
|
"support": "full"
|
|
@@ -1467,6 +1538,17 @@ var CATALOG = {
|
|
|
1467
1538
|
"qbo": "CustomerRef",
|
|
1468
1539
|
"support": "full"
|
|
1469
1540
|
},
|
|
1541
|
+
{
|
|
1542
|
+
"qbo": "ClassRef",
|
|
1543
|
+
"support": "full",
|
|
1544
|
+
"note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
|
|
1545
|
+
},
|
|
1546
|
+
{
|
|
1547
|
+
"qbo": "DepartmentRef",
|
|
1548
|
+
"support": "none",
|
|
1549
|
+
"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.",
|
|
1550
|
+
"error": "UNMAPPED_FIELD"
|
|
1551
|
+
},
|
|
1470
1552
|
{
|
|
1471
1553
|
"qbo": "TxnDate",
|
|
1472
1554
|
"support": "full"
|
|
@@ -1947,7 +2029,7 @@ var CATALOG = {
|
|
|
1947
2029
|
{
|
|
1948
2030
|
"qbo": "AccountingInfoPrefs",
|
|
1949
2031
|
"support": "partial",
|
|
1950
|
-
"note": "ClassTrackingPerTxn/ClassTrackingPerTxnLine \u2190 IsUsingClassTracking (same bool projected to both); TrackDepartments
|
|
2032
|
+
"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)."
|
|
1951
2033
|
},
|
|
1952
2034
|
{
|
|
1953
2035
|
"qbo": "CurrencyPrefs",
|
|
@@ -2110,6 +2192,17 @@ var CATALOG = {
|
|
|
2110
2192
|
"qbo": "VendorRef",
|
|
2111
2193
|
"support": "full"
|
|
2112
2194
|
},
|
|
2195
|
+
{
|
|
2196
|
+
"qbo": "ClassRef",
|
|
2197
|
+
"support": "full",
|
|
2198
|
+
"note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
|
|
2199
|
+
},
|
|
2200
|
+
{
|
|
2201
|
+
"qbo": "DepartmentRef",
|
|
2202
|
+
"support": "none",
|
|
2203
|
+
"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.",
|
|
2204
|
+
"error": "UNMAPPED_FIELD"
|
|
2205
|
+
},
|
|
2113
2206
|
{
|
|
2114
2207
|
"qbo": "TxnDate",
|
|
2115
2208
|
"support": "full"
|
|
@@ -2346,8 +2439,8 @@ var CATALOG = {
|
|
|
2346
2439
|
"group": "platform",
|
|
2347
2440
|
"read": "partial",
|
|
2348
2441
|
"write": "none",
|
|
2349
|
-
"headline": "
|
|
2350
|
-
"usage": "GET /v3/company/{
|
|
2442
|
+
"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.",
|
|
2443
|
+
"usage": "GET /v3/company/{companyId}/reports/ProfitAndLoss?start_date=2026-01-01&end_date=2026-12-31&summarize_column_by=Month",
|
|
2351
2444
|
"fields": [
|
|
2352
2445
|
{
|
|
2353
2446
|
"qbo": "ProfitAndLoss / BalanceSheet / TrialBalance",
|
|
@@ -2389,6 +2482,16 @@ var CATALOG = {
|
|
|
2389
2482
|
"support": "partial",
|
|
2390
2483
|
"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."
|
|
2391
2484
|
},
|
|
2485
|
+
{
|
|
2486
|
+
"qbo": "InventoryValuationDetail / TransactionListByCustomer / TransactionListByVendor",
|
|
2487
|
+
"support": "partial",
|
|
2488
|
+
"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."
|
|
2489
|
+
},
|
|
2490
|
+
{
|
|
2491
|
+
"qbo": "TaxSummary",
|
|
2492
|
+
"support": "partial",
|
|
2493
|
+
"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."
|
|
2494
|
+
},
|
|
2392
2495
|
{
|
|
2393
2496
|
"qbo": "CustomerBalanceDetail / VendorBalanceDetail",
|
|
2394
2497
|
"support": "partial",
|
|
@@ -2399,6 +2502,21 @@ var CATALOG = {
|
|
|
2399
2502
|
"support": "partial",
|
|
2400
2503
|
"note": "AgingReportQueryRq ARAgingDetail / APAgingDetail, as-of (report_date), with the receivable (customer) or payable (vendor) filter. ColKeys best-effort."
|
|
2401
2504
|
},
|
|
2505
|
+
{
|
|
2506
|
+
"qbo": "CashFlow",
|
|
2507
|
+
"support": "partial",
|
|
2508
|
+
"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)."
|
|
2509
|
+
},
|
|
2510
|
+
{
|
|
2511
|
+
"qbo": "AccountList",
|
|
2512
|
+
"support": "partial",
|
|
2513
|
+
"note": "Built from Desktop's account list (AccountQueryRq). Desktop has no account detail type, so that column is absent."
|
|
2514
|
+
},
|
|
2515
|
+
{
|
|
2516
|
+
"qbo": "Desktop extension reports",
|
|
2517
|
+
"support": "full",
|
|
2518
|
+
"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."
|
|
2519
|
+
},
|
|
2402
2520
|
{
|
|
2403
2521
|
"qbo": "start_date / end_date / date_macro",
|
|
2404
2522
|
"support": "full",
|
|
@@ -2427,6 +2545,30 @@ var CATALOG = {
|
|
|
2427
2545
|
"note": "Comma-separated Ids \u2192 ReportEntityFilter (customer + vendor) / ReportItemFilter / ReportClassFilter. AR reports accept customer only, AP reports vendor only; InventoryValuationSummary accepts item only.",
|
|
2428
2546
|
"error": "REPORT_UNSUPPORTED_OPTION"
|
|
2429
2547
|
},
|
|
2548
|
+
{
|
|
2549
|
+
"qbo": "account / account_type",
|
|
2550
|
+
"support": "partial",
|
|
2551
|
+
"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.",
|
|
2552
|
+
"error": "REPORT_UNSUPPORTED_OPTION"
|
|
2553
|
+
},
|
|
2554
|
+
{
|
|
2555
|
+
"qbo": "transaction_type",
|
|
2556
|
+
"support": "partial",
|
|
2557
|
+
"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).",
|
|
2558
|
+
"error": "REPORT_UNSUPPORTED_OPTION"
|
|
2559
|
+
},
|
|
2560
|
+
{
|
|
2561
|
+
"qbo": "start_moddate / end_moddate",
|
|
2562
|
+
"support": "partial",
|
|
2563
|
+
"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.",
|
|
2564
|
+
"error": "REPORT_INVALID_DATE"
|
|
2565
|
+
},
|
|
2566
|
+
{
|
|
2567
|
+
"qbo": "columns",
|
|
2568
|
+
"support": "partial",
|
|
2569
|
+
"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.",
|
|
2570
|
+
"error": "REPORT_UNSUPPORTED_OPTION"
|
|
2571
|
+
},
|
|
2430
2572
|
{
|
|
2431
2573
|
"qbo": "Column titles",
|
|
2432
2574
|
"support": "partial",
|
|
@@ -2435,14 +2577,9 @@ var CATALOG = {
|
|
|
2435
2577
|
],
|
|
2436
2578
|
"unsupported": [
|
|
2437
2579
|
{
|
|
2438
|
-
"case": "
|
|
2439
|
-
"error": "REPORT_UNKNOWN",
|
|
2440
|
-
"note": "QuickBooks Desktop's SDK has no cash-flow report (StatementOfCashFlows is refused with 3110 on every qbXML version)."
|
|
2441
|
-
},
|
|
2442
|
-
{
|
|
2443
|
-
"case": "columns / department / qzurl / adjusted_gain_loss",
|
|
2580
|
+
"case": "department / qzurl / adjusted_gain_loss",
|
|
2444
2581
|
"error": "REPORT_UNSUPPORTED_OPTION",
|
|
2445
|
-
"note": "
|
|
2582
|
+
"note": "Desktop has no departments (use class); QuickZoom URLs and multicurrency gain/loss adjustment are QBO-only."
|
|
2446
2583
|
},
|
|
2447
2584
|
{
|
|
2448
2585
|
"case": "aging_period / num_periods / aging_method",
|
|
@@ -2455,7 +2592,17 @@ var CATALOG = {
|
|
|
2455
2592
|
"note": "qbXML's SummarizeColumnsBy has no per-item, per-employee or per-location split (ItemType splits by item type, not by item)."
|
|
2456
2593
|
},
|
|
2457
2594
|
{
|
|
2458
|
-
"case": "
|
|
2595
|
+
"case": "ClassSales / DepartmentSales",
|
|
2596
|
+
"error": "REPORT_UNKNOWN",
|
|
2597
|
+
"note": "No Desktop SDK report. Use ProfitAndLoss?summarize_column_by=Classes."
|
|
2598
|
+
},
|
|
2599
|
+
{
|
|
2600
|
+
"case": "TransactionListWithSplits",
|
|
2601
|
+
"error": "REPORT_UNKNOWN",
|
|
2602
|
+
"note": "No Desktop SDK report of that name. Use JournalReport."
|
|
2603
|
+
},
|
|
2604
|
+
{
|
|
2605
|
+
"case": "other QBO report names",
|
|
2459
2606
|
"error": "REPORT_UNKNOWN",
|
|
2460
2607
|
"note": "Not shipped. The fault lists the supported reports."
|
|
2461
2608
|
}
|
|
@@ -2473,6 +2620,17 @@ var CATALOG = {
|
|
|
2473
2620
|
"qbo": "CustomerRef",
|
|
2474
2621
|
"support": "full"
|
|
2475
2622
|
},
|
|
2623
|
+
{
|
|
2624
|
+
"qbo": "ClassRef",
|
|
2625
|
+
"support": "full",
|
|
2626
|
+
"note": "Header-level class (Desktop ClassRef, read and write). Line-level ClassRef is separate."
|
|
2627
|
+
},
|
|
2628
|
+
{
|
|
2629
|
+
"qbo": "DepartmentRef",
|
|
2630
|
+
"support": "none",
|
|
2631
|
+
"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.",
|
|
2632
|
+
"error": "UNMAPPED_FIELD"
|
|
2633
|
+
},
|
|
2476
2634
|
{
|
|
2477
2635
|
"qbo": "TxnDate",
|
|
2478
2636
|
"support": "full"
|
|
@@ -2921,6 +3079,12 @@ var CATALOG = {
|
|
|
2921
3079
|
"qbo": "ClassRef",
|
|
2922
3080
|
"support": "full"
|
|
2923
3081
|
},
|
|
3082
|
+
{
|
|
3083
|
+
"qbo": "DepartmentRef",
|
|
3084
|
+
"support": "none",
|
|
3085
|
+
"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.",
|
|
3086
|
+
"error": "UNMAPPED_FIELD"
|
|
3087
|
+
},
|
|
2924
3088
|
{
|
|
2925
3089
|
"qbo": "Description",
|
|
2926
3090
|
"support": "full",
|
|
@@ -3358,7 +3522,7 @@ function unknownEntity(name) {
|
|
|
3358
3522
|
if (gap) {
|
|
3359
3523
|
if (gap.verdict === "live") {
|
|
3360
3524
|
return fail(
|
|
3361
|
-
`${gap.entity} is a platform endpoint, not reachable through this server's entity tools. Call the REST API directly: ${gap.usage}
|
|
3525
|
+
`${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()}`
|
|
3362
3526
|
);
|
|
3363
3527
|
}
|
|
3364
3528
|
const cases = gap.unsupported.map((u) => `- ${u.case}: ${u.error}${u.workaround ? ` \u2014 workaround: ${u.workaround}` : ""}`).join("\n");
|
|
@@ -3406,6 +3570,24 @@ function registerTools(server, client) {
|
|
|
3406
3570
|
}
|
|
3407
3571
|
}
|
|
3408
3572
|
);
|
|
3573
|
+
server.registerTool(
|
|
3574
|
+
"run_report",
|
|
3575
|
+
{
|
|
3576
|
+
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.",
|
|
3577
|
+
inputSchema: {
|
|
3578
|
+
report: z.string().describe('Report name, e.g. "ProfitAndLoss" (case-insensitive).'),
|
|
3579
|
+
params: z.record(z.string()).optional().describe('Query params, e.g. { "date_macro": "Last Month" }.')
|
|
3580
|
+
}
|
|
3581
|
+
},
|
|
3582
|
+
async ({ report, params }) => {
|
|
3583
|
+
if (!client.report) return fail("This TenkeyBridge client has no report() method; upgrade @tenkeybridge/client to 0.5.0.");
|
|
3584
|
+
try {
|
|
3585
|
+
return ok(await client.report(report, params ?? {}));
|
|
3586
|
+
} catch (err) {
|
|
3587
|
+
return failure(err);
|
|
3588
|
+
}
|
|
3589
|
+
}
|
|
3590
|
+
);
|
|
3409
3591
|
server.registerTool(
|
|
3410
3592
|
"get",
|
|
3411
3593
|
{
|
|
@@ -3520,7 +3702,7 @@ function registerTools(server, client) {
|
|
|
3520
3702
|
}
|
|
3521
3703
|
|
|
3522
3704
|
// src/version.ts
|
|
3523
|
-
var PKG_VERSION = "0.
|
|
3705
|
+
var PKG_VERSION = "0.5.0";
|
|
3524
3706
|
|
|
3525
3707
|
// src/server.ts
|
|
3526
3708
|
var SERVER_NAME = "tenkeybridge";
|
|
@@ -3536,19 +3718,25 @@ import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
|
|
3536
3718
|
import { homedir } from "os";
|
|
3537
3719
|
import { dirname, join } from "path";
|
|
3538
3720
|
var PORTAL_URL = "https://api.tenkeybridge.com/portal";
|
|
3539
|
-
function defaultTokenFile(
|
|
3540
|
-
return join(homedir(), ".tenkeybridge", `mcp-tokens-${
|
|
3721
|
+
function defaultTokenFile(companyId) {
|
|
3722
|
+
return join(homedir(), ".tenkeybridge", `mcp-tokens-${companyId}.json`);
|
|
3541
3723
|
}
|
|
3542
3724
|
function loadConfig(env) {
|
|
3543
|
-
const
|
|
3544
|
-
|
|
3725
|
+
const fromNew = env.TKB_COMPANY_ID;
|
|
3726
|
+
const fromOld = env.TKB_REALM_ID;
|
|
3727
|
+
if (fromNew && fromOld && fromNew !== fromOld) {
|
|
3728
|
+
throw new Error("TKB_COMPANY_ID and TKB_REALM_ID (deprecated) disagree \u2014 set TKB_COMPANY_ID only.");
|
|
3729
|
+
}
|
|
3730
|
+
const companyId = fromNew || fromOld;
|
|
3731
|
+
if (!companyId) {
|
|
3545
3732
|
throw new Error(
|
|
3546
|
-
`
|
|
3733
|
+
`TKB_COMPANY_ID is required \u2014 the Company ID of the connected QuickBooks company file (shown in the portal: ${PORTAL_URL}).`
|
|
3547
3734
|
);
|
|
3548
3735
|
}
|
|
3736
|
+
const deprecations = !fromNew && fromOld ? ["TKB_REALM_ID is deprecated; set TKB_COMPANY_ID instead."] : [];
|
|
3549
3737
|
const baseUrl = env.TKB_BASE_URL;
|
|
3550
3738
|
if (env.TKB_ACCESS_TOKEN) {
|
|
3551
|
-
return {
|
|
3739
|
+
return { companyId, deprecations, ...baseUrl ? { baseUrl } : {}, auth: { accessToken: env.TKB_ACCESS_TOKEN } };
|
|
3552
3740
|
}
|
|
3553
3741
|
const clientId = env.TKB_CLIENT_ID;
|
|
3554
3742
|
const clientSecret = env.TKB_CLIENT_SECRET;
|
|
@@ -3560,13 +3748,14 @@ function loadConfig(env) {
|
|
|
3560
3748
|
!refreshToken && "TKB_REFRESH_TOKEN"
|
|
3561
3749
|
].filter(Boolean).join(", ");
|
|
3562
3750
|
throw new Error(
|
|
3563
|
-
`Missing ${missing}. Set either TKB_ACCESS_TOKEN, or all of TKB_CLIENT_ID + TKB_CLIENT_SECRET + TKB_REFRESH_TOKEN (create an OAuth
|
|
3751
|
+
`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}).`
|
|
3564
3752
|
);
|
|
3565
3753
|
}
|
|
3566
|
-
const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(
|
|
3754
|
+
const tokenFile = env.TKB_TOKEN_FILE ?? defaultTokenFile(companyId);
|
|
3567
3755
|
const stored = readStoredRefreshToken(tokenFile);
|
|
3568
3756
|
return {
|
|
3569
|
-
|
|
3757
|
+
companyId,
|
|
3758
|
+
deprecations,
|
|
3570
3759
|
...baseUrl ? { baseUrl } : {},
|
|
3571
3760
|
tokenFile,
|
|
3572
3761
|
auth: { clientId, clientSecret, refreshToken: stored ?? refreshToken }
|