@virtocommerce/mcp-onx 0.0.1-alpha.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 +22 -0
- package/README.md +360 -0
- package/dist/adapter.d.ts +53 -0
- package/dist/adapter.d.ts.map +1 -0
- package/dist/adapter.js +205 -0
- package/dist/adapter.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/mappers/filter.mappers.d.ts +16 -0
- package/dist/mappers/filter.mappers.d.ts.map +1 -0
- package/dist/mappers/filter.mappers.js +209 -0
- package/dist/mappers/filter.mappers.js.map +1 -0
- package/dist/mappers/index.d.ts +2 -0
- package/dist/mappers/index.d.ts.map +1 -0
- package/dist/mappers/index.js +2 -0
- package/dist/mappers/index.js.map +1 -0
- package/dist/models/base.d.ts +133 -0
- package/dist/models/base.d.ts.map +1 -0
- package/dist/models/base.js +2 -0
- package/dist/models/base.js.map +1 -0
- package/dist/models/catalog.d.ts +180 -0
- package/dist/models/catalog.d.ts.map +1 -0
- package/dist/models/catalog.js +2 -0
- package/dist/models/catalog.js.map +1 -0
- package/dist/models/customer.d.ts +148 -0
- package/dist/models/customer.d.ts.map +1 -0
- package/dist/models/customer.js +2 -0
- package/dist/models/customer.js.map +1 -0
- package/dist/models/index.d.ts +10 -0
- package/dist/models/index.d.ts.map +1 -0
- package/dist/models/index.js +2 -0
- package/dist/models/index.js.map +1 -0
- package/dist/models/inventory.d.ts +34 -0
- package/dist/models/inventory.d.ts.map +1 -0
- package/dist/models/inventory.js +2 -0
- package/dist/models/inventory.js.map +1 -0
- package/dist/models/order.d.ts +158 -0
- package/dist/models/order.d.ts.map +1 -0
- package/dist/models/order.js +2 -0
- package/dist/models/order.js.map +1 -0
- package/dist/models/payment.d.ts +145 -0
- package/dist/models/payment.d.ts.map +1 -0
- package/dist/models/payment.js +2 -0
- package/dist/models/payment.js.map +1 -0
- package/dist/models/return.d.ts +31 -0
- package/dist/models/return.d.ts.map +1 -0
- package/dist/models/return.js +2 -0
- package/dist/models/return.js.map +1 -0
- package/dist/models/search.d.ts +143 -0
- package/dist/models/search.d.ts.map +1 -0
- package/dist/models/search.js +2 -0
- package/dist/models/search.js.map +1 -0
- package/dist/models/shipment.d.ts +70 -0
- package/dist/models/shipment.d.ts.map +1 -0
- package/dist/models/shipment.js +2 -0
- package/dist/models/shipment.js.map +1 -0
- package/dist/services/base.service.d.ts +10 -0
- package/dist/services/base.service.d.ts.map +1 -0
- package/dist/services/base.service.js +25 -0
- package/dist/services/base.service.js.map +1 -0
- package/dist/services/customer.service.d.ts +16 -0
- package/dist/services/customer.service.d.ts.map +1 -0
- package/dist/services/customer.service.js +78 -0
- package/dist/services/customer.service.js.map +1 -0
- package/dist/services/fulfillment.service.d.ts +17 -0
- package/dist/services/fulfillment.service.d.ts.map +1 -0
- package/dist/services/fulfillment.service.js +94 -0
- package/dist/services/fulfillment.service.js.map +1 -0
- package/dist/services/index.d.ts +7 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +7 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/order.service.d.ts +22 -0
- package/dist/services/order.service.d.ts.map +1 -0
- package/dist/services/order.service.js +153 -0
- package/dist/services/order.service.js.map +1 -0
- package/dist/services/product.service.d.ts +25 -0
- package/dist/services/product.service.d.ts.map +1 -0
- package/dist/services/product.service.js +116 -0
- package/dist/services/product.service.js.map +1 -0
- package/dist/services/return.service.d.ts +17 -0
- package/dist/services/return.service.d.ts.map +1 -0
- package/dist/services/return.service.js +148 -0
- package/dist/services/return.service.js.map +1 -0
- package/dist/transformers/address.transformer.d.ts +11 -0
- package/dist/transformers/address.transformer.d.ts.map +1 -0
- package/dist/transformers/address.transformer.js +75 -0
- package/dist/transformers/address.transformer.js.map +1 -0
- package/dist/transformers/base.d.ts +14 -0
- package/dist/transformers/base.d.ts.map +1 -0
- package/dist/transformers/base.js +44 -0
- package/dist/transformers/base.js.map +1 -0
- package/dist/transformers/customer.transformer.d.ts +16 -0
- package/dist/transformers/customer.transformer.d.ts.map +1 -0
- package/dist/transformers/customer.transformer.js +84 -0
- package/dist/transformers/customer.transformer.js.map +1 -0
- package/dist/transformers/fulfillment.transformer.d.ts +13 -0
- package/dist/transformers/fulfillment.transformer.d.ts.map +1 -0
- package/dist/transformers/fulfillment.transformer.js +93 -0
- package/dist/transformers/fulfillment.transformer.js.map +1 -0
- package/dist/transformers/index.d.ts +8 -0
- package/dist/transformers/index.d.ts.map +1 -0
- package/dist/transformers/index.js +8 -0
- package/dist/transformers/index.js.map +1 -0
- package/dist/transformers/order.transformer.d.ts +26 -0
- package/dist/transformers/order.transformer.d.ts.map +1 -0
- package/dist/transformers/order.transformer.js +201 -0
- package/dist/transformers/order.transformer.js.map +1 -0
- package/dist/transformers/product.transformer.d.ts +19 -0
- package/dist/transformers/product.transformer.d.ts.map +1 -0
- package/dist/transformers/product.transformer.js +202 -0
- package/dist/transformers/product.transformer.js.map +1 -0
- package/dist/transformers/return.transformer.d.ts +12 -0
- package/dist/transformers/return.transformer.d.ts.map +1 -0
- package/dist/transformers/return.transformer.js +83 -0
- package/dist/transformers/return.transformer.js.map +1 -0
- package/dist/types.d.ts +135 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +47 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/api-client.d.ts +31 -0
- package/dist/utils/api-client.d.ts.map +1 -0
- package/dist/utils/api-client.js +226 -0
- package/dist/utils/api-client.js.map +1 -0
- package/dist/utils/type-guards.d.ts +9 -0
- package/dist/utils/type-guards.d.ts.map +1 -0
- package/dist/utils/type-guards.js +21 -0
- package/dist/utils/type-guards.js.map +1 -0
- package/package.json +60 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Your Company
|
|
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.
|
|
22
|
+
|
package/README.md
ADDED
|
@@ -0,0 +1,360 @@
|
|
|
1
|
+
# Commerce Operations Foundation Adapter Template
|
|
2
|
+
|
|
3
|
+
This template helps fulfillment vendors and retailers create custom adapters for the Commerce Operations Foundation MCP Server. Use this template to build an adapter that connects your fulfillment system to the COF ecosystem.
|
|
4
|
+
|
|
5
|
+
## Table of Contents
|
|
6
|
+
|
|
7
|
+
- [Quick Start](#quick-start)
|
|
8
|
+
- [Template Structure](#template-structure)
|
|
9
|
+
- [Implementation Guide](#implementation-guide)
|
|
10
|
+
- [Configuration](#configuration)
|
|
11
|
+
- [Testing Your Adapter](#testing-your-adapter)
|
|
12
|
+
- [Using Your Adapter](#using-your-adapter)
|
|
13
|
+
- [Publishing](#publishing)
|
|
14
|
+
- [Troubleshooting](#troubleshooting)
|
|
15
|
+
- [API Reference](#api-reference)
|
|
16
|
+
- [Support](#support)
|
|
17
|
+
|
|
18
|
+
## Quick Start
|
|
19
|
+
|
|
20
|
+
### Step 1: Set Up Your Adapter Project
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
# Copy this template to create your adapter
|
|
24
|
+
cp -r adapter-template/ my-fulfillment-adapter/
|
|
25
|
+
cd my-fulfillment-adapter/
|
|
26
|
+
|
|
27
|
+
# Install dependencies
|
|
28
|
+
npm install
|
|
29
|
+
|
|
30
|
+
# Rename the adapter in package.json
|
|
31
|
+
# Update name to: @yourcompany/cof-adapter-yourfulfillment
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Step 2: Customize Package Information
|
|
35
|
+
|
|
36
|
+
Edit `package.json` to reflect your adapter:
|
|
37
|
+
|
|
38
|
+
```json
|
|
39
|
+
{
|
|
40
|
+
"name": "@yourcompany/cof-adapter-yourfulfillment",
|
|
41
|
+
"version": "1.0.0",
|
|
42
|
+
"description": "YourFulfillment adapter for Commerce Operations Foundation",
|
|
43
|
+
"author": "Your Company",
|
|
44
|
+
"license": "MIT"
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Step 3: Implement the Adapter Interface
|
|
49
|
+
|
|
50
|
+
Open `src/adapter.ts` and implement your fulfillment system's logic. The template provides all required methods with TODO comments showing what needs implementation.
|
|
51
|
+
|
|
52
|
+
## Template Structure
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
adapter-template/
|
|
56
|
+
├── src/
|
|
57
|
+
│ ├── adapter.ts # Main adapter implementation (modify this)
|
|
58
|
+
│ ├── index.ts # Module exports (update exports)
|
|
59
|
+
│ ├── types.ts # Custom type definitions (add your types)
|
|
60
|
+
│ └── utils/
|
|
61
|
+
│ └── api-client.ts # HTTP client wrapper (customize for your API)
|
|
62
|
+
├── tests/
|
|
63
|
+
│ └── adapter.test.ts # Unit tests (write your tests)
|
|
64
|
+
├── examples/
|
|
65
|
+
│ ├── basic-usage.ts # Basic usage examples
|
|
66
|
+
│ └── test-server.ts # Test with local MCP server
|
|
67
|
+
├── docs/
|
|
68
|
+
│ ├── API.md # Document your API mappings
|
|
69
|
+
│ └── CONFIGURATION.md # Document configuration options
|
|
70
|
+
├── package.json # Update name, author, description
|
|
71
|
+
├── tsconfig.json # TypeScript configuration
|
|
72
|
+
├── .env.example # Example configuration
|
|
73
|
+
└── README.md # Replace with your documentation
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Implementation Guide
|
|
77
|
+
|
|
78
|
+
### Required Methods Checklist
|
|
79
|
+
|
|
80
|
+
Your adapter must implement these methods from the `IFulfillmentAdapter` interface:
|
|
81
|
+
|
|
82
|
+
#### Lifecycle (3 methods)
|
|
83
|
+
- [ ] `connect()` - Establish connection to your fulfillment system
|
|
84
|
+
- [ ] `disconnect()` - Clean up resources
|
|
85
|
+
- [ ] `healthCheck()` - Return system health status
|
|
86
|
+
|
|
87
|
+
#### Action Operations (4 methods)
|
|
88
|
+
- [ ] `createSalesOrder()` - Create new orders
|
|
89
|
+
- [ ] `cancelOrder()` - Cancel existing orders
|
|
90
|
+
- [ ] `updateOrder()` - Update order details
|
|
91
|
+
- [ ] `fulfillOrder()` - Mark orders as fulfilled / shipped
|
|
92
|
+
|
|
93
|
+
#### Query Operations (6 methods)
|
|
94
|
+
- [ ] `getOrders()` - Retrieve order details
|
|
95
|
+
- [ ] `getCustomers()` - Get customer details
|
|
96
|
+
- [ ] `getProducts()` - Fetch product information
|
|
97
|
+
- [ ] `getProductVariants()` - Retrieve product variants
|
|
98
|
+
- [ ] `getInventory()` - Check inventory levels
|
|
99
|
+
- [ ] `getFulfillments()` - Fetch fulfillment records
|
|
100
|
+
|
|
101
|
+
### Implementation Steps
|
|
102
|
+
|
|
103
|
+
1. **Update adapter.ts with your API logic:**
|
|
104
|
+
```typescript
|
|
105
|
+
// src/adapter.ts
|
|
106
|
+
export class YourFulfillmentAdapter implements IFulfillmentAdapter {
|
|
107
|
+
async createSalesOrder(input: CreateSalesOrderInput): Promise<OrderResult> {
|
|
108
|
+
// TODO: Replace with your API call
|
|
109
|
+
const response = await this.apiClient.post('/orders', transform(input));
|
|
110
|
+
|
|
111
|
+
return response.success
|
|
112
|
+
? this.success({ order: mapOrder(response.data) })
|
|
113
|
+
: this.failure('Failed to create order', response.error);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
2. **Configure your API client:**
|
|
119
|
+
```typescript
|
|
120
|
+
// src/utils/api-client.ts
|
|
121
|
+
export class ApiClient {
|
|
122
|
+
constructor(config: YourConfig) {
|
|
123
|
+
// Set up authentication, base URL, etc.
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
3. **Define your configuration types:**
|
|
129
|
+
```typescript
|
|
130
|
+
// src/types.ts
|
|
131
|
+
export interface YourAdapterConfig {
|
|
132
|
+
apiUrl: string;
|
|
133
|
+
apiKey: string;
|
|
134
|
+
// Add your specific config options
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Testing Your Adapter
|
|
140
|
+
|
|
141
|
+
### Step 1: Test Locally
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
# Build your adapter
|
|
145
|
+
npm run build
|
|
146
|
+
|
|
147
|
+
# Run unit tests
|
|
148
|
+
npm test
|
|
149
|
+
|
|
150
|
+
# Test with the MCP server locally
|
|
151
|
+
cd ../server
|
|
152
|
+
npm install
|
|
153
|
+
ADAPTER_TYPE=local ADAPTER_PATH=../my-fulfillment-adapter/dist/index.js npm start
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Step 2: Write Unit Tests
|
|
157
|
+
|
|
158
|
+
```typescript
|
|
159
|
+
// tests/adapter.test.ts
|
|
160
|
+
import { YourFulfillmentAdapter } from '../src/adapter';
|
|
161
|
+
|
|
162
|
+
describe('YourFulfillmentAdapter', () => {
|
|
163
|
+
let adapter: YourFulfillmentAdapter;
|
|
164
|
+
|
|
165
|
+
beforeEach(() => {
|
|
166
|
+
adapter = new YourFulfillmentAdapter({
|
|
167
|
+
apiUrl: 'https://sandbox.yourapi.com',
|
|
168
|
+
apiKey: 'test-key'
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
test('should connect successfully', async () => {
|
|
173
|
+
await expect(adapter.connect()).resolves.not.toThrow();
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('should create sales order', async () => {
|
|
177
|
+
const result = await adapter.createSalesOrder({
|
|
178
|
+
// ... test data
|
|
179
|
+
});
|
|
180
|
+
expect(result.success).toBe(true);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// examples/test-server.ts
|
|
187
|
+
// Use this to test your adapter with a local MCP server
|
|
188
|
+
import { YourFulfillmentAdapter } from '../src/adapter';
|
|
189
|
+
|
|
190
|
+
const adapter = new YourFulfillmentAdapter({
|
|
191
|
+
apiUrl: process.env.API_URL || 'https://sandbox.yourapi.com',
|
|
192
|
+
apiKey: process.env.API_KEY || 'test-key'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
async function test() {
|
|
196
|
+
await adapter.connect();
|
|
197
|
+
console.log('Connected!');
|
|
198
|
+
|
|
199
|
+
const health = await adapter.healthCheck();
|
|
200
|
+
console.log('Health:', health);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
test().catch(console.error);
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## Using Your Adapter
|
|
207
|
+
|
|
208
|
+
### Option 1: Local Development (During Development)
|
|
209
|
+
|
|
210
|
+
```bash
|
|
211
|
+
# In the server directory, configure to use your local adapter
|
|
212
|
+
cd ../server
|
|
213
|
+
cat > .env << EOF
|
|
214
|
+
ADAPTER_TYPE=local
|
|
215
|
+
ADAPTER_PATH=../my-fulfillment-adapter/dist/index.js
|
|
216
|
+
ADAPTER_CONFIG={"apiUrl":"https://sandbox.yourapi.com","apiKey":"test-key"}
|
|
217
|
+
EOF
|
|
218
|
+
|
|
219
|
+
npm start
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
### Option 2: NPM Package (After Publishing)
|
|
223
|
+
|
|
224
|
+
```bash
|
|
225
|
+
# Install your published adapter
|
|
226
|
+
npm install @yourcompany/cof-adapter-yourfulfillment
|
|
227
|
+
|
|
228
|
+
# Configure the server to use it
|
|
229
|
+
cat > .env << EOF
|
|
230
|
+
ADAPTER_TYPE=npm
|
|
231
|
+
ADAPTER_PACKAGE=@yourcompany/cof-adapter-yourfulfillment
|
|
232
|
+
ADAPTER_CONFIG={"apiUrl":"https://api.yourfulfillment.com","apiKey":"production-key"}
|
|
233
|
+
EOF
|
|
234
|
+
|
|
235
|
+
npm start
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
## Configuration
|
|
239
|
+
|
|
240
|
+
Your adapter should accept configuration through the `ADAPTER_CONFIG` environment variable. Define your configuration interface in `src/types.ts`:
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
export interface YourAdapterConfig {
|
|
244
|
+
apiUrl: string; // Required: Your API endpoint
|
|
245
|
+
apiKey: string; // Required: Authentication key
|
|
246
|
+
workspace?: string; // Optional: Tenant/workspace ID
|
|
247
|
+
timeout?: number; // Optional: Request timeout (ms)
|
|
248
|
+
retryAttempts?: number; // Optional: Retry count
|
|
249
|
+
}
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
## Publishing
|
|
253
|
+
|
|
254
|
+
### For Public NPM Packages
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
# 1. Update version
|
|
258
|
+
npm version patch # or minor/major
|
|
259
|
+
|
|
260
|
+
# 2. Build and test
|
|
261
|
+
npm run build
|
|
262
|
+
npm test
|
|
263
|
+
|
|
264
|
+
# 3. Publish to NPM
|
|
265
|
+
npm publish --access public
|
|
266
|
+
```
|
|
267
|
+
|
|
268
|
+
### For Private Use
|
|
269
|
+
|
|
270
|
+
```bash
|
|
271
|
+
# Option 1: Private NPM registry
|
|
272
|
+
npm publish --registry https://your-registry.com
|
|
273
|
+
|
|
274
|
+
# Option 2: Git repository
|
|
275
|
+
git tag v1.0.0
|
|
276
|
+
git push origin v1.0.0
|
|
277
|
+
|
|
278
|
+
# Option 3: Local file reference in package.json
|
|
279
|
+
"dependencies": {
|
|
280
|
+
"my-adapter": "file:../my-fulfillment-adapter"
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
## Troubleshooting
|
|
284
|
+
|
|
285
|
+
### Adapter Not Loading
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Check the adapter can be imported
|
|
289
|
+
node -e "import('../my-fulfillment-adapter/dist/index.js')"
|
|
290
|
+
|
|
291
|
+
# Verify environment variables
|
|
292
|
+
echo $ADAPTER_TYPE
|
|
293
|
+
echo $ADAPTER_PATH
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
### Connection Issues
|
|
297
|
+
|
|
298
|
+
- Verify API credentials are correct
|
|
299
|
+
- Check network connectivity to your API
|
|
300
|
+
- Test with curl: `curl -X GET https://your-api.com/health`
|
|
301
|
+
- Enable debug logging in your adapter
|
|
302
|
+
|
|
303
|
+
### Type Errors
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
# Ensure types are installed
|
|
307
|
+
npm install --save-dev @types/node
|
|
308
|
+
|
|
309
|
+
# Check TypeScript version
|
|
310
|
+
npx tsc --version
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## API Reference
|
|
314
|
+
|
|
315
|
+
### Required Interfaces
|
|
316
|
+
|
|
317
|
+
Your adapter must implement the `IFulfillmentAdapter` interface from the main server. Key types:
|
|
318
|
+
|
|
319
|
+
```typescript
|
|
320
|
+
interface OrderParams {
|
|
321
|
+
extOrderId: string;
|
|
322
|
+
customer: Customer;
|
|
323
|
+
items: LineItem[];
|
|
324
|
+
shippingAddress?: Address;
|
|
325
|
+
billingAddress?: Address;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
interface OrderResult {
|
|
329
|
+
success: boolean;
|
|
330
|
+
orderId: string;
|
|
331
|
+
orderNumber?: string;
|
|
332
|
+
status?: string;
|
|
333
|
+
}
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
See the full type definitions in the server's `src/types/` directory.
|
|
337
|
+
|
|
338
|
+
## Support
|
|
339
|
+
|
|
340
|
+
### Documentation
|
|
341
|
+
- [Commerce Operations Foundation Docs](../docs/README.md)
|
|
342
|
+
- [For Fulfillment Vendors Guide](../docs/getting-started/for-fulfillment-vendors.md)
|
|
343
|
+
- [MCP Protocol Specification](https://modelcontextprotocol.io)
|
|
344
|
+
|
|
345
|
+
### Getting Help
|
|
346
|
+
- Create an issue in this repository
|
|
347
|
+
- Check existing adapters in the `adapters/` directory for examples
|
|
348
|
+
- Review the mock adapter implementation for reference
|
|
349
|
+
|
|
350
|
+
## Next Steps
|
|
351
|
+
|
|
352
|
+
1. **Copy this template** to start your adapter
|
|
353
|
+
2. **Implement the interface** methods for your fulfillment system
|
|
354
|
+
3. **Test locally** with the MCP server
|
|
355
|
+
4. **Publish** to NPM or deploy privately
|
|
356
|
+
5. **Document** your configuration options
|
|
357
|
+
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
*This template is part of the Commerce Operations Foundation (COF) project.*
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import type { IFulfillmentAdapter, AdapterConfig, AdapterCapabilities, HealthStatus, OrderResult, ReturnResult, FulfillmentToolResult, Order, Fulfillment, Return, InventoryItem, Product, ProductVariant, Customer, CreateSalesOrderInput, CreateReturnInput, CancelOrderInput, UpdateOrderInput, FulfillOrderInput, GetOrdersInput, GetInventoryInput, GetProductsInput, GetProductVariantsInput, GetCustomersInput, GetFulfillmentsInput, GetReturnsInput } from '@virtocommerce/cof-mcp';
|
|
2
|
+
export declare class VirtoCommerceFulfillmentAdapter implements IFulfillmentAdapter {
|
|
3
|
+
private client;
|
|
4
|
+
private connected;
|
|
5
|
+
private options;
|
|
6
|
+
private orderService;
|
|
7
|
+
private customerService;
|
|
8
|
+
private fulfillmentService;
|
|
9
|
+
private productService;
|
|
10
|
+
private returnService;
|
|
11
|
+
constructor(config?: any);
|
|
12
|
+
initialize?(config: AdapterConfig): Promise<void>;
|
|
13
|
+
cleanup?(): Promise<void>;
|
|
14
|
+
connect(): Promise<void>;
|
|
15
|
+
disconnect(): Promise<void>;
|
|
16
|
+
healthCheck(): Promise<HealthStatus>;
|
|
17
|
+
checkHealth?(): Promise<HealthStatus>;
|
|
18
|
+
getCapabilities?(): Promise<AdapterCapabilities>;
|
|
19
|
+
updateConfig?(config: AdapterConfig): Promise<void>;
|
|
20
|
+
createSalesOrder(input: CreateSalesOrderInput): Promise<OrderResult>;
|
|
21
|
+
cancelOrder(input: CancelOrderInput): Promise<OrderResult>;
|
|
22
|
+
updateOrder(input: UpdateOrderInput): Promise<OrderResult>;
|
|
23
|
+
getOrders(input: GetOrdersInput): Promise<FulfillmentToolResult<{
|
|
24
|
+
orders: Order[];
|
|
25
|
+
}>>;
|
|
26
|
+
fulfillOrder(input: FulfillOrderInput): Promise<FulfillmentToolResult<{
|
|
27
|
+
fulfillment: Fulfillment;
|
|
28
|
+
}>>;
|
|
29
|
+
getFulfillments(input: GetFulfillmentsInput): Promise<FulfillmentToolResult<{
|
|
30
|
+
fulfillments: Fulfillment[];
|
|
31
|
+
}>>;
|
|
32
|
+
getCustomers(input: GetCustomersInput): Promise<FulfillmentToolResult<{
|
|
33
|
+
customers: Customer[];
|
|
34
|
+
}>>;
|
|
35
|
+
getProducts(input: GetProductsInput): Promise<FulfillmentToolResult<{
|
|
36
|
+
products: Product[];
|
|
37
|
+
}>>;
|
|
38
|
+
getProductVariants(input: GetProductVariantsInput): Promise<FulfillmentToolResult<{
|
|
39
|
+
productVariants: ProductVariant[];
|
|
40
|
+
}>>;
|
|
41
|
+
getInventory(input: GetInventoryInput): Promise<FulfillmentToolResult<{
|
|
42
|
+
inventory: InventoryItem[];
|
|
43
|
+
}>>;
|
|
44
|
+
createReturn(input: CreateReturnInput): Promise<ReturnResult>;
|
|
45
|
+
getReturns(input: GetReturnsInput): Promise<FulfillmentToolResult<{
|
|
46
|
+
returns: Return[];
|
|
47
|
+
}>>;
|
|
48
|
+
private updateOptions;
|
|
49
|
+
private fetchCatalogId;
|
|
50
|
+
private getTenantId;
|
|
51
|
+
private now;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=adapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.d.ts","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,mBAAmB,EACnB,aAAa,EACb,mBAAmB,EACnB,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,KAAK,EACL,WAAW,EACX,MAAM,EACN,aAAa,EACb,OAAO,EACP,cAAc,EACd,QAAQ,EACR,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EACpB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAchC,qBAAa,+BAAgC,YAAW,mBAAmB;IACzE,OAAO,CAAC,MAAM,CAAY;IAC1B,OAAO,CAAC,SAAS,CAAS;IAC1B,OAAO,CAAC,OAAO,CAAiB;IAGhC,OAAO,CAAC,YAAY,CAAe;IACnC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,kBAAkB,CAAqB;IAC/C,OAAO,CAAC,cAAc,CAAiB;IACvC,OAAO,CAAC,aAAa,CAAgB;gBAEzB,MAAM,GAAE,GAAQ;IAmCtB,UAAU,CAAC,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC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K,EAAE,uBAAuB,GAC7B,OAAO,CAAC,qBAAqB,CAAC;QAAE,eAAe,EAAE,cAAc,EAAE,CAAA;KAAE,CAAC,CAAC;IAIlE,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAAE,SAAS,EAAE,aAAa,EAAE,CAAA;KAAE,CAAC,CAAC;IAMtG,YAAY,CAAC,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,YAAY,CAAC;IAI7D,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,qBAAqB,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAM/F,OAAO,CAAC,aAAa;YAqCP,cAAc;IAiB5B,OAAO,CAAC,WAAW;IAInB,OAAO,CAAC,GAAG;CAGZ"}
|
package/dist/adapter.js
ADDED
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { AdapterError } from '@virtocommerce/cof-mcp';
|
|
2
|
+
import { ApiClient } from './utils/api-client.js';
|
|
3
|
+
import { ErrorCode } from './types.js';
|
|
4
|
+
import { getErrorMessage } from './utils/type-guards.js';
|
|
5
|
+
import { OrderService, CustomerService, FulfillmentService, ProductService, ReturnService, } from './services/index.js';
|
|
6
|
+
export class VirtoCommerceFulfillmentAdapter {
|
|
7
|
+
client;
|
|
8
|
+
connected = false;
|
|
9
|
+
options;
|
|
10
|
+
orderService;
|
|
11
|
+
customerService;
|
|
12
|
+
fulfillmentService;
|
|
13
|
+
productService;
|
|
14
|
+
returnService;
|
|
15
|
+
constructor(config = {}) {
|
|
16
|
+
const options = config.options || config;
|
|
17
|
+
this.options = {
|
|
18
|
+
apiUrl: options.apiUrl || 'https://api.yourfulfillment.com',
|
|
19
|
+
apiKey: options.apiKey || '',
|
|
20
|
+
workspace: options.workspace,
|
|
21
|
+
timeout: options.timeout || 30000,
|
|
22
|
+
retryAttempts: options.retryAttempts || 3,
|
|
23
|
+
debugMode: options.debugMode || false,
|
|
24
|
+
};
|
|
25
|
+
this.client = new ApiClient({
|
|
26
|
+
baseUrl: this.options.apiUrl,
|
|
27
|
+
apiKey: this.options.apiKey,
|
|
28
|
+
timeout: this.options.timeout,
|
|
29
|
+
retryAttempts: this.options.retryAttempts,
|
|
30
|
+
debugMode: this.options.debugMode,
|
|
31
|
+
});
|
|
32
|
+
const tenantId = this.getTenantId();
|
|
33
|
+
this.orderService = new OrderService(this.client, tenantId, this.options.workspace);
|
|
34
|
+
this.customerService = new CustomerService(this.client, tenantId);
|
|
35
|
+
this.fulfillmentService = new FulfillmentService(this.client, tenantId, this.options.workspace);
|
|
36
|
+
this.productService = new ProductService(this.client, tenantId);
|
|
37
|
+
this.returnService = new ReturnService(this.client, tenantId);
|
|
38
|
+
this.orderService.setProductService(this.productService);
|
|
39
|
+
}
|
|
40
|
+
async initialize(config) {
|
|
41
|
+
this.updateOptions(config.options ?? {});
|
|
42
|
+
}
|
|
43
|
+
async cleanup() {
|
|
44
|
+
this.connected = false;
|
|
45
|
+
}
|
|
46
|
+
async connect() {
|
|
47
|
+
try {
|
|
48
|
+
const response = await this.client.get('/health');
|
|
49
|
+
if (!response.success) {
|
|
50
|
+
throw new AdapterError('Failed to connect to VirtoCommerce', ErrorCode.CONNECTION_FAILED, response);
|
|
51
|
+
}
|
|
52
|
+
this.connected = true;
|
|
53
|
+
console.error('Successfully connected to VirtoCommerce');
|
|
54
|
+
if (this.options.workspace && !this.options.catalogId) {
|
|
55
|
+
await this.fetchCatalogId();
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
this.connected = false;
|
|
60
|
+
throw new AdapterError(`Connection failed: ${getErrorMessage(error)}`, ErrorCode.CONNECTION_FAILED, error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
async disconnect() {
|
|
64
|
+
this.connected = false;
|
|
65
|
+
console.error('Disconnected from VirtoCommerce');
|
|
66
|
+
}
|
|
67
|
+
async healthCheck() {
|
|
68
|
+
try {
|
|
69
|
+
const response = await this.client.get('/health');
|
|
70
|
+
return {
|
|
71
|
+
status: response.success ? 'healthy' : 'unhealthy',
|
|
72
|
+
timestamp: this.now(),
|
|
73
|
+
checks: [
|
|
74
|
+
{
|
|
75
|
+
name: 'api_connection',
|
|
76
|
+
status: response.success ? 'pass' : 'fail',
|
|
77
|
+
message: response.success ? 'API is reachable' : 'API connection failed',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
name: 'authentication',
|
|
81
|
+
status: this.connected ? 'pass' : 'fail',
|
|
82
|
+
message: this.connected ? 'Authenticated' : 'Not authenticated',
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
version: '1.0.0',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
catch (error) {
|
|
89
|
+
return {
|
|
90
|
+
status: 'unhealthy',
|
|
91
|
+
timestamp: this.now(),
|
|
92
|
+
checks: [
|
|
93
|
+
{
|
|
94
|
+
name: 'api_connection',
|
|
95
|
+
status: 'fail',
|
|
96
|
+
message: `Health check failed: ${getErrorMessage(error)}`,
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
async checkHealth() {
|
|
103
|
+
return this.healthCheck();
|
|
104
|
+
}
|
|
105
|
+
async getCapabilities() {
|
|
106
|
+
return {
|
|
107
|
+
supportsOrderCapture: true,
|
|
108
|
+
supportsShipping: true,
|
|
109
|
+
supportsCustomFields: true,
|
|
110
|
+
maxBatchSize: 50,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
async updateConfig(config) {
|
|
114
|
+
this.updateOptions(config.options ?? {});
|
|
115
|
+
}
|
|
116
|
+
async createSalesOrder(input) {
|
|
117
|
+
return this.orderService.createSalesOrder(input);
|
|
118
|
+
}
|
|
119
|
+
async cancelOrder(input) {
|
|
120
|
+
return this.orderService.cancelOrder(input);
|
|
121
|
+
}
|
|
122
|
+
async updateOrder(input) {
|
|
123
|
+
return this.orderService.updateOrder(input);
|
|
124
|
+
}
|
|
125
|
+
async getOrders(input) {
|
|
126
|
+
return this.orderService.getOrders(input);
|
|
127
|
+
}
|
|
128
|
+
async fulfillOrder(input) {
|
|
129
|
+
return this.fulfillmentService.fulfillOrder(input);
|
|
130
|
+
}
|
|
131
|
+
async getFulfillments(input) {
|
|
132
|
+
return this.fulfillmentService.getFulfillments(input);
|
|
133
|
+
}
|
|
134
|
+
async getCustomers(input) {
|
|
135
|
+
return this.customerService.getCustomers(input);
|
|
136
|
+
}
|
|
137
|
+
async getProducts(input) {
|
|
138
|
+
return this.productService.getProducts(input);
|
|
139
|
+
}
|
|
140
|
+
async getProductVariants(input) {
|
|
141
|
+
return this.productService.getProductVariants(input);
|
|
142
|
+
}
|
|
143
|
+
async getInventory(input) {
|
|
144
|
+
return this.productService.getInventory(input);
|
|
145
|
+
}
|
|
146
|
+
async createReturn(input) {
|
|
147
|
+
return this.returnService.createReturn(input);
|
|
148
|
+
}
|
|
149
|
+
async getReturns(input) {
|
|
150
|
+
return this.returnService.getReturns(input);
|
|
151
|
+
}
|
|
152
|
+
updateOptions(options) {
|
|
153
|
+
if (!options) {
|
|
154
|
+
return;
|
|
155
|
+
}
|
|
156
|
+
this.options = {
|
|
157
|
+
...this.options,
|
|
158
|
+
...options,
|
|
159
|
+
};
|
|
160
|
+
if (options.apiKey) {
|
|
161
|
+
this.client.updateApiKey(options.apiKey);
|
|
162
|
+
}
|
|
163
|
+
if (typeof options.debugMode === 'boolean') {
|
|
164
|
+
this.client.setDebugMode(options.debugMode);
|
|
165
|
+
}
|
|
166
|
+
const tenantId = this.getTenantId();
|
|
167
|
+
this.orderService.setTenantId(tenantId);
|
|
168
|
+
this.customerService.setTenantId(tenantId);
|
|
169
|
+
this.fulfillmentService.setTenantId(tenantId);
|
|
170
|
+
this.productService.setTenantId(tenantId);
|
|
171
|
+
this.returnService.setTenantId(tenantId);
|
|
172
|
+
if (options.workspace) {
|
|
173
|
+
this.orderService.setWorkspace(options.workspace);
|
|
174
|
+
this.fulfillmentService.setWorkspace(options.workspace);
|
|
175
|
+
}
|
|
176
|
+
if (options.catalogId) {
|
|
177
|
+
this.orderService.setCatalogId(options.catalogId);
|
|
178
|
+
this.productService.setCatalogId(options.catalogId);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
async fetchCatalogId() {
|
|
182
|
+
try {
|
|
183
|
+
const storeResponse = await this.client.get(`/api/stores/${this.options.workspace}`);
|
|
184
|
+
if (storeResponse.success && storeResponse.data?.catalog) {
|
|
185
|
+
this.options.catalogId = storeResponse.data.catalog;
|
|
186
|
+
this.orderService.setCatalogId(storeResponse.data.catalog);
|
|
187
|
+
this.productService.setCatalogId(storeResponse.data.catalog);
|
|
188
|
+
console.error(`Resolved catalogId "${storeResponse.data.catalog}" from store "${this.options.workspace}"`);
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
console.error(`Warning: Could not resolve catalogId from store "${this.options.workspace}"`);
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
catch (error) {
|
|
195
|
+
console.error(`Warning: Failed to fetch store info for catalogId resolution: ${getErrorMessage(error)}`);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
getTenantId() {
|
|
199
|
+
return this.options.workspace ?? 'default-workspace';
|
|
200
|
+
}
|
|
201
|
+
now() {
|
|
202
|
+
return new Date().toISOString();
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
//# sourceMappingURL=adapter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adapter.js","sourceRoot":"","sources":["../src/adapter.ts"],"names":[],"mappings":"AAmCA,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACz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CAAC,SAAS,GAAG,CAAC,CAAC;YAC7G,CAAC;iBAAM,CAAC;gBACN,OAAO,CAAC,KAAK,CAAC,oDAAoD,IAAI,CAAC,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;YAC/F,CAAC;QACH,CAAC;QAAC,OAAO,KAAc,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,iEAAiE,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC3G,CAAC;IACH,CAAC;IAEO,WAAW;QACjB,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,IAAI,mBAAmB,CAAC;IACvD,CAAC;IAEO,GAAG;QACT,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAClC,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VirtoCommerceFulfillmentAdapter } from './adapter.js';
|
|
2
|
+
export default VirtoCommerceFulfillmentAdapter;
|
|
3
|
+
export { VirtoCommerceFulfillmentAdapter } from './adapter.js';
|
|
4
|
+
export type { AdapterOptions } from './types.js';
|
|
5
|
+
export { ErrorCode, STATUS_MAP } from './types.js';
|
|
6
|
+
export * from './transformers/index.js';
|
|
7
|
+
export * from './services/index.js';
|
|
8
|
+
export * from './mappers/index.js';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,eAAe,+BAA+B,CAAC;AAG/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAG/D,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { VirtoCommerceFulfillmentAdapter } from './adapter.js';
|
|
2
|
+
export default VirtoCommerceFulfillmentAdapter;
|
|
3
|
+
export { VirtoCommerceFulfillmentAdapter } from './adapter.js';
|
|
4
|
+
export { ErrorCode, STATUS_MAP } from './types.js';
|
|
5
|
+
export * from './transformers/index.js';
|
|
6
|
+
export * from './services/index.js';
|
|
7
|
+
export * from './mappers/index.js';
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,eAAe,+BAA+B,CAAC;AAG/C,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAI/D,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGnD,cAAc,yBAAyB,CAAC;AAGxC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,oBAAoB,CAAC"}
|