@getcheddar/cheddar-mcp 1.0.4 → 2.0.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 +51 -160
- package/bin/cheddar-mcp.mjs +5 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +54 -52
- package/dist/index.js.map +1 -1
- package/dist/lib/legacy-client.d.ts +44 -0
- package/dist/lib/legacy-client.d.ts.map +1 -0
- package/dist/lib/legacy-client.js +149 -0
- package/dist/lib/legacy-client.js.map +1 -0
- package/dist/tools/customers.d.ts +2 -2
- package/dist/tools/customers.d.ts.map +1 -1
- package/dist/tools/customers.js +103 -103
- package/dist/tools/customers.js.map +1 -1
- package/dist/tools/plans.d.ts +10 -0
- package/dist/tools/plans.d.ts.map +1 -0
- package/dist/tools/plans.js +26 -0
- package/dist/tools/plans.js.map +1 -0
- package/package.json +8 -7
- package/dist/lib/cheddar-client.d.ts +0 -111
- package/dist/lib/cheddar-client.d.ts.map +0 -1
- package/dist/lib/cheddar-client.js +0 -101
- package/dist/lib/cheddar-client.js.map +0 -1
- package/dist/tools/checkout.d.ts +0 -10
- package/dist/tools/checkout.d.ts.map +0 -1
- package/dist/tools/checkout.js +0 -641
- package/dist/tools/checkout.js.map +0 -1
- package/dist/tools/payment-methods.d.ts +0 -10
- package/dist/tools/payment-methods.d.ts.map +0 -1
- package/dist/tools/payment-methods.js +0 -162
- package/dist/tools/payment-methods.js.map +0 -1
- package/dist/tools/subscriptions.d.ts +0 -10
- package/dist/tools/subscriptions.d.ts.map +0 -1
- package/dist/tools/subscriptions.js +0 -191
- package/dist/tools/subscriptions.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import {
|
|
2
|
+
import { LegacyCheddarClient } from "../lib/legacy-client.js";
|
|
3
3
|
export declare const customerTools: Tool[];
|
|
4
|
-
export declare function handleCustomerTool(client:
|
|
4
|
+
export declare function handleCustomerTool(client: LegacyCheddarClient, name: string, args: Record<string, unknown> | undefined): Promise<{
|
|
5
5
|
content: Array<{
|
|
6
6
|
type: string;
|
|
7
7
|
text: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"customers.d.ts","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,eAAO,MAAM,aAAa,EAAE,IAAI,EAkG/B,CAAC;AAQF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CA6C7D"}
|
package/dist/tools/customers.js
CHANGED
|
@@ -1,59 +1,67 @@
|
|
|
1
1
|
export const customerTools = [
|
|
2
2
|
{
|
|
3
3
|
name: "cheddar_customer_get",
|
|
4
|
-
description: "
|
|
4
|
+
description: "Fetch one customer via the legacy Cheddar API (HTTP Basic). Use customer code or CG customer id.",
|
|
5
5
|
inputSchema: {
|
|
6
6
|
type: "object",
|
|
7
7
|
properties: {
|
|
8
|
-
|
|
8
|
+
lookup: {
|
|
9
9
|
type: "string",
|
|
10
|
-
|
|
10
|
+
enum: ["code", "id"],
|
|
11
|
+
description: "Whether `value` is the customer code or internal id",
|
|
12
|
+
},
|
|
13
|
+
value: {
|
|
14
|
+
type: "string",
|
|
15
|
+
description: "Customer code or id",
|
|
11
16
|
},
|
|
12
17
|
},
|
|
13
|
-
required: ["
|
|
18
|
+
required: ["lookup", "value"],
|
|
14
19
|
},
|
|
15
20
|
},
|
|
16
21
|
{
|
|
17
|
-
name: "
|
|
18
|
-
description: "
|
|
22
|
+
name: "cheddar_customers_search",
|
|
23
|
+
description: "Search customers (legacy API). Supports text search and common filters; see GetCheddar docs for query parameters.",
|
|
19
24
|
inputSchema: {
|
|
20
25
|
type: "object",
|
|
21
26
|
properties: {
|
|
22
|
-
|
|
27
|
+
search: { type: "string", description: "Free-text search" },
|
|
28
|
+
subscriptionStatus: {
|
|
23
29
|
type: "string",
|
|
24
|
-
|
|
30
|
+
enum: ["activeOnly", "canceledOnly"],
|
|
25
31
|
},
|
|
26
|
-
|
|
32
|
+
orderBy: {
|
|
27
33
|
type: "string",
|
|
28
|
-
|
|
34
|
+
enum: ["name", "company", "plan", "billingDatetime", "createdDatetime"],
|
|
29
35
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
type: "string",
|
|
36
|
-
description: "
|
|
36
|
+
orderByDirection: { type: "string", enum: ["asc", "desc"] },
|
|
37
|
+
createdAfterDate: { type: "string", description: "YYYY-MM-DD" },
|
|
38
|
+
createdBeforeDate: { type: "string", description: "YYYY-MM-DD" },
|
|
39
|
+
planCode: {
|
|
40
|
+
type: "array",
|
|
41
|
+
items: { type: "string" },
|
|
42
|
+
description: "Filter by one or more plan codes",
|
|
37
43
|
},
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "cheddar_customer_create",
|
|
49
|
+
description: "Create a customer (legacy POST). Pass top-level fields and optional `subscription` per [GetCheddar docs](https://docs.getcheddar.com/). Prefer hosted checkout or `gatewayToken` flows for card data—do not send raw PAN/CVV through this tool.",
|
|
50
|
+
inputSchema: {
|
|
51
|
+
type: "object",
|
|
52
|
+
properties: {
|
|
53
|
+
code: { type: "string", description: "Required unique customer code" },
|
|
54
|
+
firstName: { type: "string" },
|
|
55
|
+
lastName: { type: "string" },
|
|
56
|
+
email: { type: "string" },
|
|
57
|
+
company: { type: "string" },
|
|
58
|
+
notes: { type: "string" },
|
|
59
|
+
taxRate: { type: "string" },
|
|
60
|
+
isTaxExempt: { type: "boolean" },
|
|
61
|
+
taxNumber: { type: "string" },
|
|
62
|
+
subscription: {
|
|
63
|
+
type: "object",
|
|
64
|
+
description: "Nested subscription fields allowed by the legacy API (e.g. planCode). Avoid raw card numbers; use processor tokenization or hosted collection.",
|
|
57
65
|
},
|
|
58
66
|
},
|
|
59
67
|
required: ["code"],
|
|
@@ -61,90 +69,82 @@ export const customerTools = [
|
|
|
61
69
|
},
|
|
62
70
|
{
|
|
63
71
|
name: "cheddar_customer_update",
|
|
64
|
-
description: "Update
|
|
72
|
+
description: "Update customer + subscription (legacy POST /customers/edit). Provide customer `code` and fields to change. Prefer token/hosted flows over raw card data.",
|
|
65
73
|
inputSchema: {
|
|
66
74
|
type: "object",
|
|
67
75
|
properties: {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
},
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
email: {
|
|
81
|
-
type: "string",
|
|
82
|
-
description: "Customer's email address",
|
|
83
|
-
},
|
|
84
|
-
company: {
|
|
85
|
-
type: "string",
|
|
86
|
-
description: "Customer's company name",
|
|
87
|
-
},
|
|
88
|
-
notes: {
|
|
89
|
-
type: "string",
|
|
90
|
-
description: "Internal notes about the customer",
|
|
91
|
-
},
|
|
92
|
-
taxRate: {
|
|
93
|
-
type: "string",
|
|
94
|
-
description: "Tax rate to apply to this customer",
|
|
95
|
-
},
|
|
96
|
-
isTaxExempt: {
|
|
97
|
-
type: "boolean",
|
|
98
|
-
description: "Whether the customer is tax exempt",
|
|
99
|
-
},
|
|
100
|
-
taxNumber: {
|
|
101
|
-
type: "string",
|
|
102
|
-
description: "Tax/VAT number for the customer",
|
|
76
|
+
code: { type: "string", description: "Customer code to edit" },
|
|
77
|
+
firstName: { type: "string" },
|
|
78
|
+
lastName: { type: "string" },
|
|
79
|
+
email: { type: "string" },
|
|
80
|
+
company: { type: "string" },
|
|
81
|
+
notes: { type: "string" },
|
|
82
|
+
taxRate: { type: "string" },
|
|
83
|
+
isTaxExempt: { type: "boolean" },
|
|
84
|
+
taxNumber: { type: "string" },
|
|
85
|
+
subscription: {
|
|
86
|
+
type: "object",
|
|
87
|
+
description: "Subscription fields per legacy API docs; avoid sending full card numbers through the MCP.",
|
|
103
88
|
},
|
|
104
89
|
},
|
|
105
|
-
required: ["
|
|
90
|
+
required: ["code"],
|
|
106
91
|
},
|
|
107
92
|
},
|
|
108
93
|
];
|
|
94
|
+
function jsonResult(data) {
|
|
95
|
+
return {
|
|
96
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
97
|
+
};
|
|
98
|
+
}
|
|
109
99
|
export async function handleCustomerTool(client, name, args) {
|
|
100
|
+
const a = args || {};
|
|
110
101
|
switch (name) {
|
|
111
102
|
case "cheddar_customer_get": {
|
|
112
|
-
const {
|
|
113
|
-
const
|
|
114
|
-
return
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
103
|
+
const { lookup, value } = a;
|
|
104
|
+
const data = await client.getCustomer(lookup, value);
|
|
105
|
+
return jsonResult(data);
|
|
106
|
+
}
|
|
107
|
+
case "cheddar_customers_search": {
|
|
108
|
+
const params = {};
|
|
109
|
+
if (a.search)
|
|
110
|
+
params.search = String(a.search);
|
|
111
|
+
if (a.subscriptionStatus)
|
|
112
|
+
params.subscriptionStatus = String(a.subscriptionStatus);
|
|
113
|
+
if (a.orderBy)
|
|
114
|
+
params.orderBy = String(a.orderBy);
|
|
115
|
+
if (a.orderByDirection)
|
|
116
|
+
params.orderByDirection = String(a.orderByDirection);
|
|
117
|
+
if (a.createdAfterDate)
|
|
118
|
+
params.createdAfterDate = String(a.createdAfterDate);
|
|
119
|
+
if (a.createdBeforeDate)
|
|
120
|
+
params.createdBeforeDate = String(a.createdBeforeDate);
|
|
121
|
+
if (Array.isArray(a.planCode)) {
|
|
122
|
+
a.planCode.forEach((c, i) => {
|
|
123
|
+
params[`planCode[${i}]`] = c;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
const data = await client.searchCustomers(params);
|
|
127
|
+
return jsonResult(data);
|
|
122
128
|
}
|
|
123
129
|
case "cheddar_customer_create": {
|
|
124
|
-
const
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
},
|
|
131
|
-
],
|
|
132
|
-
};
|
|
130
|
+
const { code, subscription, ...rest } = a;
|
|
131
|
+
const fields = { code, ...rest };
|
|
132
|
+
if (subscription)
|
|
133
|
+
fields.subscription = subscription;
|
|
134
|
+
const data = await client.createCustomer(fields);
|
|
135
|
+
return jsonResult(data);
|
|
133
136
|
}
|
|
134
137
|
case "cheddar_customer_update": {
|
|
135
|
-
const {
|
|
136
|
-
const
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
};
|
|
138
|
+
const { code, ...updates } = a;
|
|
139
|
+
const { subscription, ...rest } = updates;
|
|
140
|
+
const fields = { ...rest };
|
|
141
|
+
if (subscription)
|
|
142
|
+
fields.subscription = subscription;
|
|
143
|
+
const data = await client.updateCustomer(code, fields);
|
|
144
|
+
return jsonResult(data);
|
|
145
145
|
}
|
|
146
146
|
default:
|
|
147
|
-
throw new Error(`Unknown
|
|
147
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
//# sourceMappingURL=customers.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,
|
|
1
|
+
{"version":3,"file":"customers.js","sourceRoot":"","sources":["../../src/tools/customers.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,aAAa,GAAW;IACnC;QACE,IAAI,EAAE,sBAAsB;QAC5B,WAAW,EACT,kGAAkG;QACpG,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE;oBACN,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC;oBACpB,WAAW,EAAE,qDAAqD;iBACnE;gBACD,KAAK,EAAE;oBACL,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,qBAAqB;iBACnC;aACF;YACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC;SAC9B;KACF;IACD;QACE,IAAI,EAAE,0BAA0B;QAChC,WAAW,EACT,mHAAmH;QACrH,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,MAAM,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,WAAW,EAAE,kBAAkB,EAAE;gBAC3D,kBAAkB,EAAE;oBAClB,IAAI,EAAE,QAAQ;oBACd,IAAI,EAAE,CAAC,YAAY,EAAE,cAAc,CAAC;iBACrC;gB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,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC/B,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,CAGvC,CAAC;YACF,MAAM,MAAM,GAA4B,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC;YAC1D,IAAI,YAAY;gBAAE,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC;YACjD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC/B,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,GAAG,CAA+C,CAAC;YAC7E,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;YAC1C,MAAM,MAAM,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;YACpD,IAAI,YAAY;gBAAE,MAAM,CAAC,YAAY,GAAG,YAAY,CAAC;YACrD,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YACvD,OAAO,UAAU,CAAC,IAAI,CAAC,CAAC;QAC1B,CAAC;QACD;YACE,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { LegacyCheddarClient } from "../lib/legacy-client.js";
|
|
3
|
+
export declare const planTools: Tool[];
|
|
4
|
+
export declare function handlePlanTool(client: LegacyCheddarClient, name: string, args: Record<string, unknown> | undefined): Promise<{
|
|
5
|
+
content: Array<{
|
|
6
|
+
type: string;
|
|
7
|
+
text: string;
|
|
8
|
+
}>;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=plans.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.d.ts","sourceRoot":"","sources":["../../src/tools/plans.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE9D,eAAO,MAAM,SAAS,EAAE,IAAI,EAe3B,CAAC;AAEF,wBAAsB,cAAc,CAClC,MAAM,EAAE,mBAAmB,EAC3B,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAS7D"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const planTools = [
|
|
2
|
+
{
|
|
3
|
+
name: "cheddar_plans_get",
|
|
4
|
+
description: "List all pricing plans for the product, or fetch one plan by code (legacy /xml/plans/get).",
|
|
5
|
+
inputSchema: {
|
|
6
|
+
type: "object",
|
|
7
|
+
properties: {
|
|
8
|
+
planCode: {
|
|
9
|
+
type: "string",
|
|
10
|
+
description: "If set, return a single plan with this code; otherwise return all plans",
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
];
|
|
16
|
+
export async function handlePlanTool(client, name, args) {
|
|
17
|
+
if (name !== "cheddar_plans_get") {
|
|
18
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
19
|
+
}
|
|
20
|
+
const planCode = args?.planCode != null ? String(args.planCode) : undefined;
|
|
21
|
+
const data = await client.getPlans(planCode);
|
|
22
|
+
return {
|
|
23
|
+
content: [{ type: "text", text: JSON.stringify(data, null, 2) }],
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=plans.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plans.js","sourceRoot":"","sources":["../../src/tools/plans.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,SAAS,GAAW;IAC/B;QACE,IAAI,EAAE,mBAAmB;QACzB,WAAW,EACT,4FAA4F;QAC9F,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,QAAQ,EAAE;oBACR,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,yEAAyE;iBACvF;aACF;SACF;KACF;CACF,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,MAA2B,EAC3B,IAAY,EACZ,IAAyC;IAEzC,IAAI,IAAI,KAAK,mBAAmB,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,iBAAiB,IAAI,EAAE,CAAC,CAAC;IAC3C,CAAC;IACD,MAAM,QAAQ,GAAG,IAAI,EAAE,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAC5E,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAC7C,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;KACjE,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getcheddar/cheddar-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Model Context Protocol server for Cheddar Payment Platform integration",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
8
8
|
"type": "module",
|
|
9
9
|
"bin": {
|
|
10
|
-
"cheddar-mcp": "
|
|
10
|
+
"cheddar-mcp": "bin/cheddar-mcp.mjs"
|
|
11
11
|
},
|
|
12
12
|
"main": "./dist/index.js",
|
|
13
13
|
"types": "./dist/index.d.ts",
|
|
14
14
|
"files": [
|
|
15
|
+
"bin/cheddar-mcp.mjs",
|
|
15
16
|
"dist/**/*",
|
|
16
17
|
"README.md",
|
|
17
18
|
"LICENSE"
|
|
@@ -39,15 +40,15 @@
|
|
|
39
40
|
"license": "MIT",
|
|
40
41
|
"dependencies": {
|
|
41
42
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
42
|
-
"
|
|
43
|
-
"
|
|
43
|
+
"dotenv": "^16.3.1",
|
|
44
|
+
"fast-xml-parser": "^4.5.0"
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@types/node": "^20.10.0",
|
|
47
|
-
"typescript": "^5.3.0",
|
|
48
|
-
"vitest": "^1.0.0",
|
|
49
48
|
"eslint": "^8.55.0",
|
|
50
|
-
"prettier": "^3.1.0"
|
|
49
|
+
"prettier": "^3.1.0",
|
|
50
|
+
"typescript": "^5.3.0",
|
|
51
|
+
"vitest": "^1.0.0"
|
|
51
52
|
},
|
|
52
53
|
"engines": {
|
|
53
54
|
"node": ">=18.0.0"
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
export interface CheddarConfig {
|
|
2
|
-
apiUrl: string;
|
|
3
|
-
clientId?: string;
|
|
4
|
-
clientSecret?: string;
|
|
5
|
-
accessToken?: string;
|
|
6
|
-
}
|
|
7
|
-
export interface Customer {
|
|
8
|
-
id: string;
|
|
9
|
-
code: string;
|
|
10
|
-
firstName?: string;
|
|
11
|
-
lastName?: string;
|
|
12
|
-
email?: string;
|
|
13
|
-
company?: string;
|
|
14
|
-
notes?: string;
|
|
15
|
-
taxRate?: string;
|
|
16
|
-
isTaxExempt?: boolean;
|
|
17
|
-
taxNumber?: string;
|
|
18
|
-
createdDatetime: string;
|
|
19
|
-
}
|
|
20
|
-
export interface PaymentMethod {
|
|
21
|
-
id: string;
|
|
22
|
-
type: "CreditCard" | "PayPalPreapproval" | "PayPalBillingAgreement" | "External";
|
|
23
|
-
gatewayAccountId: string;
|
|
24
|
-
isPrimary: boolean;
|
|
25
|
-
isActive: boolean;
|
|
26
|
-
createdDatetime: string;
|
|
27
|
-
card?: {
|
|
28
|
-
lastFour: string;
|
|
29
|
-
cardType?: string;
|
|
30
|
-
expirationDate?: string;
|
|
31
|
-
};
|
|
32
|
-
paypal?: {
|
|
33
|
-
email?: string;
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
export interface PaymentMethodToken {
|
|
37
|
-
token: string;
|
|
38
|
-
expiresAt: string;
|
|
39
|
-
}
|
|
40
|
-
export interface Subscription {
|
|
41
|
-
id: string;
|
|
42
|
-
customerId: string;
|
|
43
|
-
planId: string;
|
|
44
|
-
paymentMethodId?: string;
|
|
45
|
-
status: "active" | "canceled" | "expired" | "pending";
|
|
46
|
-
startDate?: string;
|
|
47
|
-
endDate?: string;
|
|
48
|
-
nextBillDate?: string;
|
|
49
|
-
createdDatetime: string;
|
|
50
|
-
}
|
|
51
|
-
export interface Plan {
|
|
52
|
-
id: string;
|
|
53
|
-
code: string;
|
|
54
|
-
name?: string;
|
|
55
|
-
description?: string;
|
|
56
|
-
isActive: boolean;
|
|
57
|
-
setupChargeAmount?: string;
|
|
58
|
-
recurringChargeAmount?: string;
|
|
59
|
-
trialDays?: number;
|
|
60
|
-
billingFrequency?: string;
|
|
61
|
-
billingFrequencyQuantity?: number;
|
|
62
|
-
billingFrequencyUnit?: string;
|
|
63
|
-
createdDatetime: string;
|
|
64
|
-
}
|
|
65
|
-
export interface Product {
|
|
66
|
-
id: string;
|
|
67
|
-
code: string;
|
|
68
|
-
name?: string;
|
|
69
|
-
country?: string;
|
|
70
|
-
currency?: string;
|
|
71
|
-
createdDatetime: string;
|
|
72
|
-
}
|
|
73
|
-
export interface GatewayAccount {
|
|
74
|
-
id: string;
|
|
75
|
-
gateway: string;
|
|
76
|
-
isActive: boolean;
|
|
77
|
-
isPrimary: boolean;
|
|
78
|
-
createdDatetime: string;
|
|
79
|
-
}
|
|
80
|
-
export declare class CheddarApiClient {
|
|
81
|
-
private config;
|
|
82
|
-
private baseUrl;
|
|
83
|
-
constructor(config: CheddarConfig);
|
|
84
|
-
private getAuthHeaders;
|
|
85
|
-
private request;
|
|
86
|
-
getCustomer(id: string): Promise<Customer>;
|
|
87
|
-
createCustomer(customerData: Partial<Customer>): Promise<Customer>;
|
|
88
|
-
updateCustomer(id: string, updates: Partial<Customer>): Promise<Customer>;
|
|
89
|
-
getPaymentMethod(id: string): Promise<PaymentMethod>;
|
|
90
|
-
getPaymentMethodCustomer(id: string): Promise<Customer>;
|
|
91
|
-
getPaymentMethodGatewayAccount(id: string): Promise<GatewayAccount>;
|
|
92
|
-
createPaymentMethodToken(paymentData: {
|
|
93
|
-
cardNumber: string;
|
|
94
|
-
expirationDate: string;
|
|
95
|
-
cvv: string;
|
|
96
|
-
cardholderName?: string;
|
|
97
|
-
}): Promise<PaymentMethodToken>;
|
|
98
|
-
addPaymentMethodToCustomer(customerId: string, token: string): Promise<PaymentMethod>;
|
|
99
|
-
getSubscription(id: string): Promise<Subscription>;
|
|
100
|
-
getSubscriptionCustomer(id: string): Promise<Customer>;
|
|
101
|
-
getSubscriptionPlan(id: string): Promise<Plan>;
|
|
102
|
-
getSubscriptionPaymentMethod(id: string): Promise<PaymentMethod>;
|
|
103
|
-
deleteSubscriptionPromotion(customerId: string): Promise<void>;
|
|
104
|
-
getProduct(): Promise<Product>;
|
|
105
|
-
getPlan(id: string): Promise<Plan>;
|
|
106
|
-
getGatewayAccount(id: string): Promise<GatewayAccount>;
|
|
107
|
-
ping(): Promise<{
|
|
108
|
-
ack: number;
|
|
109
|
-
}>;
|
|
110
|
-
}
|
|
111
|
-
//# sourceMappingURL=cheddar-client.d.ts.map
|
|
@@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AAI,CAAC;IAS9D,UAAU,IAAI,OAAO,CAAC,OAAO,CAAC;IAM9B,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAMlC,iBAAiB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAMtD,IAAI,IAAI,OAAO,CAAC;QAAE,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;CAGvC"}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// Cheddar API Client - wraps the REST API for the MCP server
|
|
2
|
-
export class CheddarApiClient {
|
|
3
|
-
config;
|
|
4
|
-
baseUrl;
|
|
5
|
-
constructor(config) {
|
|
6
|
-
this.config = config;
|
|
7
|
-
this.baseUrl = config.apiUrl.replace(/\/$/, "");
|
|
8
|
-
}
|
|
9
|
-
async getAuthHeaders() {
|
|
10
|
-
// If access token is provided directly, use it
|
|
11
|
-
if (this.config.accessToken) {
|
|
12
|
-
return {
|
|
13
|
-
Authorization: `Bearer ${this.config.accessToken}`,
|
|
14
|
-
"Content-Type": "application/json",
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
// Otherwise, implement OAuth2 token fetch
|
|
18
|
-
// Note: In production, you'd want to cache and refresh tokens
|
|
19
|
-
throw new Error("OAuth2 token refresh not yet implemented. Please provide CHEDDAR_ACCESS_TOKEN.");
|
|
20
|
-
}
|
|
21
|
-
async request(method, path, body) {
|
|
22
|
-
const headers = await this.getAuthHeaders();
|
|
23
|
-
const url = `${this.baseUrl}${path}`;
|
|
24
|
-
const response = await fetch(url, {
|
|
25
|
-
method,
|
|
26
|
-
headers,
|
|
27
|
-
body: body ? JSON.stringify(body) : undefined,
|
|
28
|
-
});
|
|
29
|
-
if (!response.ok) {
|
|
30
|
-
const errorText = await response.text();
|
|
31
|
-
throw new Error(`Cheddar API error (${response.status}): ${errorText}`);
|
|
32
|
-
}
|
|
33
|
-
return response.json();
|
|
34
|
-
}
|
|
35
|
-
// ==================== Customer Operations ====================
|
|
36
|
-
async getCustomer(id) {
|
|
37
|
-
return this.request("GET", `/customer/${encodeURIComponent(id)}`);
|
|
38
|
-
}
|
|
39
|
-
async createCustomer(customerData) {
|
|
40
|
-
return this.request("POST", "/customer", customerData);
|
|
41
|
-
}
|
|
42
|
-
async updateCustomer(id, updates) {
|
|
43
|
-
return this.request("PATCH", `/customer/${encodeURIComponent(id)}`, updates);
|
|
44
|
-
}
|
|
45
|
-
// ==================== Payment Method Operations ====================
|
|
46
|
-
async getPaymentMethod(id) {
|
|
47
|
-
return this.request("GET", `/payment-method/${encodeURIComponent(id)}`);
|
|
48
|
-
}
|
|
49
|
-
async getPaymentMethodCustomer(id) {
|
|
50
|
-
return this.request("GET", `/payment-method/${encodeURIComponent(id)}/customer`);
|
|
51
|
-
}
|
|
52
|
-
async getPaymentMethodGatewayAccount(id) {
|
|
53
|
-
return this.request("GET", `/payment-method/${encodeURIComponent(id)}/gateway-account`);
|
|
54
|
-
}
|
|
55
|
-
async createPaymentMethodToken(paymentData) {
|
|
56
|
-
return this.request("POST", "/payment-method-token", {
|
|
57
|
-
creditCard: {
|
|
58
|
-
cardNumber: paymentData.cardNumber,
|
|
59
|
-
expirationDate: paymentData.expirationDate,
|
|
60
|
-
cvv: paymentData.cvv,
|
|
61
|
-
cardholderName: paymentData.cardholderName,
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
async addPaymentMethodToCustomer(customerId, token) {
|
|
66
|
-
return this.request("POST", `/customer/${encodeURIComponent(customerId)}/payment-method`, { token });
|
|
67
|
-
}
|
|
68
|
-
// ==================== Subscription Operations ====================
|
|
69
|
-
async getSubscription(id) {
|
|
70
|
-
return this.request("GET", `/subscription/${encodeURIComponent(id)}`);
|
|
71
|
-
}
|
|
72
|
-
async getSubscriptionCustomer(id) {
|
|
73
|
-
return this.request("GET", `/subscription/${encodeURIComponent(id)}/customer`);
|
|
74
|
-
}
|
|
75
|
-
async getSubscriptionPlan(id) {
|
|
76
|
-
return this.request("GET", `/subscription/${encodeURIComponent(id)}/plan`);
|
|
77
|
-
}
|
|
78
|
-
async getSubscriptionPaymentMethod(id) {
|
|
79
|
-
return this.request("GET", `/subscription/${encodeURIComponent(id)}/payment-method`);
|
|
80
|
-
}
|
|
81
|
-
async deleteSubscriptionPromotion(customerId) {
|
|
82
|
-
await this.request("DELETE", `/customer/${encodeURIComponent(customerId)}/subscription/promotion`);
|
|
83
|
-
}
|
|
84
|
-
// ==================== Product Operations ====================
|
|
85
|
-
async getProduct() {
|
|
86
|
-
return this.request("GET", "/product");
|
|
87
|
-
}
|
|
88
|
-
// ==================== Plan Operations ====================
|
|
89
|
-
async getPlan(id) {
|
|
90
|
-
return this.request("GET", `/plan/${encodeURIComponent(id)}`);
|
|
91
|
-
}
|
|
92
|
-
// ==================== Gateway Account Operations ====================
|
|
93
|
-
async getGatewayAccount(id) {
|
|
94
|
-
return this.request("GET", `/gateway-account/${encodeURIComponent(id)}`);
|
|
95
|
-
}
|
|
96
|
-
// ==================== Health Check ====================
|
|
97
|
-
async ping() {
|
|
98
|
-
return this.request("GET", "/ping");
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
//# sourceMappingURL=cheddar-client.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cheddar-client.js","sourceRoot":"","sources":["../../src/lib/cheddar-client.ts"],"names":[],"mappings":"AAAA,6DAA6D;AA0F7D,MAAM,OAAO,gBAAgB;IACnB,MAAM,CAAgB;IACtB,OAAO,CAAS;IAExB,YAAY,MAAqB;QAC/B,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;IAClD,CAAC;IAEO,KAAK,CAAC,cAAc;QAC1B,+CAA+C;QAC/C,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,EAAE,CAAC;YAC5B,OAAO;gBAC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tool } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
-
import { CheddarApiClient } from "../lib/cheddar-client.js";
|
|
3
|
-
export declare const checkoutTools: Tool[];
|
|
4
|
-
export declare function handleCheckoutTool(client: CheddarApiClient, name: string, args: Record<string, unknown> | undefined): Promise<{
|
|
5
|
-
content: Array<{
|
|
6
|
-
type: string;
|
|
7
|
-
text: string;
|
|
8
|
-
}>;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=checkout.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkout.d.ts","sourceRoot":"","sources":["../../src/tools/checkout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAO,MAAM,aAAa,EAAE,IAAI,EA0I/B,CAAC;AAEF,wBAAsB,kBAAkB,CACtC,MAAM,EAAE,gBAAgB,EACxB,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GACxC,OAAO,CAAC;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC,CAsK7D"}
|