@getcheddar/cheddar-mcp 0.1.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.
@@ -0,0 +1,150 @@
1
+ export const customerTools = [
2
+ {
3
+ name: "cheddar_customer_get",
4
+ description: "Retrieve a customer by their ID or code from Cheddar",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ id: {
9
+ type: "string",
10
+ description: "The customer ID (UUID) or unique customer code",
11
+ },
12
+ },
13
+ required: ["id"],
14
+ },
15
+ },
16
+ {
17
+ name: "cheddar_customer_create",
18
+ description: "Create a new customer in Cheddar",
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {
22
+ code: {
23
+ type: "string",
24
+ description: "Unique customer code/identifier (required)",
25
+ },
26
+ firstName: {
27
+ type: "string",
28
+ description: "Customer's first name",
29
+ },
30
+ lastName: {
31
+ type: "string",
32
+ description: "Customer's last name",
33
+ },
34
+ email: {
35
+ type: "string",
36
+ description: "Customer's email address",
37
+ },
38
+ company: {
39
+ type: "string",
40
+ description: "Customer's company name",
41
+ },
42
+ notes: {
43
+ type: "string",
44
+ description: "Internal notes about the customer",
45
+ },
46
+ taxRate: {
47
+ type: "string",
48
+ description: "Tax rate to apply to this customer (e.g., '0.08' for 8%)",
49
+ },
50
+ isTaxExempt: {
51
+ type: "boolean",
52
+ description: "Whether the customer is tax exempt",
53
+ },
54
+ taxNumber: {
55
+ type: "string",
56
+ description: "Tax/VAT number for the customer",
57
+ },
58
+ },
59
+ required: ["code"],
60
+ },
61
+ },
62
+ {
63
+ name: "cheddar_customer_update",
64
+ description: "Update an existing customer's information in Cheddar",
65
+ inputSchema: {
66
+ type: "object",
67
+ properties: {
68
+ id: {
69
+ type: "string",
70
+ description: "The customer ID or code to update",
71
+ },
72
+ firstName: {
73
+ type: "string",
74
+ description: "Customer's first name",
75
+ },
76
+ lastName: {
77
+ type: "string",
78
+ description: "Customer's last name",
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",
103
+ },
104
+ },
105
+ required: ["id"],
106
+ },
107
+ },
108
+ ];
109
+ export async function handleCustomerTool(client, name, args) {
110
+ switch (name) {
111
+ case "cheddar_customer_get": {
112
+ const { id } = args;
113
+ const customer = await client.getCustomer(id);
114
+ return {
115
+ content: [
116
+ {
117
+ type: "text",
118
+ text: JSON.stringify(customer, null, 2),
119
+ },
120
+ ],
121
+ };
122
+ }
123
+ case "cheddar_customer_create": {
124
+ const customer = await client.createCustomer(args);
125
+ return {
126
+ content: [
127
+ {
128
+ type: "text",
129
+ text: `Customer created successfully:\n${JSON.stringify(customer, null, 2)}`,
130
+ },
131
+ ],
132
+ };
133
+ }
134
+ case "cheddar_customer_update": {
135
+ const { id, ...updates } = args;
136
+ const customer = await client.updateCustomer(id, updates);
137
+ return {
138
+ content: [
139
+ {
140
+ type: "text",
141
+ text: `Customer updated successfully:\n${JSON.stringify(customer, null, 2)}`,
142
+ },
143
+ ],
144
+ };
145
+ }
146
+ default:
147
+ throw new Error(`Unknown customer tool: ${name}`);
148
+ }
149
+ }
150
+ //# sourceMappingURL=customers.js.map
@@ -0,0 +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,EAAE,sDAAsD;QACnE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oB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E,MAAM;wBACZ,IAAI,EAAE,mCAAmC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBAC7E;iBACF;aACF,CAAC;QACJ,CAAC;QAED,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC/B,MAAM,EAAE,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,IAAsB,CAAC;YAClD,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC1D,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mCAAmC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBAC7E;iBACF;aACF,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,0BAA0B,IAAI,EAAE,CAAC,CAAC;IACtD,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Tool } from "@modelcontextprotocol/sdk/types.js";
2
+ import { CheddarApiClient } from "../lib/cheddar-client.js";
3
+ export declare const paymentMethodTools: Tool[];
4
+ export declare function handlePaymentMethodTool(client: CheddarApiClient, name: string, args: Record<string, unknown> | undefined): Promise<{
5
+ content: Array<{
6
+ type: string;
7
+ text: string;
8
+ }>;
9
+ }>;
10
+ //# sourceMappingURL=payment-methods.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-methods.d.ts","sourceRoot":"","sources":["../../src/tools/payment-methods.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAO,MAAM,kBAAkB,EAAE,IAAI,EAuFpC,CAAC;AAEF,wBAAsB,uBAAuB,CAC3C,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,CAqF7D"}
@@ -0,0 +1,162 @@
1
+ export const paymentMethodTools = [
2
+ {
3
+ name: "cheddar_payment_method_get",
4
+ description: "Retrieve a payment method by its ID from Cheddar",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ id: {
9
+ type: "string",
10
+ description: "The payment method ID (UUID)",
11
+ },
12
+ },
13
+ required: ["id"],
14
+ },
15
+ },
16
+ {
17
+ name: "cheddar_payment_method_get_customer",
18
+ description: "Get the customer associated with a payment method",
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {
22
+ id: {
23
+ type: "string",
24
+ description: "The payment method ID (UUID)",
25
+ },
26
+ },
27
+ required: ["id"],
28
+ },
29
+ },
30
+ {
31
+ name: "cheddar_payment_method_get_gateway_account",
32
+ description: "Get the gateway account for a payment method",
33
+ inputSchema: {
34
+ type: "object",
35
+ properties: {
36
+ id: {
37
+ type: "string",
38
+ description: "The payment method ID (UUID)",
39
+ },
40
+ },
41
+ required: ["id"],
42
+ },
43
+ },
44
+ {
45
+ name: "cheddar_payment_token_create",
46
+ description: "Create a secure token for a payment method (PCI-compliant). This tokenizes card details and returns a nonce that can be used to add the payment method to a customer.",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ cardNumber: {
51
+ type: "string",
52
+ description: "Credit card number (will be tokenized, never stored)",
53
+ },
54
+ expirationDate: {
55
+ type: "string",
56
+ description: "Card expiration date in MM/YY or MM/YYYY format",
57
+ },
58
+ cvv: {
59
+ type: "string",
60
+ description: "Card security code/CVV",
61
+ },
62
+ cardholderName: {
63
+ type: "string",
64
+ description: "Name on the card (optional)",
65
+ },
66
+ },
67
+ required: ["cardNumber", "expirationDate", "cvv"],
68
+ },
69
+ },
70
+ {
71
+ name: "cheddar_payment_method_add_to_customer",
72
+ description: "Add a tokenized payment method to a customer. Requires a valid token from cheddar_payment_token_create.",
73
+ inputSchema: {
74
+ type: "object",
75
+ properties: {
76
+ customerId: {
77
+ type: "string",
78
+ description: "The customer ID or code to add the payment method to",
79
+ },
80
+ token: {
81
+ type: "string",
82
+ description: "The payment method token from create_payment_token",
83
+ },
84
+ },
85
+ required: ["customerId", "token"],
86
+ },
87
+ },
88
+ ];
89
+ export async function handlePaymentMethodTool(client, name, args) {
90
+ switch (name) {
91
+ case "cheddar_payment_method_get": {
92
+ const { id } = args;
93
+ const paymentMethod = await client.getPaymentMethod(id);
94
+ return {
95
+ content: [
96
+ {
97
+ type: "text",
98
+ text: JSON.stringify(paymentMethod, null, 2),
99
+ },
100
+ ],
101
+ };
102
+ }
103
+ case "cheddar_payment_method_get_customer": {
104
+ const { id } = args;
105
+ const customer = await client.getPaymentMethodCustomer(id);
106
+ return {
107
+ content: [
108
+ {
109
+ type: "text",
110
+ text: JSON.stringify(customer, null, 2),
111
+ },
112
+ ],
113
+ };
114
+ }
115
+ case "cheddar_payment_method_get_gateway_account": {
116
+ const { id } = args;
117
+ const gatewayAccount = await client.getPaymentMethodGatewayAccount(id);
118
+ return {
119
+ content: [
120
+ {
121
+ type: "text",
122
+ text: JSON.stringify(gatewayAccount, null, 2),
123
+ },
124
+ ],
125
+ };
126
+ }
127
+ case "cheddar_payment_token_create": {
128
+ const { cardNumber, expirationDate, cvv, cardholderName } = args;
129
+ // Mask card number in response for security
130
+ const maskedCard = cardNumber.slice(-4).padStart(cardNumber.length, "*");
131
+ const token = await client.createPaymentMethodToken({
132
+ cardNumber,
133
+ expirationDate,
134
+ cvv,
135
+ cardholderName,
136
+ });
137
+ return {
138
+ content: [
139
+ {
140
+ type: "text",
141
+ text: `Payment token created for card ending in ${maskedCard.slice(-4)}:\n${JSON.stringify(token, null, 2)}\n\nThis token expires at: ${token.expiresAt}\nUse cheddar_payment_method_add_to_customer to attach this to a customer.`,
142
+ },
143
+ ],
144
+ };
145
+ }
146
+ case "cheddar_payment_method_add_to_customer": {
147
+ const { customerId, token } = args;
148
+ const paymentMethod = await client.addPaymentMethodToCustomer(customerId, token);
149
+ return {
150
+ content: [
151
+ {
152
+ type: "text",
153
+ text: `Payment method added to customer successfully:\n${JSON.stringify(paymentMethod, null, 2)}`,
154
+ },
155
+ ],
156
+ };
157
+ }
158
+ default:
159
+ throw new Error(`Unknown payment method tool: ${name}`);
160
+ }
161
+ }
162
+ //# sourceMappingURL=payment-methods.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-methods.js","sourceRoot":"","sources":["../../src/tools/payment-methods.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAW;IACxC;QACE,IAAI,EAAE,4BAA4B;QAClC,WAAW,EAAE,kDAAkD;QAC/D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF;IACD;QACE,IAAI,EAAE,qCAAqC;QAC3C,WAAW,EAAE,mDAAmD;QAChE,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF;IACD;QACE,IAAI,EAAE,4CAA4C;QAClD,WAAW,EAAE,8CAA8C;QAC3D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,8BAA8B;iBAC5C;aACF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;K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,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,8BAA8B,KAAK,CAAC,SAAS,4EAA4E;qBACpO;iBACF;aACF,CAAC;QACJ,CAAC;QAED,KAAK,wCAAwC,CAAC,CAAC,CAAC;YAC9C,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,GAAG,IAA6C,CAAC;YAC5E,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,0BAA0B,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;YACjF,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAM;wBACZ,IAAI,EAAE,mDAAmD,IAAI,CAAC,SAAS,CAAC,aAAa,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;qBAClG;iBACF;aACF,CAAC;QACJ,CAAC;QAED;YACE,MAAM,IAAI,KAAK,CAAC,gCAAgC,IAAI,EAAE,CAAC,CAAC;IAC5D,CAAC;AACH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { Tool } from "@modelcontextprotocol/sdk/types.js";
2
+ import { CheddarApiClient } from "../lib/cheddar-client.js";
3
+ export declare const subscriptionTools: Tool[];
4
+ export declare function handleSubscriptionTool(client: CheddarApiClient, name: string, args: Record<string, unknown> | undefined): Promise<{
5
+ content: Array<{
6
+ type: string;
7
+ text: string;
8
+ }>;
9
+ }>;
10
+ //# sourceMappingURL=subscriptions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.d.ts","sourceRoot":"","sources":["../../src/tools/subscriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAC;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,eAAO,MAAM,iBAAiB,EAAE,IAAI,EAmGnC,CAAC;AAEF,wBAAsB,sBAAsB,CAC1C,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,CAgG7D"}
@@ -0,0 +1,191 @@
1
+ export const subscriptionTools = [
2
+ {
3
+ name: "cheddar_subscription_get",
4
+ description: "Retrieve a subscription by its ID from Cheddar",
5
+ inputSchema: {
6
+ type: "object",
7
+ properties: {
8
+ id: {
9
+ type: "string",
10
+ description: "The subscription ID (UUID)",
11
+ },
12
+ },
13
+ required: ["id"],
14
+ },
15
+ },
16
+ {
17
+ name: "cheddar_subscription_get_customer",
18
+ description: "Get the customer associated with a subscription",
19
+ inputSchema: {
20
+ type: "object",
21
+ properties: {
22
+ id: {
23
+ type: "string",
24
+ description: "The subscription ID (UUID)",
25
+ },
26
+ },
27
+ required: ["id"],
28
+ },
29
+ },
30
+ {
31
+ name: "cheddar_subscription_get_plan",
32
+ description: "Get the plan associated with a subscription",
33
+ inputSchema: {
34
+ type: "object",
35
+ properties: {
36
+ id: {
37
+ type: "string",
38
+ description: "The subscription ID (UUID)",
39
+ },
40
+ },
41
+ required: ["id"],
42
+ },
43
+ },
44
+ {
45
+ name: "cheddar_subscription_get_payment_method",
46
+ description: "Get the payment method associated with a subscription",
47
+ inputSchema: {
48
+ type: "object",
49
+ properties: {
50
+ id: {
51
+ type: "string",
52
+ description: "The subscription ID (UUID)",
53
+ },
54
+ },
55
+ required: ["id"],
56
+ },
57
+ },
58
+ {
59
+ name: "cheddar_subscription_delete_promotion",
60
+ description: "Remove a promotional discount from a customer's subscription",
61
+ inputSchema: {
62
+ type: "object",
63
+ properties: {
64
+ customerId: {
65
+ type: "string",
66
+ description: "The customer ID or code whose subscription promotion should be removed",
67
+ },
68
+ },
69
+ required: ["customerId"],
70
+ },
71
+ },
72
+ {
73
+ name: "cheddar_plan_get",
74
+ description: "Retrieve a plan by its ID or code from Cheddar",
75
+ inputSchema: {
76
+ type: "object",
77
+ properties: {
78
+ id: {
79
+ type: "string",
80
+ description: "The plan ID (UUID) or plan code",
81
+ },
82
+ },
83
+ required: ["id"],
84
+ },
85
+ },
86
+ {
87
+ name: "cheddar_gateway_account_get",
88
+ description: "Retrieve a gateway account by its ID from Cheddar",
89
+ inputSchema: {
90
+ type: "object",
91
+ properties: {
92
+ id: {
93
+ type: "string",
94
+ description: "The gateway account ID (UUID)",
95
+ },
96
+ },
97
+ required: ["id"],
98
+ },
99
+ },
100
+ ];
101
+ export async function handleSubscriptionTool(client, name, args) {
102
+ switch (name) {
103
+ case "cheddar_subscription_get": {
104
+ const { id } = args;
105
+ const subscription = await client.getSubscription(id);
106
+ return {
107
+ content: [
108
+ {
109
+ type: "text",
110
+ text: JSON.stringify(subscription, null, 2),
111
+ },
112
+ ],
113
+ };
114
+ }
115
+ case "cheddar_subscription_get_customer": {
116
+ const { id } = args;
117
+ const customer = await client.getSubscriptionCustomer(id);
118
+ return {
119
+ content: [
120
+ {
121
+ type: "text",
122
+ text: JSON.stringify(customer, null, 2),
123
+ },
124
+ ],
125
+ };
126
+ }
127
+ case "cheddar_subscription_get_plan": {
128
+ const { id } = args;
129
+ const plan = await client.getSubscriptionPlan(id);
130
+ return {
131
+ content: [
132
+ {
133
+ type: "text",
134
+ text: JSON.stringify(plan, null, 2),
135
+ },
136
+ ],
137
+ };
138
+ }
139
+ case "cheddar_subscription_get_payment_method": {
140
+ const { id } = args;
141
+ const paymentMethod = await client.getSubscriptionPaymentMethod(id);
142
+ return {
143
+ content: [
144
+ {
145
+ type: "text",
146
+ text: JSON.stringify(paymentMethod, null, 2),
147
+ },
148
+ ],
149
+ };
150
+ }
151
+ case "cheddar_subscription_delete_promotion": {
152
+ const { customerId } = args;
153
+ await client.deleteSubscriptionPromotion(customerId);
154
+ return {
155
+ content: [
156
+ {
157
+ type: "text",
158
+ text: `Promotion removed from customer's subscription successfully.`,
159
+ },
160
+ ],
161
+ };
162
+ }
163
+ case "cheddar_plan_get": {
164
+ const { id } = args;
165
+ const plan = await client.getPlan(id);
166
+ return {
167
+ content: [
168
+ {
169
+ type: "text",
170
+ text: JSON.stringify(plan, null, 2),
171
+ },
172
+ ],
173
+ };
174
+ }
175
+ case "cheddar_gateway_account_get": {
176
+ const { id } = args;
177
+ const gatewayAccount = await client.getGatewayAccount(id);
178
+ return {
179
+ content: [
180
+ {
181
+ type: "text",
182
+ text: JSON.stringify(gatewayAccount, null, 2),
183
+ },
184
+ ],
185
+ };
186
+ }
187
+ default:
188
+ throw new Error(`Unknown subscription tool: ${name}`);
189
+ }
190
+ }
191
+ //# sourceMappingURL=subscriptions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptions.js","sourceRoot":"","sources":["../../src/tools/subscriptions.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,iBAAiB,GAAW;IACvC;QACE,IAAI,EAAE,0BAA0B;QAChC,WAAW,EAAE,gDAAgD;QAC7D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,4BAA4B;iBAC1C;aACF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF;IACD;QACE,IAAI,EAAE,mCAAmC;QACzC,WAAW,EAAE,iDAAiD;QAC9D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EAAE;oBACF,IAAI,EAAE,QAAQ;oBACd,WAAW,EAAE,4BAA4B;iBAC1C;aACF;YACD,QAAQ,EAAE,CAAC,IAAI,CAAC;SACjB;KACF;IACD;QACE,IAAI,EAAE,+BAA+B;QACrC,WAAW,EAAE,6CAA6C;QAC1D,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,UAAU,EAAE;gBACV,EAAE,EA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4
+ "description": "Model Context Protocol server for Cheddar Payment Platform integration",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "type": "module",
9
+ "bin": {
10
+ "cheddar-mcp": "./dist/index.js"
11
+ },
12
+ "main": "./dist/index.js",
13
+ "types": "./dist/index.d.ts",
14
+ "files": [
15
+ "dist/**/*",
16
+ "README.md",
17
+ "LICENSE"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc",
21
+ "clean": "rm -rf dist",
22
+ "dev": "tsc --watch",
23
+ "start": "node dist/index.js",
24
+ "test": "vitest",
25
+ "lint": "eslint src/**/*.ts",
26
+ "format": "prettier --write src/**/*.ts",
27
+ "prepublishOnly": "npm run clean && npm run build"
28
+ },
29
+ "keywords": [
30
+ "mcp",
31
+ "model-context-protocol",
32
+ "payments",
33
+ "subscription",
34
+ "billing",
35
+ "cheddar",
36
+ "ai",
37
+ "claude",
38
+ "cursor"
39
+ ],
40
+ "author": "Cheddar (chdr)",
41
+ "license": "MIT",
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.0.0",
44
+ "zod": "^3.22.4",
45
+ "dotenv": "^16.3.1"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^20.10.0",
49
+ "typescript": "^5.3.0",
50
+ "vitest": "^1.0.0",
51
+ "eslint": "^8.55.0",
52
+ "prettier": "^3.1.0"
53
+ },
54
+ "engines": {
55
+ "node": ">=18.0.0"
56
+ }
57
+ }