brinkcommerce-dev-mcp 0.1.0-beta.1 → 0.1.0-beta.2
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 +8 -4
- package/dist/tools/order-extended-tools.d.ts +33 -0
- package/dist/tools/order-extended-tools.js +56 -2
- package/package.json +1 -1
- package/CLAUDE.md +0 -105
package/README.md
CHANGED
|
@@ -29,7 +29,7 @@ The MCP protocol has no mechanism to force user confirmation - all safety measur
|
|
|
29
29
|
### Read-Only Mode
|
|
30
30
|
|
|
31
31
|
To use this MCP server in read-only mode for API documentation exploration only:
|
|
32
|
-
- Simply don't configure the `BRINK_CLIENT_ID` and `
|
|
32
|
+
- Simply don't configure the `BRINK_CLIENT_ID`, `BRINK_CLIENT_SECRET`, and `BRINK_API_KEY` environment variables
|
|
33
33
|
- All write operations will fail with authentication errors
|
|
34
34
|
- Documentation tools (`list_apis`, `search_schemas`, etc.) will work normally
|
|
35
35
|
|
|
@@ -147,7 +147,9 @@ If you have connection issues on Windows, use this alternative configuration:
|
|
|
147
147
|
|
|
148
148
|
## Configure API Access (Optional)
|
|
149
149
|
|
|
150
|
-
The server works out of the box for **API documentation** queries. To use **management tools** (create products, update inventory, etc.), add your BrinkCommerce credentials
|
|
150
|
+
The server works out of the box for **API documentation** queries. To use **management tools** (create products, update inventory, etc.), add your BrinkCommerce credentials.
|
|
151
|
+
|
|
152
|
+
The Management API requires **both** an OAuth2 client (for the bearer token) **and** a Management API key (sent as `x-api-key`). All four variables below are required for management tools:
|
|
151
153
|
|
|
152
154
|
### Claude Desktop
|
|
153
155
|
|
|
@@ -160,7 +162,8 @@ The server works out of the box for **API documentation** queries. To use **mana
|
|
|
160
162
|
"env": {
|
|
161
163
|
"BRINK_CLIENT_ID": "your-client-id",
|
|
162
164
|
"BRINK_CLIENT_SECRET": "your-client-secret",
|
|
163
|
-
"BRINK_CUSTOMER_NAME": "your-customer-name"
|
|
165
|
+
"BRINK_CUSTOMER_NAME": "your-customer-name",
|
|
166
|
+
"BRINK_API_KEY": "your-management-api-key"
|
|
164
167
|
}
|
|
165
168
|
}
|
|
166
169
|
}
|
|
@@ -174,6 +177,7 @@ claude mcp add brinkcommerce \
|
|
|
174
177
|
-e BRINK_CLIENT_ID=your-client-id \
|
|
175
178
|
-e BRINK_CLIENT_SECRET=your-client-secret \
|
|
176
179
|
-e BRINK_CUSTOMER_NAME=your-customer-name \
|
|
180
|
+
-e BRINK_API_KEY=your-management-api-key \
|
|
177
181
|
-- npx -y brinkcommerce-dev-mcp@beta
|
|
178
182
|
```
|
|
179
183
|
|
|
@@ -452,7 +456,7 @@ make help
|
|
|
452
456
|
| `BRINK_CLIENT_SECRET` | OAuth2 client secret for BrinkCommerce API | - | For management tools |
|
|
453
457
|
| `BRINK_CUSTOMER_NAME` | Your BrinkCommerce customer name | - | For management tools |
|
|
454
458
|
| `BRINK_REGION` | BrinkCommerce region (eu-west-1, us-east-1) | `eu-west-1` | Optional |
|
|
455
|
-
| `BRINK_API_KEY` | API key
|
|
459
|
+
| `BRINK_API_KEY` | Management API key (sent as `x-api-key` alongside the OAuth bearer token) | - | For management tools |
|
|
456
460
|
| `BRINKCOMMERCE_CACHE_DIR` | Cache directory location | Platform-specific | Optional |
|
|
457
461
|
| `SPECS_FORCE_REFRESH` | Force refresh all specs on startup | `false` | Optional |
|
|
458
462
|
| `LOG_LEVEL` | Logging verbosity (debug/info/warn/error) | `info` | Optional |
|
|
@@ -7,6 +7,9 @@ interface ExtendedToolParams {
|
|
|
7
7
|
from?: string;
|
|
8
8
|
to?: string;
|
|
9
9
|
compensationId?: string;
|
|
10
|
+
paymentAction?: "AUTO" | "MANUAL" | "SKIP";
|
|
11
|
+
giftCardAction?: "AUTO" | "MANUAL" | "SKIP";
|
|
12
|
+
bonusAction?: "AUTO" | "MANUAL" | "SKIP";
|
|
10
13
|
modificationId?: string;
|
|
11
14
|
stateId?: string;
|
|
12
15
|
code?: string;
|
|
@@ -358,6 +361,21 @@ export declare const compensationTools: {
|
|
|
358
361
|
type: string;
|
|
359
362
|
description: string;
|
|
360
363
|
};
|
|
364
|
+
paymentAction: {
|
|
365
|
+
type: string;
|
|
366
|
+
enum: string[];
|
|
367
|
+
description: string;
|
|
368
|
+
};
|
|
369
|
+
giftCardAction: {
|
|
370
|
+
type: string;
|
|
371
|
+
enum: string[];
|
|
372
|
+
description: string;
|
|
373
|
+
};
|
|
374
|
+
bonusAction: {
|
|
375
|
+
type: string;
|
|
376
|
+
enum: string[];
|
|
377
|
+
description: string;
|
|
378
|
+
};
|
|
361
379
|
};
|
|
362
380
|
required: string[];
|
|
363
381
|
};
|
|
@@ -378,6 +396,21 @@ export declare const compensationTools: {
|
|
|
378
396
|
type: string;
|
|
379
397
|
description: string;
|
|
380
398
|
};
|
|
399
|
+
paymentAction: {
|
|
400
|
+
type: string;
|
|
401
|
+
enum: string[];
|
|
402
|
+
description: string;
|
|
403
|
+
};
|
|
404
|
+
giftCardAction: {
|
|
405
|
+
type: string;
|
|
406
|
+
enum: string[];
|
|
407
|
+
description: string;
|
|
408
|
+
};
|
|
409
|
+
bonusAction: {
|
|
410
|
+
type: string;
|
|
411
|
+
enum: string[];
|
|
412
|
+
description: string;
|
|
413
|
+
};
|
|
381
414
|
};
|
|
382
415
|
required: string[];
|
|
383
416
|
};
|
|
@@ -20,6 +20,26 @@ const destructiveAnnotations = {
|
|
|
20
20
|
destructiveHint: true,
|
|
21
21
|
openWorldHint: true,
|
|
22
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* Build a StartCompensationRequest from tool parameters.
|
|
25
|
+
* Always returns an object (at minimum empty) to ensure the request body is not undefined.
|
|
26
|
+
*/
|
|
27
|
+
function buildStartCompensationRequest(params) {
|
|
28
|
+
const request = {};
|
|
29
|
+
// Add payment action if specified
|
|
30
|
+
if (params.paymentAction) {
|
|
31
|
+
request.payment = { actionType: params.paymentAction };
|
|
32
|
+
}
|
|
33
|
+
// Add gift card action if specified
|
|
34
|
+
if (params.giftCardAction) {
|
|
35
|
+
request.giftCard = { actionType: params.giftCardAction };
|
|
36
|
+
}
|
|
37
|
+
// Add bonus action if specified
|
|
38
|
+
if (params.bonusAction) {
|
|
39
|
+
request.bonus = { actionType: params.bonusAction };
|
|
40
|
+
}
|
|
41
|
+
return request;
|
|
42
|
+
}
|
|
23
43
|
// ==================== TOOL DEFINITIONS ====================
|
|
24
44
|
/**
|
|
25
45
|
* Order Query Tool Definitions
|
|
@@ -296,6 +316,21 @@ export const compensationTools = {
|
|
|
296
316
|
type: "string",
|
|
297
317
|
description: "The compensation ID (UUID format)",
|
|
298
318
|
},
|
|
319
|
+
paymentAction: {
|
|
320
|
+
type: "string",
|
|
321
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
322
|
+
description: "How to handle payment action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
323
|
+
},
|
|
324
|
+
giftCardAction: {
|
|
325
|
+
type: "string",
|
|
326
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
327
|
+
description: "How to handle gift card action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
328
|
+
},
|
|
329
|
+
bonusAction: {
|
|
330
|
+
type: "string",
|
|
331
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
332
|
+
description: "How to handle bonus action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
333
|
+
},
|
|
299
334
|
},
|
|
300
335
|
required: ["compensationId"],
|
|
301
336
|
},
|
|
@@ -311,6 +346,21 @@ export const compensationTools = {
|
|
|
311
346
|
type: "string",
|
|
312
347
|
description: "The compensation ID (UUID format)",
|
|
313
348
|
},
|
|
349
|
+
paymentAction: {
|
|
350
|
+
type: "string",
|
|
351
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
352
|
+
description: "How to handle payment action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
353
|
+
},
|
|
354
|
+
giftCardAction: {
|
|
355
|
+
type: "string",
|
|
356
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
357
|
+
description: "How to handle gift card action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
358
|
+
},
|
|
359
|
+
bonusAction: {
|
|
360
|
+
type: "string",
|
|
361
|
+
enum: ["AUTO", "MANUAL", "SKIP"],
|
|
362
|
+
description: "How to handle bonus action. AUTO (default): automatically process, MANUAL: mark as manually handled, SKIP: skip this action",
|
|
363
|
+
},
|
|
314
364
|
},
|
|
315
365
|
required: ["compensationId"],
|
|
316
366
|
},
|
|
@@ -1205,8 +1255,10 @@ export async function handleStartCompensation(params) {
|
|
|
1205
1255
|
if (!params.compensationId) {
|
|
1206
1256
|
return { content: [{ type: "text", text: "Error: Missing required field 'compensationId'" }], isError: true };
|
|
1207
1257
|
}
|
|
1258
|
+
// Build request object with action options
|
|
1259
|
+
const request = buildStartCompensationRequest(params);
|
|
1208
1260
|
const client = createOrderManagementClient();
|
|
1209
|
-
const result = await client.startCompensation(params.compensationId);
|
|
1261
|
+
const result = await client.startCompensation(params.compensationId, request);
|
|
1210
1262
|
if (result.success) {
|
|
1211
1263
|
return { content: [{ type: "text", text: `Successfully started compensation: ${params.compensationId}` }] };
|
|
1212
1264
|
}
|
|
@@ -1221,8 +1273,10 @@ export async function handleRestartCompensation(params) {
|
|
|
1221
1273
|
if (!params.compensationId) {
|
|
1222
1274
|
return { content: [{ type: "text", text: "Error: Missing required field 'compensationId'" }], isError: true };
|
|
1223
1275
|
}
|
|
1276
|
+
// Build request object with action options
|
|
1277
|
+
const request = buildStartCompensationRequest(params);
|
|
1224
1278
|
const client = createOrderManagementClient();
|
|
1225
|
-
const result = await client.restartCompensation(params.compensationId);
|
|
1279
|
+
const result = await client.restartCompensation(params.compensationId, request);
|
|
1226
1280
|
if (result.success) {
|
|
1227
1281
|
return { content: [{ type: "text", text: `Successfully restarted compensation: ${params.compensationId}` }] };
|
|
1228
1282
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "brinkcommerce-dev-mcp",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
4
|
"description": "BrinkCommerce MCP Server - API documentation and management tools for products, orders, inventory, prices, discounts, taxes, and stores",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|
package/CLAUDE.md
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Development Commands
|
|
6
|
-
|
|
7
|
-
Build and development commands available via npm scripts and Makefile:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
# Build and run
|
|
11
|
-
npm run build # Compile TypeScript to dist/
|
|
12
|
-
npm run dev # Development mode with hot reload using tsx
|
|
13
|
-
npm start # Start the built MCP server
|
|
14
|
-
|
|
15
|
-
# Make commands (recommended)
|
|
16
|
-
make setup # Install dependencies and build
|
|
17
|
-
make build # Build TypeScript to JavaScript
|
|
18
|
-
make dev # Run in development mode with hot reload
|
|
19
|
-
make start # Start MCP server (stdio mode)
|
|
20
|
-
make test # Test MCP server with example APIs
|
|
21
|
-
make clean # Clean build artifacts
|
|
22
|
-
make claude-config # Generate Claude configuration for local use
|
|
23
|
-
make install-global # Install globally via npm link
|
|
24
|
-
make claude-config-global # Generate config for global install
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Architecture Overview
|
|
28
|
-
|
|
29
|
-
This is a Model Context Protocol (MCP) server that provides Claude with access to BrinkCommerce OpenAPI specifications. The server enables natural language queries about APIs, endpoints, schemas, and data models.
|
|
30
|
-
|
|
31
|
-
### Core Components
|
|
32
|
-
|
|
33
|
-
- **`src/index.ts`** - Main MCP server implementation with stdio transport
|
|
34
|
-
- **`src/openapi-utils.ts`** - OpenAPI specification parsing and management utilities
|
|
35
|
-
- **`openapi-specs/`** - Directory containing BrinkCommerce API specifications (JSON/YAML)
|
|
36
|
-
|
|
37
|
-
### Key Classes
|
|
38
|
-
|
|
39
|
-
**OpenAPIManager** (`src/openapi-utils.ts`):
|
|
40
|
-
- Loads and validates OpenAPI specs from the `openapi-specs/` directory
|
|
41
|
-
- Provides methods to query endpoints, schemas, and API information
|
|
42
|
-
- Handles spec dereferencing using SwaggerParser
|
|
43
|
-
- Supports search functionality across all loaded APIs
|
|
44
|
-
|
|
45
|
-
**MCP Server** (`src/index.ts`):
|
|
46
|
-
- Implements the Model Context Protocol for Claude integration
|
|
47
|
-
- Exposes 8 tools: `list_apis`, `get_api_info`, `list_endpoints`, `get_endpoint_details`, `list_schemas`, `get_schema`, `search_schemas`, `get_docs_info`
|
|
48
|
-
- Provides resource access to raw OpenAPI specs via `openapi://` URIs
|
|
49
|
-
- Uses stdio transport for communication with Claude
|
|
50
|
-
- Self-documenting with comprehensive context for LLMs
|
|
51
|
-
|
|
52
|
-
### Environment Configuration
|
|
53
|
-
|
|
54
|
-
- **`DOCS_BASE_URL`** - Override documentation base URL (defaults to `https://brink-commerce.gitbook.io/brink-commerce`)
|
|
55
|
-
- **`SPECS_FORCE_REFRESH`** - Force refresh of all specs on startup (set to `true` to enable)
|
|
56
|
-
- **`BRINKCOMMERCE_CACHE_DIR`** - Override cache directory (highest priority)
|
|
57
|
-
- **`XDG_CACHE_HOME`** - Linux/Unix cache directory (used if set, creates `$XDG_CACHE_HOME/brinkcommerce-dev-mcp`)
|
|
58
|
-
|
|
59
|
-
## Working with OpenAPI Specs
|
|
60
|
-
|
|
61
|
-
The server automatically fetches OpenAPI specifications from configured URLs and caches them locally with automatic 48-hour refresh. API specifications are configured in `src/config.ts` and each spec becomes an API that can be queried through the MCP tools.
|
|
62
|
-
|
|
63
|
-
**Note**: Users may refer to the platform as "Brink", "Brink Commerce", or "BrinkCommerce" - these all refer to the same platform. The API names themselves don't include "brink" prefix (e.g., use "product-management" not "brink-product-management").
|
|
64
|
-
|
|
65
|
-
### Cache Directory Resolution
|
|
66
|
-
|
|
67
|
-
The server uses a smart cache directory resolution strategy for cross-platform compatibility:
|
|
68
|
-
|
|
69
|
-
1. **`BRINKCOMMERCE_CACHE_DIR`** environment variable (highest priority)
|
|
70
|
-
2. **`XDG_CACHE_HOME/brinkcommerce-dev-mcp`** on Linux/Unix systems
|
|
71
|
-
3. **Platform-specific user cache directories:**
|
|
72
|
-
- **Linux**: `~/.cache/brinkcommerce-dev-mcp`
|
|
73
|
-
- **macOS**: `~/Library/Caches/brinkcommerce-dev-mcp`
|
|
74
|
-
- **Windows**: `%LOCALAPPDATA%\brinkcommerce-dev-mcp\Cache`
|
|
75
|
-
4. **`node_modules/.cache/brinkcommerce-dev-mcp`** (project-level fallback)
|
|
76
|
-
5. **System temp directory** (last resort)
|
|
77
|
-
|
|
78
|
-
This ensures cache persistence across different environments and survives `npm ci` operations when using user-level cache directories.
|
|
79
|
-
|
|
80
|
-
BrinkCommerce APIs included:
|
|
81
|
-
- Core APIs: Product Management, Order Management, Price Management, Stock Management, Store Management, Tax Management, Discount Management
|
|
82
|
-
- Shopper API and payment provider integrations: Adyen, Avarda, Klarna, Ledyer, Svea, Walley, Qliro, and more
|
|
83
|
-
- Supporting services: Voyado, Retain24, BSG/KBS Gift Cards, Bonus, Ingrid, NShift, Zaver
|
|
84
|
-
|
|
85
|
-
The server provides both high-level API information and detailed endpoint/schema inspection capabilities through natural language queries via Claude, with automatic cache management and 48-hour refresh cycles.
|
|
86
|
-
|
|
87
|
-
## Library Documentation
|
|
88
|
-
|
|
89
|
-
Comprehensive documentation for all project dependencies is available in the `/docs/libraries/` directory:
|
|
90
|
-
|
|
91
|
-
### Core Libraries
|
|
92
|
-
- **[MCP TypeScript SDK](docs/libraries/mcp-typescript-sdk.md)** - Model Context Protocol implementation for creating servers and clients
|
|
93
|
-
- **[dotenv](docs/libraries/dotenv.md)** - Environment variable management from .env files
|
|
94
|
-
- **[js-yaml](docs/libraries/js-yaml.md)** - YAML parser and writer for JavaScript
|
|
95
|
-
- **[node-fetch](docs/libraries/node-fetch.md)** - HTTP client bringing Fetch API to Node.js
|
|
96
|
-
- **[swagger-parser](docs/libraries/swagger-parser.md)** - OpenAPI specification parsing and validation
|
|
97
|
-
|
|
98
|
-
Each documentation file includes:
|
|
99
|
-
- Installation and setup instructions
|
|
100
|
-
- Code examples and usage patterns
|
|
101
|
-
- Configuration options and best practices
|
|
102
|
-
- Common use cases and troubleshooting
|
|
103
|
-
- Migration guides for version updates
|
|
104
|
-
|
|
105
|
-
This documentation was retrieved using Context7 and provides comprehensive reference material for working with the project's dependencies.
|