@armor/zuora-mcp 0.0.0-development
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/.env.example +16 -0
- package/README.md +249 -0
- package/dist/cli.d.ts +15 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +73 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +26 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +56 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +148 -0
- package/dist/index.js.map +1 -0
- package/dist/prompts.d.ts +11 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +236 -0
- package/dist/prompts.js.map +1 -0
- package/dist/resources.d.ts +11 -0
- package/dist/resources.d.ts.map +1 -0
- package/dist/resources.js +526 -0
- package/dist/resources.js.map +1 -0
- package/dist/setup.d.ts +12 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/setup.js +188 -0
- package/dist/setup.js.map +1 -0
- package/dist/token-manager.d.ts +34 -0
- package/dist/token-manager.d.ts.map +1 -0
- package/dist/token-manager.js +103 -0
- package/dist/token-manager.js.map +1 -0
- package/dist/tools.d.ts +1096 -0
- package/dist/tools.d.ts.map +1 -0
- package/dist/tools.js +2841 -0
- package/dist/tools.js.map +1 -0
- package/dist/types.d.ts +758 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +5 -0
- package/dist/types.js.map +1 -0
- package/dist/zoql-helpers.d.ts +68 -0
- package/dist/zoql-helpers.d.ts.map +1 -0
- package/dist/zoql-helpers.js +154 -0
- package/dist/zoql-helpers.js.map +1 -0
- package/dist/zuora-client.d.ts +184 -0
- package/dist/zuora-client.d.ts.map +1 -0
- package/dist/zuora-client.js +583 -0
- package/dist/zuora-client.js.map +1 -0
- package/package.json +60 -0
|
@@ -0,0 +1,526 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MCP Resource Definitions for Zuora Data Model & ZOQL Reference
|
|
3
|
+
*
|
|
4
|
+
* Static content that Claude reads to write better ad-hoc ZOQL queries.
|
|
5
|
+
* These resources expose Zuora's data model, relationships, syntax rules,
|
|
6
|
+
* and common query patterns so Claude can construct correct multi-step ZOQL
|
|
7
|
+
* without needing to guess field names or relationships.
|
|
8
|
+
*/
|
|
9
|
+
// ==================== Resource Content ====================
|
|
10
|
+
const DATA_MODEL_RELATIONSHIPS = `# Zuora Data Model & Relationships
|
|
11
|
+
|
|
12
|
+
## Object Hierarchy
|
|
13
|
+
|
|
14
|
+
\`\`\`
|
|
15
|
+
Account
|
|
16
|
+
├── Subscription (AccountId → Account.Id)
|
|
17
|
+
│ ├── RatePlan (SubscriptionId → Subscription.Id)
|
|
18
|
+
│ │ ├── RatePlanCharge (RatePlanId → RatePlan.Id)
|
|
19
|
+
│ │ └── ProductRatePlan (via RatePlan.ProductRatePlanId)
|
|
20
|
+
│ └── Amendment (SubscriptionId → Subscription.Id)
|
|
21
|
+
├── Invoice (AccountId → Account.Id)
|
|
22
|
+
│ └── InvoiceItem (InvoiceId → Invoice.Id)
|
|
23
|
+
│ └── InvoiceItemAdjustment
|
|
24
|
+
├── Payment (AccountId → Account.Id)
|
|
25
|
+
│ └── InvoicePayment (PaymentId → Payment.Id, InvoiceId → Invoice.Id)
|
|
26
|
+
├── CreditBalanceAdjustment (AccountId → Account.Id)
|
|
27
|
+
├── Refund (AccountId → Account.Id)
|
|
28
|
+
└── Contact (AccountId → Account.Id)
|
|
29
|
+
|
|
30
|
+
Product (standalone)
|
|
31
|
+
├── ProductRatePlan (ProductId → Product.Id)
|
|
32
|
+
│ └── ProductRatePlanCharge (ProductRatePlanId → ProductRatePlan.Id)
|
|
33
|
+
│ └── ProductRatePlanChargeTier
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## Key Foreign Key Relationships
|
|
37
|
+
|
|
38
|
+
| Child Object | Foreign Key | Parent Object |
|
|
39
|
+
|---|---|---|
|
|
40
|
+
| Subscription | AccountId | Account.Id |
|
|
41
|
+
| RatePlan | SubscriptionId | Subscription.Id |
|
|
42
|
+
| RatePlan | ProductRatePlanId | ProductRatePlan.Id |
|
|
43
|
+
| RatePlanCharge | RatePlanId | RatePlan.Id |
|
|
44
|
+
| Invoice | AccountId | Account.Id |
|
|
45
|
+
| InvoiceItem | InvoiceId | Invoice.Id |
|
|
46
|
+
| InvoiceItem | SubscriptionId | Subscription.Id |
|
|
47
|
+
| InvoiceItem | RatePlanChargeId | RatePlanCharge.Id |
|
|
48
|
+
| Payment | AccountId | Account.Id |
|
|
49
|
+
| InvoicePayment | PaymentId | Payment.Id |
|
|
50
|
+
| InvoicePayment | InvoiceId | Invoice.Id |
|
|
51
|
+
| ProductRatePlan | ProductId | Product.Id |
|
|
52
|
+
| ProductRatePlanCharge | ProductRatePlanId | ProductRatePlan.Id |
|
|
53
|
+
|
|
54
|
+
## Common Multi-Step Query Patterns
|
|
55
|
+
|
|
56
|
+
### Find accounts by product name (3 steps)
|
|
57
|
+
1. \`SELECT Id, ProductRatePlanId FROM RatePlan WHERE ProductRatePlanId != ''\`
|
|
58
|
+
- Or filter by name using ProductRatePlan first
|
|
59
|
+
2. Get SubscriptionIds from RatePlan results
|
|
60
|
+
3. \`SELECT AccountId, AccountNumber FROM Subscription WHERE Id IN (...subscriptionIds) AND Status = 'Active'\`
|
|
61
|
+
|
|
62
|
+
### Find invoices by product (3 steps)
|
|
63
|
+
1. Query RatePlan to get RatePlanCharge IDs for the product
|
|
64
|
+
2. Query InvoiceItem WHERE RatePlanChargeId IN (...)
|
|
65
|
+
3. Query Invoice WHERE Id IN (...invoiceIds from step 2)
|
|
66
|
+
|
|
67
|
+
### Get subscription details with product info (2 steps)
|
|
68
|
+
1. \`SELECT Id, SubscriptionId, ProductRatePlanId FROM RatePlan WHERE SubscriptionId = '...'\`
|
|
69
|
+
2. \`SELECT Id, Name FROM ProductRatePlan WHERE Id IN (...productRatePlanIds)\`
|
|
70
|
+
|
|
71
|
+
## Important Notes
|
|
72
|
+
|
|
73
|
+
- **No JOINs**: ZOQL does not support JOIN. You must query each object separately and correlate by ID.
|
|
74
|
+
- **Case-sensitive fields**: Field names are case-sensitive (e.g., \`AccountId\` not \`accountid\`).
|
|
75
|
+
- **Max 2000 records**: Each query returns at most 2000 records. Use queryLocator for pagination.
|
|
76
|
+
- **No subqueries**: ZOQL does not support subqueries or nested SELECT statements.
|
|
77
|
+
- **No date functions**: ZOQL has no built-in date arithmetic. Compute date literals server-side.
|
|
78
|
+
`;
|
|
79
|
+
const ZOQL_SYNTAX_GUIDE = `# ZOQL Syntax Guide
|
|
80
|
+
|
|
81
|
+
## Basic Syntax
|
|
82
|
+
\`\`\`
|
|
83
|
+
SELECT field1, field2, ... FROM ObjectName [WHERE conditions] [ORDER BY field [ASC|DESC]]
|
|
84
|
+
\`\`\`
|
|
85
|
+
|
|
86
|
+
## Supported Operators
|
|
87
|
+
| Operator | Example |
|
|
88
|
+
|---|---|
|
|
89
|
+
| = | \`WHERE Status = 'Active'\` |
|
|
90
|
+
| != | \`WHERE Status != 'Cancelled'\` |
|
|
91
|
+
| < | \`WHERE Balance < 100\` |
|
|
92
|
+
| <= | \`WHERE DueDate <= '2024-12-31'\` |
|
|
93
|
+
| > | \`WHERE Amount > 0\` |
|
|
94
|
+
| >= | \`WHERE CreatedDate >= '2024-01-01'\` |
|
|
95
|
+
| LIKE | \`WHERE Name LIKE 'Acme%'\` |
|
|
96
|
+
| IN | \`WHERE Id IN ('id1', 'id2', 'id3')\` |
|
|
97
|
+
| AND | \`WHERE Status = 'Active' AND Balance > 0\` |
|
|
98
|
+
| OR | \`WHERE Status = 'Active' OR Status = 'Draft'\` |
|
|
99
|
+
| IS NULL | \`WHERE TermEndDate IS NULL\` (for EVERGREEN) |
|
|
100
|
+
| IS NOT NULL | \`WHERE CancelledDate IS NOT NULL\` |
|
|
101
|
+
|
|
102
|
+
## Key Limitations
|
|
103
|
+
1. **No JOINs** — Must query each object separately
|
|
104
|
+
2. **No subqueries** — Cannot nest SELECT statements
|
|
105
|
+
3. **No aggregation** — No SUM, COUNT, AVG, GROUP BY (aggregate client-side)
|
|
106
|
+
4. **No date functions** — No DATEADD, DATEDIFF, NOW() (compute dates in code)
|
|
107
|
+
5. **Max 2000 records per page** — Use queryLocator for pagination
|
|
108
|
+
6. **No DISTINCT** — Deduplicate client-side
|
|
109
|
+
7. **No LIMIT/OFFSET** — Cannot limit result count in query
|
|
110
|
+
8. **Case-sensitive field names** — Must match exactly (AccountId, not accountid)
|
|
111
|
+
|
|
112
|
+
## Date Handling
|
|
113
|
+
- Dates must be string literals in YYYY-MM-DD format: \`WHERE DueDate < '2024-03-15'\`
|
|
114
|
+
- DateTime fields use ISO 8601: \`WHERE CreatedDate >= '2024-01-01T00:00:00'\`
|
|
115
|
+
- No timezone conversion in ZOQL — all dates are in tenant's timezone
|
|
116
|
+
|
|
117
|
+
## String Handling
|
|
118
|
+
- Strings use single quotes: \`WHERE Name = 'Acme Corp'\`
|
|
119
|
+
- Escape single quotes by doubling: \`WHERE Name = 'O''Brien Inc'\`
|
|
120
|
+
- LIKE uses % as wildcard: \`WHERE Name LIKE '%Analytics%'\`
|
|
121
|
+
|
|
122
|
+
## Pagination
|
|
123
|
+
1. First query returns up to 2000 records + a \`queryLocator\` if more exist
|
|
124
|
+
2. Call \`queryMore\` with the queryLocator to get the next page
|
|
125
|
+
3. Repeat until \`done: true\` or no queryLocator returned
|
|
126
|
+
|
|
127
|
+
## Queryable Objects (most common)
|
|
128
|
+
| Object | Key Fields |
|
|
129
|
+
|---|---|
|
|
130
|
+
| Account | Id, AccountNumber, Name, Status, Balance, Currency, CreatedDate |
|
|
131
|
+
| Subscription | Id, AccountId, SubscriptionNumber, Status, TermStartDate, TermEndDate, ContractedMrr, AutoRenew |
|
|
132
|
+
| RatePlan | Id, SubscriptionId, ProductRatePlanId, Name |
|
|
133
|
+
| RatePlanCharge | Id, RatePlanId, Name, ChargeType, MRR, TCV, Price, Currency |
|
|
134
|
+
| Invoice | Id, AccountId, InvoiceNumber, InvoiceDate, DueDate, Amount, Balance, Status |
|
|
135
|
+
| InvoiceItem | Id, InvoiceId, SubscriptionId, RatePlanChargeId, ChargeAmount, ChargeName, ServiceStartDate, ServiceEndDate |
|
|
136
|
+
| Payment | Id, AccountId, PaymentNumber, Amount, EffectiveDate, Status, PaymentMethodType |
|
|
137
|
+
| InvoicePayment | Id, InvoiceId, PaymentId, Amount |
|
|
138
|
+
| Product | Id, Name, SKU, Description |
|
|
139
|
+
| ProductRatePlan | Id, ProductId, Name, Description |
|
|
140
|
+
| ProductRatePlanCharge | Id, ProductRatePlanId, Name, ChargeType, BillingPeriod |
|
|
141
|
+
| Contact | Id, AccountId, FirstName, LastName, WorkEmail |
|
|
142
|
+
| Amendment | Id, SubscriptionId, Type, EffectiveDate, Status |
|
|
143
|
+
| Refund | Id, AccountId, Amount, Status, RefundDate |
|
|
144
|
+
| BillRun | Id, BillRunNumber, Status, TargetDate, InvoiceDate, AutoPost, AutoEmail, CreatedDate |
|
|
145
|
+
|
|
146
|
+
## Discovering Fields Dynamically
|
|
147
|
+
Use the \`describe_object\` tool to get all available fields for any Zuora object type.
|
|
148
|
+
This is the most reliable way to discover exact field names before writing ZOQL queries.
|
|
149
|
+
Example: \`describe_object({ objectType: "Account" })\` returns all Account fields with types and properties.
|
|
150
|
+
|
|
151
|
+
## Non-Queryable Objects
|
|
152
|
+
The following objects are **NOT queryable via ZOQL**. Use the dedicated REST tools instead:
|
|
153
|
+
| Object | Use Instead |
|
|
154
|
+
|---|---|
|
|
155
|
+
| User | \`list_users\` (with optional SCIM filter) or \`get_user\` (by user ID) |
|
|
156
|
+
`;
|
|
157
|
+
const ZOQL_COMMON_PATTERNS = `# Common ZOQL Patterns
|
|
158
|
+
|
|
159
|
+
## Account Queries
|
|
160
|
+
|
|
161
|
+
### Active accounts with balance
|
|
162
|
+
\`\`\`
|
|
163
|
+
SELECT Id, AccountNumber, Name, Balance, Currency
|
|
164
|
+
FROM Account
|
|
165
|
+
WHERE Status = 'Active' AND Balance > 0
|
|
166
|
+
\`\`\`
|
|
167
|
+
|
|
168
|
+
### Find account by name (partial match)
|
|
169
|
+
\`\`\`
|
|
170
|
+
SELECT Id, AccountNumber, Name, Status, Balance
|
|
171
|
+
FROM Account
|
|
172
|
+
WHERE Name LIKE '%Acme%'
|
|
173
|
+
\`\`\`
|
|
174
|
+
|
|
175
|
+
## Subscription Queries
|
|
176
|
+
|
|
177
|
+
### Active subscriptions for an account
|
|
178
|
+
\`\`\`
|
|
179
|
+
SELECT Id, SubscriptionNumber, Status, TermStartDate, TermEndDate, ContractedMrr, AutoRenew
|
|
180
|
+
FROM Subscription
|
|
181
|
+
WHERE AccountId = 'ACCOUNT_ID' AND Status = 'Active'
|
|
182
|
+
\`\`\`
|
|
183
|
+
|
|
184
|
+
### Subscriptions expiring in next 30 days
|
|
185
|
+
\`\`\`
|
|
186
|
+
SELECT Id, SubscriptionNumber, AccountId, TermEndDate, ContractedMrr, AutoRenew
|
|
187
|
+
FROM Subscription
|
|
188
|
+
WHERE Status = 'Active' AND TermEndDate >= 'YYYY-MM-DD' AND TermEndDate <= 'YYYY-MM-DD'
|
|
189
|
+
\`\`\`
|
|
190
|
+
|
|
191
|
+
### Recently cancelled subscriptions
|
|
192
|
+
\`\`\`
|
|
193
|
+
SELECT Id, SubscriptionNumber, AccountId, Status, TermEndDate, UpdatedDate
|
|
194
|
+
FROM Subscription
|
|
195
|
+
WHERE Status = 'Cancelled' AND UpdatedDate >= 'YYYY-MM-DD'
|
|
196
|
+
\`\`\`
|
|
197
|
+
|
|
198
|
+
## Invoice Queries
|
|
199
|
+
|
|
200
|
+
### Overdue invoices (Posted with balance, past due date)
|
|
201
|
+
\`\`\`
|
|
202
|
+
SELECT Id, InvoiceNumber, AccountId, InvoiceDate, DueDate, Amount, Balance
|
|
203
|
+
FROM Invoice
|
|
204
|
+
WHERE Status = 'Posted' AND Balance > 0 AND DueDate < 'TODAY'
|
|
205
|
+
\`\`\`
|
|
206
|
+
|
|
207
|
+
### Invoices for a date range
|
|
208
|
+
\`\`\`
|
|
209
|
+
SELECT Id, InvoiceNumber, AccountId, InvoiceDate, Amount, Balance, Status
|
|
210
|
+
FROM Invoice
|
|
211
|
+
WHERE InvoiceDate >= '2024-01-01' AND InvoiceDate <= '2024-01-31'
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
## Rate Plan Queries
|
|
215
|
+
|
|
216
|
+
### Find subscriptions with a specific product
|
|
217
|
+
\`\`\`
|
|
218
|
+
-- Step 1: Get ProductRatePlan IDs for the product
|
|
219
|
+
SELECT Id, Name FROM ProductRatePlan WHERE ProductId = 'PRODUCT_ID'
|
|
220
|
+
|
|
221
|
+
-- Step 2: Find RatePlans using those ProductRatePlanIds
|
|
222
|
+
SELECT Id, SubscriptionId FROM RatePlan WHERE ProductRatePlanId IN ('prp_id1', 'prp_id2')
|
|
223
|
+
|
|
224
|
+
-- Step 3: Get subscription details
|
|
225
|
+
SELECT Id, AccountId, SubscriptionNumber, Status, ContractedMrr
|
|
226
|
+
FROM Subscription WHERE Id IN ('sub_id1', 'sub_id2') AND Status = 'Active'
|
|
227
|
+
\`\`\`
|
|
228
|
+
|
|
229
|
+
### Find products by name (when exact ProductId unknown)
|
|
230
|
+
\`\`\`
|
|
231
|
+
SELECT Id, Name FROM Product WHERE Name LIKE '%Security Analytics%'
|
|
232
|
+
\`\`\`
|
|
233
|
+
|
|
234
|
+
### Get rate plan charges (MRR/pricing details)
|
|
235
|
+
\`\`\`
|
|
236
|
+
SELECT Id, RatePlanId, Name, ChargeType, MRR, TCV, Price, Currency
|
|
237
|
+
FROM RatePlanCharge WHERE RatePlanId IN ('rp_id1', 'rp_id2')
|
|
238
|
+
\`\`\`
|
|
239
|
+
|
|
240
|
+
## Payment Queries
|
|
241
|
+
|
|
242
|
+
### Payments in a date range
|
|
243
|
+
\`\`\`
|
|
244
|
+
SELECT Id, PaymentNumber, AccountId, Amount, EffectiveDate, Status, PaymentMethodType
|
|
245
|
+
FROM Payment
|
|
246
|
+
WHERE EffectiveDate >= '2024-01-01' AND EffectiveDate <= '2024-01-31'
|
|
247
|
+
\`\`\`
|
|
248
|
+
|
|
249
|
+
### Failed payments
|
|
250
|
+
\`\`\`
|
|
251
|
+
SELECT Id, PaymentNumber, AccountId, Amount, EffectiveDate, Status
|
|
252
|
+
FROM Payment
|
|
253
|
+
WHERE Status = 'Error' AND EffectiveDate >= '2024-01-01'
|
|
254
|
+
\`\`\`
|
|
255
|
+
|
|
256
|
+
## Invoice Item Queries
|
|
257
|
+
|
|
258
|
+
### Invoice items for a specific invoice
|
|
259
|
+
\`\`\`
|
|
260
|
+
SELECT Id, ChargeAmount, ChargeName, ServiceStartDate, ServiceEndDate, SubscriptionId
|
|
261
|
+
FROM InvoiceItem
|
|
262
|
+
WHERE InvoiceId = 'INVOICE_ID'
|
|
263
|
+
\`\`\`
|
|
264
|
+
|
|
265
|
+
### Invoice items by rate plan charge
|
|
266
|
+
\`\`\`
|
|
267
|
+
SELECT Id, InvoiceId, ChargeAmount, ChargeName, ServiceStartDate, ServiceEndDate
|
|
268
|
+
FROM InvoiceItem
|
|
269
|
+
WHERE RatePlanChargeId IN ('rpc_id1', 'rpc_id2')
|
|
270
|
+
\`\`\`
|
|
271
|
+
|
|
272
|
+
## Multi-Step Pattern: Account → Subscription → Product Mapping
|
|
273
|
+
\`\`\`
|
|
274
|
+
-- Step 1: Get all active subscriptions
|
|
275
|
+
SELECT Id, AccountId, SubscriptionNumber, ContractedMrr
|
|
276
|
+
FROM Subscription WHERE Status = 'Active'
|
|
277
|
+
|
|
278
|
+
-- Step 2: Get rate plans for those subscriptions
|
|
279
|
+
SELECT Id, SubscriptionId, ProductRatePlanId, Name
|
|
280
|
+
FROM RatePlan WHERE SubscriptionId IN ('sub1', 'sub2', ...)
|
|
281
|
+
|
|
282
|
+
-- Step 3: Resolve product names
|
|
283
|
+
SELECT Id, Name FROM ProductRatePlan WHERE Id IN ('prp1', 'prp2', ...)
|
|
284
|
+
\`\`\`
|
|
285
|
+
`;
|
|
286
|
+
const OBJECT_FIELD_DEFINITIONS = {
|
|
287
|
+
account: `# Account Object
|
|
288
|
+
|
|
289
|
+
| Field | Type | Description |
|
|
290
|
+
|---|---|---|
|
|
291
|
+
| Id | string | Unique identifier (UUID) |
|
|
292
|
+
| AccountNumber | string | Human-readable account number (e.g., A00000001) |
|
|
293
|
+
| Name | string | Account name |
|
|
294
|
+
| Status | string | Active, Cancelled, Draft |
|
|
295
|
+
| Balance | decimal | Current account balance (outstanding amount) |
|
|
296
|
+
| CreditBalance | decimal | Credit balance available |
|
|
297
|
+
| Currency | string | ISO 4217 currency code |
|
|
298
|
+
| BillCycleDay | integer | Day of month for billing (1-31) |
|
|
299
|
+
| AutoPay | boolean | Whether auto-collection is enabled |
|
|
300
|
+
| PaymentTerm | string | Payment terms (e.g., "Net 30") |
|
|
301
|
+
| BillToId | string | FK to Contact for billing address |
|
|
302
|
+
| SoldToId | string | FK to Contact for sold-to address |
|
|
303
|
+
| CreatedDate | datetime | When the account was created |
|
|
304
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
305
|
+
`,
|
|
306
|
+
subscription: `# Subscription Object
|
|
307
|
+
|
|
308
|
+
| Field | Type | Description |
|
|
309
|
+
|---|---|---|
|
|
310
|
+
| Id | string | Unique identifier (UUID) |
|
|
311
|
+
| AccountId | string | FK to Account.Id |
|
|
312
|
+
| SubscriptionNumber | string | Human-readable (e.g., A-S00000001) |
|
|
313
|
+
| Status | string | Active, Cancelled, Expired, Suspended, Draft |
|
|
314
|
+
| TermType | string | TERMED or EVERGREEN |
|
|
315
|
+
| TermStartDate | date | Current term start |
|
|
316
|
+
| TermEndDate | date | Current term end (null for EVERGREEN) |
|
|
317
|
+
| ContractEffectiveDate | date | When the contract became effective |
|
|
318
|
+
| ServiceActivationDate | date | When the service was activated |
|
|
319
|
+
| ContractedMrr | decimal | Monthly Recurring Revenue |
|
|
320
|
+
| TotalContractedValue | decimal | Total Contract Value |
|
|
321
|
+
| AutoRenew | boolean | Whether auto-renewal is enabled |
|
|
322
|
+
| RenewalTerm | integer | Renewal period length |
|
|
323
|
+
| RenewalTermPeriodType | string | Month, Year, Day, Week |
|
|
324
|
+
| CancelledDate | date | When cancelled (null if not cancelled) |
|
|
325
|
+
| CreatedDate | datetime | Creation timestamp |
|
|
326
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
327
|
+
`,
|
|
328
|
+
invoice: `# Invoice Object
|
|
329
|
+
|
|
330
|
+
| Field | Type | Description |
|
|
331
|
+
|---|---|---|
|
|
332
|
+
| Id | string | Unique identifier (UUID) |
|
|
333
|
+
| AccountId | string | FK to Account.Id |
|
|
334
|
+
| InvoiceNumber | string | Human-readable invoice number |
|
|
335
|
+
| InvoiceDate | date | Date the invoice was generated |
|
|
336
|
+
| DueDate | date | Payment due date |
|
|
337
|
+
| Amount | decimal | Total invoice amount |
|
|
338
|
+
| Balance | decimal | Remaining unpaid balance |
|
|
339
|
+
| Status | string | Draft, Posted, Cancelled, Error |
|
|
340
|
+
| CreatedDate | datetime | Creation timestamp |
|
|
341
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
342
|
+
`,
|
|
343
|
+
payment: `# Payment Object
|
|
344
|
+
|
|
345
|
+
| Field | Type | Description |
|
|
346
|
+
|---|---|---|
|
|
347
|
+
| Id | string | Unique identifier (UUID) |
|
|
348
|
+
| AccountId | string | FK to Account.Id |
|
|
349
|
+
| PaymentNumber | string | Human-readable payment number |
|
|
350
|
+
| Amount | decimal | Total payment amount |
|
|
351
|
+
| AppliedAmount | decimal | Amount applied to invoices |
|
|
352
|
+
| UnappliedAmount | decimal | Remaining unapplied amount |
|
|
353
|
+
| EffectiveDate | date | When the payment takes effect |
|
|
354
|
+
| Status | string | Processed, Error, Cancelled, Draft |
|
|
355
|
+
| Type | string | Electronic or External |
|
|
356
|
+
| PaymentMethodType | string | CreditCard, ACH, PayPal, etc. |
|
|
357
|
+
| GatewayResponse | string | Gateway transaction response |
|
|
358
|
+
| GatewayResponseCode | string | Gateway response code |
|
|
359
|
+
| CreatedDate | datetime | Creation timestamp |
|
|
360
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
361
|
+
`,
|
|
362
|
+
rateplan: `# RatePlan Object
|
|
363
|
+
|
|
364
|
+
| Field | Type | Description |
|
|
365
|
+
|---|---|---|
|
|
366
|
+
| Id | string | Unique identifier (UUID) |
|
|
367
|
+
| SubscriptionId | string | FK to Subscription.Id |
|
|
368
|
+
| ProductRatePlanId | string | FK to ProductRatePlan.Id |
|
|
369
|
+
| Name | string | Rate plan name (copied from catalog) |
|
|
370
|
+
| AmendmentType | string | NewProduct, RemoveProduct, UpdateProduct |
|
|
371
|
+
| CreatedDate | datetime | Creation timestamp |
|
|
372
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
373
|
+
`,
|
|
374
|
+
rateplancharge: `# RatePlanCharge Object
|
|
375
|
+
|
|
376
|
+
| Field | Type | Description |
|
|
377
|
+
|---|---|---|
|
|
378
|
+
| Id | string | Unique identifier (UUID) |
|
|
379
|
+
| RatePlanId | string | FK to RatePlan.Id |
|
|
380
|
+
| Name | string | Charge name |
|
|
381
|
+
| ChargeNumber | string | Human-readable charge number |
|
|
382
|
+
| ChargeType | string | OneTime, Recurring, Usage |
|
|
383
|
+
| ChargeModel | string | FlatFee, PerUnit, Tiered, Volume |
|
|
384
|
+
| MRR | decimal | Monthly Recurring Revenue for this charge |
|
|
385
|
+
| TCV | decimal | Total Contract Value for this charge |
|
|
386
|
+
| Price | decimal | Per-unit price |
|
|
387
|
+
| Currency | string | ISO 4217 currency code |
|
|
388
|
+
| Quantity | decimal | Quantity ordered |
|
|
389
|
+
| BillingPeriod | string | Month, Quarter, Annual, etc. |
|
|
390
|
+
| EffectiveStartDate | date | Charge effective start |
|
|
391
|
+
| EffectiveEndDate | date | Charge effective end |
|
|
392
|
+
`,
|
|
393
|
+
invoiceitem: `# InvoiceItem Object
|
|
394
|
+
|
|
395
|
+
| Field | Type | Description |
|
|
396
|
+
|---|---|---|
|
|
397
|
+
| Id | string | Unique identifier (UUID) |
|
|
398
|
+
| InvoiceId | string | FK to Invoice.Id |
|
|
399
|
+
| SubscriptionId | string | FK to Subscription.Id |
|
|
400
|
+
| RatePlanChargeId | string | FK to RatePlanCharge.Id |
|
|
401
|
+
| ChargeAmount | decimal | Amount for this line item |
|
|
402
|
+
| ChargeName | string | Name of the charge |
|
|
403
|
+
| ChargeDate | datetime | When the charge was generated |
|
|
404
|
+
| ServiceStartDate | date | Service period start |
|
|
405
|
+
| ServiceEndDate | date | Service period end |
|
|
406
|
+
| Quantity | decimal | Quantity billed |
|
|
407
|
+
| UnitOfMeasure | string | Unit of measure |
|
|
408
|
+
| TaxAmount | decimal | Tax amount for this item |
|
|
409
|
+
`,
|
|
410
|
+
product: `# Product Object
|
|
411
|
+
|
|
412
|
+
| Field | Type | Description |
|
|
413
|
+
|---|---|---|
|
|
414
|
+
| Id | string | Unique identifier (UUID) |
|
|
415
|
+
| Name | string | Product name |
|
|
416
|
+
| SKU | string | Stock keeping unit |
|
|
417
|
+
| Description | string | Product description |
|
|
418
|
+
| Category | string | Product category |
|
|
419
|
+
| EffectiveStartDate | date | When the product becomes available |
|
|
420
|
+
| EffectiveEndDate | date | When the product expires |
|
|
421
|
+
`,
|
|
422
|
+
billrun: `# BillRun Object
|
|
423
|
+
|
|
424
|
+
| Field | Type | Description |
|
|
425
|
+
|---|---|---|
|
|
426
|
+
| Id | string | Unique identifier (UUID) |
|
|
427
|
+
| BillRunNumber | string | Human-readable bill run number |
|
|
428
|
+
| Status | string | Pending, Processing, Completed, Error, Canceled, PostInProgress, Posted |
|
|
429
|
+
| TargetDate | date | Charges through this date are included |
|
|
430
|
+
| InvoiceDate | date | Date printed on generated invoices |
|
|
431
|
+
| AutoPost | boolean | Whether invoices are auto-posted after generation |
|
|
432
|
+
| AutoEmail | boolean | Whether invoices are auto-emailed after posting |
|
|
433
|
+
| Name | string | Optional bill run label |
|
|
434
|
+
| CreatedDate | datetime | When the bill run was created |
|
|
435
|
+
| UpdatedDate | datetime | Last modification timestamp |
|
|
436
|
+
`,
|
|
437
|
+
productrateplan: `# ProductRatePlan Object
|
|
438
|
+
|
|
439
|
+
| Field | Type | Description |
|
|
440
|
+
|---|---|---|
|
|
441
|
+
| Id | string | Unique identifier (UUID) |
|
|
442
|
+
| ProductId | string | FK to Product.Id |
|
|
443
|
+
| Name | string | Rate plan name in catalog |
|
|
444
|
+
| Description | string | Rate plan description |
|
|
445
|
+
| EffectiveStartDate | date | When the plan becomes available |
|
|
446
|
+
| EffectiveEndDate | date | When the plan expires |
|
|
447
|
+
`,
|
|
448
|
+
};
|
|
449
|
+
// ==================== Registration ====================
|
|
450
|
+
export function registerResources(server) {
|
|
451
|
+
// Static resource: Data model relationships
|
|
452
|
+
server.resource("data-model-relationships", "zuora://data-model/relationships", {
|
|
453
|
+
description: "Zuora object hierarchy, foreign key mappings, and multi-step query patterns. " +
|
|
454
|
+
"Read this before writing ad-hoc ZOQL queries that span multiple objects.",
|
|
455
|
+
mimeType: "text/markdown",
|
|
456
|
+
}, async () => ({
|
|
457
|
+
contents: [
|
|
458
|
+
{
|
|
459
|
+
uri: "zuora://data-model/relationships",
|
|
460
|
+
mimeType: "text/markdown",
|
|
461
|
+
text: DATA_MODEL_RELATIONSHIPS,
|
|
462
|
+
},
|
|
463
|
+
],
|
|
464
|
+
}));
|
|
465
|
+
// Template resource: Object field definitions
|
|
466
|
+
server.resource("data-model-object", "zuora://data-model/objects/{name}", {
|
|
467
|
+
description: "Field names, types, and descriptions for a specific Zuora object. " +
|
|
468
|
+
"Available objects: account, subscription, invoice, payment, rateplan, " +
|
|
469
|
+
"rateplancharge, invoiceitem, product, productrateplan, billrun.",
|
|
470
|
+
mimeType: "text/markdown",
|
|
471
|
+
}, async (uri) => {
|
|
472
|
+
const objectName = uri.pathname.split("/").pop()?.toLowerCase() ?? "";
|
|
473
|
+
const content = OBJECT_FIELD_DEFINITIONS[objectName];
|
|
474
|
+
if (!content) {
|
|
475
|
+
const available = Object.keys(OBJECT_FIELD_DEFINITIONS).join(", ");
|
|
476
|
+
return {
|
|
477
|
+
contents: [
|
|
478
|
+
{
|
|
479
|
+
uri: uri.href,
|
|
480
|
+
mimeType: "text/plain",
|
|
481
|
+
text: `Unknown object: ${objectName}. Available objects: ${available}`,
|
|
482
|
+
},
|
|
483
|
+
],
|
|
484
|
+
};
|
|
485
|
+
}
|
|
486
|
+
return {
|
|
487
|
+
contents: [
|
|
488
|
+
{
|
|
489
|
+
uri: uri.href,
|
|
490
|
+
mimeType: "text/markdown",
|
|
491
|
+
text: content,
|
|
492
|
+
},
|
|
493
|
+
],
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
// Static resource: ZOQL syntax guide
|
|
497
|
+
server.resource("zoql-syntax-guide", "zuora://zoql/syntax-guide", {
|
|
498
|
+
description: "ZOQL syntax reference: SELECT/WHERE operators, limitations, pagination, " +
|
|
499
|
+
"date handling, and string escaping rules.",
|
|
500
|
+
mimeType: "text/markdown",
|
|
501
|
+
}, async () => ({
|
|
502
|
+
contents: [
|
|
503
|
+
{
|
|
504
|
+
uri: "zuora://zoql/syntax-guide",
|
|
505
|
+
mimeType: "text/markdown",
|
|
506
|
+
text: ZOQL_SYNTAX_GUIDE,
|
|
507
|
+
},
|
|
508
|
+
],
|
|
509
|
+
}));
|
|
510
|
+
// Static resource: Common ZOQL patterns
|
|
511
|
+
server.resource("zoql-common-patterns", "zuora://zoql/common-patterns", {
|
|
512
|
+
description: "Ready-to-use ZOQL query patterns for common finance scenarios: " +
|
|
513
|
+
"overdue invoices, active subscriptions, payment lookups, product searches, " +
|
|
514
|
+
"and multi-step joins.",
|
|
515
|
+
mimeType: "text/markdown",
|
|
516
|
+
}, async () => ({
|
|
517
|
+
contents: [
|
|
518
|
+
{
|
|
519
|
+
uri: "zuora://zoql/common-patterns",
|
|
520
|
+
mimeType: "text/markdown",
|
|
521
|
+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B,EAC3B;QACE,WAAW,EACT,0EAA0E;YAC1E,2CAA2C;QAC7C,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,IAAI,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,2BAA2B;gBAChC,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,iBAAiB;aACxB;SACF;KACF,CAAC,CACH,CAAC;IAEF,wCAAwC;IACxC,MAAM,CAAC,QAAQ,CACb,sBAAsB,EACtB,8BAA8B,EAC9B;QACE,WAAW,EACT,iEAAiE;YACjE,6EAA6E;YAC7E,uBAAuB;QACzB,QAAQ,EAAE,eAAe;KAC1B,EACD,KAAK,IAAI,EAAE,CAAC,CAAC;QACX,QAAQ,EAAE;YACR;gBACE,GAAG,EAAE,8BAA8B;gBACnC,QAAQ,EAAE,eAAe;gBACzB,IAAI,EAAE,oBAAoB;aAC3B;SACF;KACF,CAAC,CACH,CAAC;AACJ,CAAC"}
|
package/dist/setup.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive setup wizard for zuora-mcp.
|
|
3
|
+
*
|
|
4
|
+
* Zero external dependencies — uses only Node built-ins:
|
|
5
|
+
* node:readline/promises, node:fs, node:path, node:os
|
|
6
|
+
*
|
|
7
|
+
* Detects Claude Code and Claude Desktop config files, prompts for
|
|
8
|
+
* Zuora OAuth credentials, and writes MCP server entries using the
|
|
9
|
+
* npx-based format so the server auto-installs on first use.
|
|
10
|
+
*/
|
|
11
|
+
export declare function runSetup(): Promise<void>;
|
|
12
|
+
//# sourceMappingURL=setup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.d.ts","sourceRoot":"","sources":["../src/setup.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AA0MH,wBAAsB,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC,CA0D9C"}
|