ggcheckout-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.
- package/LICENSE +21 -0
- package/README.md +633 -0
- package/dist/api/client.d.ts +35 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +270 -0
- package/dist/api/client.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/checkouts.d.ts +4 -0
- package/dist/tools/checkouts.d.ts.map +1 -0
- package/dist/tools/checkouts.js +180 -0
- package/dist/tools/checkouts.js.map +1 -0
- package/dist/tools/payments.d.ts +4 -0
- package/dist/tools/payments.d.ts.map +1 -0
- package/dist/tools/payments.js +126 -0
- package/dist/tools/payments.js.map +1 -0
- package/dist/tools/products.d.ts +4 -0
- package/dist/tools/products.d.ts.map +1 -0
- package/dist/tools/products.js +154 -0
- package/dist/tools/products.js.map +1 -0
- package/dist/tools/types.d.ts +148 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +2 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/tools/webhooks.d.ts +4 -0
- package/dist/tools/webhooks.d.ts.map +1 -0
- package/dist/tools/webhooks.js +153 -0
- package/dist/tools/webhooks.js.map +1 -0
- package/dist/utils/logger.d.ts +4 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +13 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/validation.d.ts +11 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +54 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 GG Checkout
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,633 @@
|
|
|
1
|
+
# GG Checkout MCP Server
|
|
2
|
+
|
|
3
|
+
> Model Context Protocol server for managing GG Checkout products via AI agents
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The GG Checkout MCP server enables AI agents (like Claude Desktop) to interact with your GG Checkout products directly. Create, read, update, and delete products using natural language through your favorite AI assistant.
|
|
8
|
+
|
|
9
|
+
## Prerequisites
|
|
10
|
+
|
|
11
|
+
- Node.js >= 18.0.0
|
|
12
|
+
- A GG Checkout account
|
|
13
|
+
- An active API Key from GG Checkout
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
### Option 1: NPX (Recommended)
|
|
18
|
+
|
|
19
|
+
No installation required! Just configure your MCP client with:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx @ggcheckout/mcp
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Option 2: Global Install
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm install -g @ggcheckout/mcp
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Getting Your API Key
|
|
32
|
+
|
|
33
|
+
1. Visit [https://www.ggcheckout.com/](https://www.ggcheckout.com/)
|
|
34
|
+
2. Log in to your GG Checkout dashboard
|
|
35
|
+
3. Navigate to **Settings** → **API Key**
|
|
36
|
+
4. Click **Generate API Key**
|
|
37
|
+
5. **Important:** Copy and save your API key immediately - it won't be shown again!
|
|
38
|
+
|
|
39
|
+
Your API key will look like: `ggck_live_abc123...`
|
|
40
|
+
|
|
41
|
+
## Configuration
|
|
42
|
+
|
|
43
|
+
### For Claude Desktop
|
|
44
|
+
|
|
45
|
+
Add to your Claude Desktop configuration file:
|
|
46
|
+
|
|
47
|
+
**macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
48
|
+
**Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"ggcheckout": {
|
|
54
|
+
"command": "npx",
|
|
55
|
+
"args": ["@ggcheckout/mcp"],
|
|
56
|
+
"env": {
|
|
57
|
+
"GGCHECKOUT_API_KEY": "ggck_live_your_api_key_here"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
> **Note:** The API URL is hardcoded to `https://www.ggcheckout.com/` for production use.
|
|
65
|
+
|
|
66
|
+
### For Other MCP Clients
|
|
67
|
+
|
|
68
|
+
Set the API key environment variable:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
export GGCHECKOUT_API_KEY="ggck_live_your_api_key_here"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Available Tools
|
|
75
|
+
|
|
76
|
+
### Product Tools
|
|
77
|
+
|
|
78
|
+
#### 1. `list_products`
|
|
79
|
+
|
|
80
|
+
List all your products/deliveries.
|
|
81
|
+
|
|
82
|
+
**Example prompt:** "Show me all my products"
|
|
83
|
+
|
|
84
|
+
**Response:**
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"products": [
|
|
88
|
+
{
|
|
89
|
+
"uid": "abc123",
|
|
90
|
+
"title": "React Course",
|
|
91
|
+
"url": "https://example.com/react-course",
|
|
92
|
+
"description": "Complete React course",
|
|
93
|
+
"discount": "30%",
|
|
94
|
+
"price": 9900
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
#### 2. `get_product`
|
|
101
|
+
|
|
102
|
+
Get details of a specific product.
|
|
103
|
+
|
|
104
|
+
**Parameters:**
|
|
105
|
+
- `productId` (string): Product ID
|
|
106
|
+
|
|
107
|
+
**Example prompt:** "Get details of product abc123"
|
|
108
|
+
|
|
109
|
+
#### 3. `create_product`
|
|
110
|
+
|
|
111
|
+
Create a new product/delivery.
|
|
112
|
+
|
|
113
|
+
**Parameters:**
|
|
114
|
+
- `title` (string): Product title
|
|
115
|
+
- `url` (string): Product URL
|
|
116
|
+
- `imageUrl` (string, optional): Product image URL
|
|
117
|
+
- `description` (string): Product description
|
|
118
|
+
- `discount` (string): Discount info (e.g., "30%")
|
|
119
|
+
- `price` (number|string): Price in cents (1990) or Brazilian format ("19,90")
|
|
120
|
+
|
|
121
|
+
**Example prompts:**
|
|
122
|
+
- "Create a product called 'React Course' priced at R$99.00"
|
|
123
|
+
- "Add a new product: title 'Node.js Guide', price 4990 cents, url https://example.com"
|
|
124
|
+
|
|
125
|
+
**Example:**
|
|
126
|
+
```json
|
|
127
|
+
{
|
|
128
|
+
"title": "React Course",
|
|
129
|
+
"url": "https://example.com/react-course",
|
|
130
|
+
"imageUrl": "https://example.com/cover.png",
|
|
131
|
+
"description": "Lifetime access",
|
|
132
|
+
"discount": "30%",
|
|
133
|
+
"price": 9900
|
|
134
|
+
}
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
#### 4. `update_product`
|
|
138
|
+
|
|
139
|
+
Update an existing product. Only provide fields you want to change.
|
|
140
|
+
|
|
141
|
+
**Parameters:**
|
|
142
|
+
- `productId` (string): Product ID
|
|
143
|
+
- `title` (string, optional): New title
|
|
144
|
+
- `url` (string, optional): New URL
|
|
145
|
+
- `imageUrl` (string, optional): New image URL
|
|
146
|
+
- `description` (string, optional): New description
|
|
147
|
+
- `discount` (string, optional): New discount
|
|
148
|
+
- `price` (number|string, optional): New price
|
|
149
|
+
|
|
150
|
+
**Example prompt:** "Update product abc123 price to R$79.90"
|
|
151
|
+
|
|
152
|
+
#### 5. `delete_product`
|
|
153
|
+
|
|
154
|
+
Delete a product by ID.
|
|
155
|
+
|
|
156
|
+
**Parameters:**
|
|
157
|
+
- `productId` (string): Product ID
|
|
158
|
+
|
|
159
|
+
**Example prompt:** "Delete product abc123"
|
|
160
|
+
|
|
161
|
+
### User Tools
|
|
162
|
+
|
|
163
|
+
#### 6. `get_my_business_id`
|
|
164
|
+
|
|
165
|
+
Get the business ID of the authenticated user. This tool automatically retrieves your businessId from the API key authentication, making it easy to use other tools without manually specifying the businessId.
|
|
166
|
+
|
|
167
|
+
**Parameters:** None
|
|
168
|
+
|
|
169
|
+
**Example prompt:** "What is my business ID?"
|
|
170
|
+
|
|
171
|
+
**Response:**
|
|
172
|
+
```json
|
|
173
|
+
{
|
|
174
|
+
"businessId": "CKdAlYZpHhSKrFnA6ljGewe16Go1"
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Pro Tip:** Once you have your businessId, you can use it in natural language queries like:
|
|
179
|
+
- "Show me all payments for business CKdAlYZpHhSKrFnA6ljGewe16Go1"
|
|
180
|
+
- Or simply: "Get my business ID, then show me all payments"
|
|
181
|
+
|
|
182
|
+
### Payment Tools
|
|
183
|
+
|
|
184
|
+
#### 7. `list_payments`
|
|
185
|
+
|
|
186
|
+
List all payments for a specific business.
|
|
187
|
+
|
|
188
|
+
**Parameters:**
|
|
189
|
+
- `businessId` (string): Business ID to list payments for
|
|
190
|
+
|
|
191
|
+
**Example prompt:** "Show me all payments for business xyz789"
|
|
192
|
+
|
|
193
|
+
**Response:**
|
|
194
|
+
```json
|
|
195
|
+
{
|
|
196
|
+
"payments": [
|
|
197
|
+
{
|
|
198
|
+
"id": "txn_123456",
|
|
199
|
+
"businessId": "xyz789",
|
|
200
|
+
"email": "customer@example.com",
|
|
201
|
+
"value": 99.90,
|
|
202
|
+
"productId": "prod_abc",
|
|
203
|
+
"titleOffer": "React Course",
|
|
204
|
+
"status": "paid",
|
|
205
|
+
"createdAt": "2024-01-15T10:30:00Z"
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
#### 8. `get_payments_paginated`
|
|
212
|
+
|
|
213
|
+
Get paginated payments with advanced filtering options.
|
|
214
|
+
|
|
215
|
+
**Important:** Status filtering is done **client-side** after fetching data from the API. This follows the same pattern as the frontend application to avoid requiring Firestore composite indexes.
|
|
216
|
+
|
|
217
|
+
**Parameters:**
|
|
218
|
+
- `businessId` (string): Business ID
|
|
219
|
+
- `pageSize` (number, optional): Items per page (default: 10)
|
|
220
|
+
- `dateFrom` (string, optional): Filter from date (ISO format)
|
|
221
|
+
- `dateTo` (string, optional): Filter until date (ISO format)
|
|
222
|
+
- `lastCreatedAt` (string, optional): Pagination cursor
|
|
223
|
+
- `status` (string, optional): Filter by status ("pending", "paid", "error", "all") - **filtered client-side**
|
|
224
|
+
- `searchTerm` (string, optional): Search by payment ID, email, phone, or title
|
|
225
|
+
- `countOnly` (boolean, optional): Return only total count
|
|
226
|
+
|
|
227
|
+
**Example prompts:**
|
|
228
|
+
- "Get the first 20 payments for business xyz789"
|
|
229
|
+
- "Show me all paid payments from last month for business xyz789"
|
|
230
|
+
- "Search for payments with email john@example.com in business xyz789"
|
|
231
|
+
- "How many pending payments does business xyz789 have?"
|
|
232
|
+
|
|
233
|
+
**Response:**
|
|
234
|
+
```json
|
|
235
|
+
{
|
|
236
|
+
"payments": [...],
|
|
237
|
+
"total": 150,
|
|
238
|
+
"lastCreatedAt": "2024-01-15T10:30:00Z"
|
|
239
|
+
}
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
#### 9. `get_payment`
|
|
243
|
+
|
|
244
|
+
Get details of a specific payment by ID.
|
|
245
|
+
|
|
246
|
+
**Note:** This tool fetches all payments from the business and filters client-side to find the specific payment. This approach avoids Firestore composite index requirements that would be needed for direct search queries.
|
|
247
|
+
|
|
248
|
+
**Parameters:**
|
|
249
|
+
- `businessId` (string): Business ID
|
|
250
|
+
- `paymentId` (string): Payment ID (transaction ID)
|
|
251
|
+
|
|
252
|
+
**Example prompt:** "Get payment cmgjucuk201ztcgsya2w9bo53 from my business"
|
|
253
|
+
|
|
254
|
+
**Response:**
|
|
255
|
+
```json
|
|
256
|
+
{
|
|
257
|
+
"payment": {
|
|
258
|
+
"id": "txn_123456",
|
|
259
|
+
"businessId": "xyz789",
|
|
260
|
+
"name": "John Doe",
|
|
261
|
+
"email": "john@example.com",
|
|
262
|
+
"phone": "+5511999999999",
|
|
263
|
+
"cpf": "12345678900",
|
|
264
|
+
"value": 99.90,
|
|
265
|
+
"productId": "prod_abc",
|
|
266
|
+
"titleOffer": "React Course",
|
|
267
|
+
"status": "paid",
|
|
268
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
269
|
+
"finalValueInCents": 9990,
|
|
270
|
+
"couponsCodesApplied": ["SAVE20"]
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
### Checkout Tools
|
|
276
|
+
|
|
277
|
+
#### 10. `list_checkouts`
|
|
278
|
+
|
|
279
|
+
List all checkout pages for the authenticated user.
|
|
280
|
+
|
|
281
|
+
**Parameters:** None (automatically uses authenticated user)
|
|
282
|
+
|
|
283
|
+
**Example prompt:** "Show me all my checkouts" or "List my checkout pages"
|
|
284
|
+
|
|
285
|
+
**Response:**
|
|
286
|
+
```json
|
|
287
|
+
{
|
|
288
|
+
"checkouts": [
|
|
289
|
+
{
|
|
290
|
+
"uid": "checkout123",
|
|
291
|
+
"id": "my-product-checkout",
|
|
292
|
+
"title": "React Course Checkout",
|
|
293
|
+
"price": 99.90,
|
|
294
|
+
"published": true,
|
|
295
|
+
"url": "https://checkout.ggcheckout.com/my-product-checkout"
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
#### 11. `get_checkout`
|
|
302
|
+
|
|
303
|
+
Get details of a specific checkout page.
|
|
304
|
+
|
|
305
|
+
**Parameters:**
|
|
306
|
+
- `checkoutId` (string): Checkout document ID (uid) - **Note: Use the `uid` returned from `create_checkout`, not the custom `id` field**
|
|
307
|
+
|
|
308
|
+
**Example prompt:** "Get checkout details for checkout123"
|
|
309
|
+
|
|
310
|
+
**Important:**
|
|
311
|
+
- `uid` = Firestore document ID (use this for get/update/delete operations)
|
|
312
|
+
- `id` = Custom checkout slug/identifier (user-friendly name)
|
|
313
|
+
|
|
314
|
+
**Response:**
|
|
315
|
+
```json
|
|
316
|
+
{
|
|
317
|
+
"checkout": {
|
|
318
|
+
"uid": "checkout123",
|
|
319
|
+
"id": "my-product-checkout",
|
|
320
|
+
"title": "React Course Checkout",
|
|
321
|
+
"price": 99.90,
|
|
322
|
+
"published": true,
|
|
323
|
+
"paymentMethods": {...},
|
|
324
|
+
"checkout": {...},
|
|
325
|
+
"orderBumps": []
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
#### 12. `create_checkout`
|
|
331
|
+
|
|
332
|
+
Create a new checkout page.
|
|
333
|
+
|
|
334
|
+
**Required Parameters:**
|
|
335
|
+
- `title` (string): Checkout page title
|
|
336
|
+
- `id` (string): Unique checkout slug/identifier (user-friendly name, e.g., "my-product-checkout")
|
|
337
|
+
- `price` (number): Price in Brazilian Reais (e.g., 99.90)
|
|
338
|
+
- `paymentMethods` (object): Payment methods configuration
|
|
339
|
+
- `checkout` (object): Checkout page configuration
|
|
340
|
+
|
|
341
|
+
**Optional Parameters:**
|
|
342
|
+
- `url` (string): Checkout URL
|
|
343
|
+
- `bannerUrl` (string): Banner image URL
|
|
344
|
+
- `image` (string): Product image URL
|
|
345
|
+
- `sellerName` (string): Seller name
|
|
346
|
+
- `orderBumps` (array): Order bumps (upsells)
|
|
347
|
+
- `fields` (object): Custom form fields (`{haveName: boolean, havePhone: boolean, haveCpf: boolean}`)
|
|
348
|
+
- `socialCard` (array): Social card configuration
|
|
349
|
+
- `published` (boolean): Published status (default: true)
|
|
350
|
+
- `metricToken` (string): Metrics token
|
|
351
|
+
- `emailProviderToken` (string): Email provider token
|
|
352
|
+
|
|
353
|
+
**Example prompt:** "Create a checkout page for my React Course priced at R$99.90"
|
|
354
|
+
|
|
355
|
+
**Response:**
|
|
356
|
+
```json
|
|
357
|
+
{
|
|
358
|
+
"success": true,
|
|
359
|
+
"message": "Produto criado com sucesso.",
|
|
360
|
+
"checkout": {
|
|
361
|
+
"uid": "AbC123XyZ456",
|
|
362
|
+
"id": "my-product-checkout",
|
|
363
|
+
"title": "React Course Checkout",
|
|
364
|
+
"price": 99.90,
|
|
365
|
+
"fields": {
|
|
366
|
+
"haveName": false,
|
|
367
|
+
"havePhone": false,
|
|
368
|
+
"haveCpf": false
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
}
|
|
372
|
+
```
|
|
373
|
+
|
|
374
|
+
**Important:** Save the `uid` from the response - you'll need it for get/update/delete operations!
|
|
375
|
+
|
|
376
|
+
#### 13. `update_checkout`
|
|
377
|
+
|
|
378
|
+
Update an existing checkout page. Only provide fields you want to change.
|
|
379
|
+
|
|
380
|
+
**Parameters:**
|
|
381
|
+
- `checkoutId` (string): Checkout document ID (uid) - **Use the `uid` from create_checkout response**
|
|
382
|
+
- All other parameters are optional (same as create_checkout)
|
|
383
|
+
|
|
384
|
+
**Example prompt:** "Update checkout AbC123XyZ456 price to R$79.90"
|
|
385
|
+
|
|
386
|
+
**Response:**
|
|
387
|
+
```json
|
|
388
|
+
{
|
|
389
|
+
"success": true,
|
|
390
|
+
"checkout": {
|
|
391
|
+
"uid": "checkout123",
|
|
392
|
+
"price": 79.90
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
#### 14. `delete_checkout`
|
|
398
|
+
|
|
399
|
+
Delete a checkout page by ID.
|
|
400
|
+
|
|
401
|
+
**Parameters:**
|
|
402
|
+
- `checkoutId` (string): Checkout document ID (uid) - **Use the `uid` from create_checkout response**
|
|
403
|
+
|
|
404
|
+
**Example prompt:** "Delete checkout AbC123XyZ456"
|
|
405
|
+
|
|
406
|
+
**Response:**
|
|
407
|
+
```json
|
|
408
|
+
{
|
|
409
|
+
"success": true,
|
|
410
|
+
"message": "Checkout checkout123 deleted successfully"
|
|
411
|
+
}
|
|
412
|
+
```
|
|
413
|
+
|
|
414
|
+
### Webhook Tools
|
|
415
|
+
|
|
416
|
+
#### 15. `list_webhooks`
|
|
417
|
+
|
|
418
|
+
List all webhooks for the authenticated user.
|
|
419
|
+
|
|
420
|
+
**Parameters:** None (automatically uses authenticated user)
|
|
421
|
+
|
|
422
|
+
**Example prompt:** "Show me all my webhooks" or "List my webhooks"
|
|
423
|
+
|
|
424
|
+
**Response:**
|
|
425
|
+
```json
|
|
426
|
+
{
|
|
427
|
+
"webhooks": [
|
|
428
|
+
{
|
|
429
|
+
"id": "webhook_abc123",
|
|
430
|
+
"businessId": "xyz789",
|
|
431
|
+
"name": "Payment Notifications",
|
|
432
|
+
"url": "https://myapp.com/webhook",
|
|
433
|
+
"events": ["payment.paid", "payment.refunded"],
|
|
434
|
+
"secret": "whsec_...",
|
|
435
|
+
"productsId": [],
|
|
436
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
437
|
+
"updatedAt": "2024-01-15T10:30:00Z"
|
|
438
|
+
}
|
|
439
|
+
]
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
#### 16. `get_webhook`
|
|
444
|
+
|
|
445
|
+
Get details of a specific webhook by ID.
|
|
446
|
+
|
|
447
|
+
**Parameters:**
|
|
448
|
+
- `webhookId` (string): Webhook ID
|
|
449
|
+
|
|
450
|
+
**Example prompt:** "Get webhook details for webhook_abc123"
|
|
451
|
+
|
|
452
|
+
**Response:**
|
|
453
|
+
```json
|
|
454
|
+
{
|
|
455
|
+
"webhook": {
|
|
456
|
+
"id": "webhook_abc123",
|
|
457
|
+
"businessId": "xyz789",
|
|
458
|
+
"name": "Payment Notifications",
|
|
459
|
+
"url": "https://myapp.com/webhook",
|
|
460
|
+
"events": ["payment.paid"],
|
|
461
|
+
"secret": "whsec_...",
|
|
462
|
+
"productsId": ["prod_123"],
|
|
463
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
464
|
+
"updatedAt": "2024-01-15T10:30:00Z"
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
```
|
|
468
|
+
|
|
469
|
+
#### 17. `create_webhook`
|
|
470
|
+
|
|
471
|
+
Create a new webhook for payment notifications.
|
|
472
|
+
|
|
473
|
+
**Required Parameters:**
|
|
474
|
+
- `name` (string): Webhook name/description
|
|
475
|
+
- `url` (string): Webhook URL endpoint to receive notifications
|
|
476
|
+
- `events` (array): Events to trigger this webhook
|
|
477
|
+
|
|
478
|
+
**Optional Parameters:**
|
|
479
|
+
- `secret` (string): Secret key for webhook signature verification
|
|
480
|
+
- `productsId` (array): Product IDs to filter notifications (leave empty for all products)
|
|
481
|
+
|
|
482
|
+
**Available Events:**
|
|
483
|
+
- `payment.created` - New payment initiated
|
|
484
|
+
- `payment.paid` - Payment successfully completed
|
|
485
|
+
- `payment.pending` - Payment pending confirmation
|
|
486
|
+
- `payment.refunded` - Payment refunded
|
|
487
|
+
- `payment.failed` - Payment failed
|
|
488
|
+
|
|
489
|
+
**Example prompt:** "Create a webhook for payment notifications at https://myapp.com/webhook"
|
|
490
|
+
|
|
491
|
+
**Response:**
|
|
492
|
+
```json
|
|
493
|
+
{
|
|
494
|
+
"success": true,
|
|
495
|
+
"webhook": {
|
|
496
|
+
"id": "webhook_new123",
|
|
497
|
+
"businessId": "xyz789",
|
|
498
|
+
"name": "Payment Notifications",
|
|
499
|
+
"url": "https://myapp.com/webhook",
|
|
500
|
+
"events": ["payment.paid", "payment.refunded"],
|
|
501
|
+
"createdAt": "2024-01-15T10:30:00Z",
|
|
502
|
+
"updatedAt": "2024-01-15T10:30:00Z"
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
#### 18. `update_webhook`
|
|
508
|
+
|
|
509
|
+
Update an existing webhook. Only provide fields you want to update.
|
|
510
|
+
|
|
511
|
+
**Parameters:**
|
|
512
|
+
- `webhookId` (string): Webhook ID
|
|
513
|
+
- `name` (string, optional): New webhook name
|
|
514
|
+
- `url` (string, optional): New webhook URL
|
|
515
|
+
- `events` (array, optional): New events list
|
|
516
|
+
- `secret` (string, optional): New secret key
|
|
517
|
+
- `productsId` (array, optional): New product IDs filter
|
|
518
|
+
|
|
519
|
+
**Example prompt:** "Update webhook webhook_abc123 to listen for payment.created events"
|
|
520
|
+
|
|
521
|
+
**Response:**
|
|
522
|
+
```json
|
|
523
|
+
{
|
|
524
|
+
"success": true,
|
|
525
|
+
"webhook": {
|
|
526
|
+
"id": "webhook_abc123",
|
|
527
|
+
"events": ["payment.created", "payment.paid"],
|
|
528
|
+
"updatedAt": "2024-01-15T11:00:00Z"
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
#### 19. `delete_webhook`
|
|
534
|
+
|
|
535
|
+
Delete a webhook by ID.
|
|
536
|
+
|
|
537
|
+
**Parameters:**
|
|
538
|
+
- `webhookId` (string): Webhook ID
|
|
539
|
+
|
|
540
|
+
**Example prompt:** "Delete webhook webhook_abc123"
|
|
541
|
+
|
|
542
|
+
**Response:**
|
|
543
|
+
```json
|
|
544
|
+
{
|
|
545
|
+
"success": true,
|
|
546
|
+
"message": "Webhook webhook_abc123 deleted successfully"
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
## Price Formats
|
|
551
|
+
|
|
552
|
+
The server accepts prices in two formats:
|
|
553
|
+
|
|
554
|
+
1. **Cents (recommended):** `1990` = R$19.90
|
|
555
|
+
2. **Brazilian format:** `"19,90"` or `"1.990,00"`
|
|
556
|
+
|
|
557
|
+
Internally, all prices are stored in cents.
|
|
558
|
+
|
|
559
|
+
## Troubleshooting
|
|
560
|
+
|
|
561
|
+
### Error: 401 Unauthorized
|
|
562
|
+
|
|
563
|
+
- Check that your API key is correct
|
|
564
|
+
- Ensure the key starts with `ggck_live_`
|
|
565
|
+
- Verify the key hasn't been revoked in your dashboard
|
|
566
|
+
|
|
567
|
+
### Error: 403 Forbidden
|
|
568
|
+
|
|
569
|
+
- You're trying to access a resource that doesn't belong to you
|
|
570
|
+
- API keys are scoped to the user who created them
|
|
571
|
+
|
|
572
|
+
### Error: 404 Not Found
|
|
573
|
+
|
|
574
|
+
- The product ID doesn't exist
|
|
575
|
+
- Check the product ID is correct
|
|
576
|
+
|
|
577
|
+
### Error: Invalid price format
|
|
578
|
+
|
|
579
|
+
- Use cents (number) or Brazilian format (string)
|
|
580
|
+
- Examples: `1990` or `"19,90"`
|
|
581
|
+
|
|
582
|
+
### Rate Limiting
|
|
583
|
+
|
|
584
|
+
If you're making too many requests, you may be rate limited. Wait a few moments and try again.
|
|
585
|
+
|
|
586
|
+
## Local Development
|
|
587
|
+
|
|
588
|
+
For local development and testing against your localhost backend:
|
|
589
|
+
|
|
590
|
+
1. Clone the repository
|
|
591
|
+
2. Copy `.env.local` to `.env`
|
|
592
|
+
3. Edit `src/index.ts` and uncomment the localhost line:
|
|
593
|
+
|
|
594
|
+
```typescript
|
|
595
|
+
// Change this:
|
|
596
|
+
const API_URL = 'https://www.ggcheckout.com';
|
|
597
|
+
|
|
598
|
+
// To this:
|
|
599
|
+
const API_URL = process.env.GGCHECKOUT_API_URL || 'http://localhost:3000';
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
4. Set your `.env` file:
|
|
603
|
+
```bash
|
|
604
|
+
GGCHECKOUT_API_KEY=ggck_live_your_api_key_here
|
|
605
|
+
GGCHECKOUT_API_URL=http://localhost:3000
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
5. Build and run:
|
|
609
|
+
```bash
|
|
610
|
+
npm install
|
|
611
|
+
npm run build
|
|
612
|
+
node dist/index.js
|
|
613
|
+
```
|
|
614
|
+
|
|
615
|
+
## Security Best Practices
|
|
616
|
+
|
|
617
|
+
🔒 **Never share your API key publicly**
|
|
618
|
+
|
|
619
|
+
✅ Always use environment variables
|
|
620
|
+
✅ Revoke compromised keys immediately
|
|
621
|
+
✅ Generate new keys periodically
|
|
622
|
+
❌ Don't hardcode keys in your code
|
|
623
|
+
❌ Don't commit keys to version control
|
|
624
|
+
|
|
625
|
+
## Support
|
|
626
|
+
|
|
627
|
+
- 📧 Email: support@ggcheckout.com
|
|
628
|
+
- 📖 Docs: https://docs.ggcheckout.com
|
|
629
|
+
- 🐛 Issues: https://github.com/ggcheckout/mcp/issues
|
|
630
|
+
|
|
631
|
+
## License
|
|
632
|
+
|
|
633
|
+
MIT © GG Checkout Team
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ProductDelivery, PaymentsPaginatedResponse, Payment, Checkout, CreateCheckoutInput, UpdateCheckoutInput, Webhook, CreateWebhookInput, UpdateWebhookInput } from '../tools/types.js';
|
|
2
|
+
export declare class ApiClient {
|
|
3
|
+
private client;
|
|
4
|
+
constructor(apiUrl: string, apiKey: string);
|
|
5
|
+
listProducts(): Promise<ProductDelivery[]>;
|
|
6
|
+
getProduct(id: string): Promise<ProductDelivery>;
|
|
7
|
+
createProduct(payload: any): Promise<ProductDelivery>;
|
|
8
|
+
updateProduct(id: string, payload: any): Promise<ProductDelivery>;
|
|
9
|
+
deleteProduct(id: string): Promise<void>;
|
|
10
|
+
listPayments(businessId: string): Promise<Payment[]>;
|
|
11
|
+
getPaymentsPaginated(businessId: string, options?: {
|
|
12
|
+
pageSize?: number;
|
|
13
|
+
dateFrom?: string;
|
|
14
|
+
dateTo?: string;
|
|
15
|
+
lastCreatedAt?: string;
|
|
16
|
+
status?: string;
|
|
17
|
+
searchTerm?: string;
|
|
18
|
+
countOnly?: boolean;
|
|
19
|
+
}): Promise<PaymentsPaginatedResponse | {
|
|
20
|
+
total: number;
|
|
21
|
+
}>;
|
|
22
|
+
getPayment(businessId: string, paymentId: string): Promise<Payment>;
|
|
23
|
+
getMyBusinessId(): Promise<string>;
|
|
24
|
+
listCheckouts(uuidOwnwer: string): Promise<Checkout[]>;
|
|
25
|
+
getCheckout(id: string): Promise<Checkout>;
|
|
26
|
+
createCheckout(payload: CreateCheckoutInput): Promise<Checkout>;
|
|
27
|
+
updateCheckout(id: string, payload: UpdateCheckoutInput): Promise<Checkout>;
|
|
28
|
+
deleteCheckout(id: string): Promise<void>;
|
|
29
|
+
listWebhooks(): Promise<Webhook[]>;
|
|
30
|
+
getWebhook(id: string): Promise<Webhook>;
|
|
31
|
+
createWebhook(payload: CreateWebhookInput): Promise<Webhook>;
|
|
32
|
+
updateWebhook(id: string, payload: UpdateWebhookInput): Promise<Webhook>;
|
|
33
|
+
deleteWebhook(id: string): Promise<void>;
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,eAAe,EAAwB,yBAAyB,EAAE,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;AAEzO,qBAAa,SAAS;IACpB,OAAO,CAAC,MAAM,CAAgB;gBAElB,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;IAyBpC,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAU1C,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAUhD,aAAa,CAAC,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;IAUrD,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,GAAG,OAAO,CAAC,eAAe,CAAC;IAajE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IASxC,YAAY,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC;IAUpD,oBAAoB,CACxB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE;QACR,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,OAAO,CAAC;KACrB,GACA,OAAO,CAAC,yBAAyB,GAAG;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC;IAwBnD,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAwBnE,eAAe,IAAI,OAAO,CAAC,MAAM,CAAC;IAUlC,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAUtD,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;IAU1C,cAAc,CAAC,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAW/D,cAAc,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,mBAAmB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAyB3E,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAczC,YAAY,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;IAUlC,UAAU,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAexC,aAAa,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAc5D,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUxE,aAAa,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAQ/C"}
|