ebay-mcp 1.13.2 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.de.md +3 -3
- package/README.es.md +3 -3
- package/README.fr.md +3 -3
- package/README.ja.md +3 -3
- package/README.ko.md +3 -3
- package/README.md +163 -41
- package/README.pt-BR.md +3 -3
- package/README.ru.md +3 -3
- package/README.zh-CN.md +3 -3
- package/build/api/account-management/account.js +633 -297
- package/build/api/analytics-and-report/analytics.js +111 -65
- package/build/api/client.js +199 -140
- package/build/api/clientRequestError.js +23 -0
- package/build/api/clientTrading.js +213 -0
- package/build/api/clientTradingError.js +4 -0
- package/build/api/communication/feedback.js +147 -59
- package/build/api/communication/message.js +134 -81
- package/build/api/communication/negotiation.js +65 -53
- package/build/api/communication/notification.js +458 -164
- package/build/api/developer/developer.js +99 -45
- package/build/api/index.js +23 -8
- package/build/api/listing-management/inventory.js +884 -338
- package/build/api/listing-metadata/metadata.js +416 -170
- package/build/api/listing-metadata/taxonomy.js +187 -42
- package/build/api/marketing-and-promotions/marketing.js +1392 -598
- package/build/api/marketing-and-promotions/recommendation.js +49 -24
- package/build/api/order-management/dispute.js +226 -45
- package/build/api/order-management/fulfillment.js +144 -71
- package/build/api/order-management/orderIssueHelpers.js +61 -0
- package/build/api/other/compliance.js +50 -38
- package/build/api/other/edelivery.js +603 -159
- package/build/api/other/finding.js +280 -0
- package/build/api/other/identity.js +30 -15
- package/build/api/other/translation.js +29 -14
- package/build/api/other/vero.js +113 -27
- package/build/api/rateLimitTracker.js +55 -0
- package/build/api/shared/request.js +189 -98
- package/build/api/trading/trading.js +154 -87
- package/build/auth/credentialSession.js +250 -0
- package/build/auth/oauth.js +298 -171
- package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
- package/build/auth/oauthMiddleware.js +104 -0
- package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
- package/build/auth/tokenVerifier.js +243 -0
- package/build/auth/tokenVerifierError.js +21 -0
- package/build/config/environment.js +148 -113
- package/build/config/{tool-families.js → toolFamilies.js} +30 -14
- package/build/index.js +25 -19
- package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
- package/build/mcp/readOnlyFilter.js +67 -0
- package/build/mcp/runtime.js +31 -13
- package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
- package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
- package/build/schemas/account-management/account.js +144 -6
- package/build/schemas/analytics/analytics.js +33 -19
- package/build/schemas/communication/messages.js +12 -42
- package/build/schemas/developer/developer.js +135 -0
- package/build/schemas/fulfillment/orders.js +183 -21
- package/build/schemas/index.js +27 -19
- package/build/schemas/inventory-management/inventory.js +17 -9
- package/build/schemas/marketing/marketing.js +480 -25
- package/build/schemas/metadata/metadata.js +11 -6
- package/build/schemas/other/finding.js +27 -0
- package/build/schemas/other/otherApis.js +424 -0
- package/build/schemas/taxonomy/taxonomy.js +11 -5
- package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
- package/build/scripts/{build-ui.js → buildUi.js} +6 -1
- package/build/scripts/{dev-sync.js → devSync.js} +169 -110
- package/build/scripts/diagnostics.js +52 -44
- package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
- package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
- package/build/scripts/setup.js +241 -178
- package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
- package/build/scripts/skills.js +35 -27
- package/build/scripts/updateApiStatusDoc.js +71 -0
- package/build/serverHttp.js +90 -0
- package/build/skills/content.js +124 -118
- package/build/skills/index.js +22 -10
- package/build/skills/install.js +21 -10
- package/build/skills/markers.js +50 -15
- package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
- package/build/skills/render.js +41 -14
- package/build/skills/targets.js +49 -17
- package/build/tools/categories/account.js +166 -264
- package/build/tools/categories/analytics.js +11 -22
- package/build/tools/categories/browse.js +17 -0
- package/build/tools/categories/communication.js +124 -399
- package/build/tools/categories/connector.js +23 -20
- package/build/tools/categories/developer.js +46 -159
- package/build/tools/categories/fulfillment.js +84 -215
- package/build/tools/categories/index.js +6 -14
- package/build/tools/categories/inventory.js +238 -293
- package/build/tools/categories/marketing.js +677 -39
- package/build/tools/categories/metadata.js +190 -117
- package/build/tools/categories/other.js +81 -208
- package/build/tools/categories/taxonomy.js +29 -20
- package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
- package/build/tools/categories/trading.js +16 -47
- package/build/tools/contracts.js +34 -24
- package/build/tools/{define-tool.js → defineTool.js} +44 -29
- package/build/tools/registry.js +87 -29
- package/build/tools/schemas.js +3 -57
- package/build/tools/ui/archetypes.js +1 -0
- package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
- package/build/tools/ui/maps.js +294 -80
- package/build/types/index.js +1 -1
- package/build/ui/card.html +14 -14
- package/build/ui/chart.html +14 -14
- package/build/ui/stat.html +87 -0
- package/build/ui/table.html +14 -14
- package/build/utils/apiStatusFeed.js +95 -0
- package/build/utils/cliOutput.js +15 -0
- package/build/utils/cliUi.js +108 -0
- package/build/utils/communication/feedback.js +57 -77
- package/build/utils/communication/message.js +69 -98
- package/build/utils/communication/negotiation.js +30 -57
- package/build/utils/communication/notification.js +112 -252
- package/build/utils/{date-converter.js → dateConverter.js} +62 -30
- package/build/utils/effectSchema.js +203 -0
- package/build/utils/effectSchemaAdapter.js +121 -0
- package/build/utils/effectSchemaChainMethods.js +146 -0
- package/build/utils/effectSchemaRefinements.js +104 -0
- package/build/utils/effectSchemaStringMethods.js +63 -0
- package/build/utils/effectSchemaTypes.js +47 -0
- package/build/utils/{env-parser.js → envParser.js} +10 -2
- package/build/utils/errors.js +7 -3
- package/build/utils/http.js +148 -89
- package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
- package/build/utils/logger.js +127 -51
- package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
- package/build/utils/other/compliance.js +18 -38
- package/build/utils/other/identity.js +2 -2
- package/build/utils/other/translation.js +4 -4
- package/build/utils/other/vero.js +36 -20
- package/build/utils/schemaHelpers.js +22 -0
- package/build/utils/scopeHelper.js +270 -0
- package/build/utils/securityChecker.js +316 -0
- package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
- package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
- package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
- package/build/utils/trading/trading.js +35 -0
- package/build/utils/typeGuards.js +12 -0
- package/build/utils/version.js +65 -29
- package/package.json +10 -8
- package/build/api/client-trading.js +0 -124
- package/build/api/communication/shared.js +0 -59
- package/build/api/shared/query-params.js +0 -16
- package/build/auth/credential-session.js +0 -166
- package/build/auth/oauth-middleware.js +0 -100
- package/build/auth/token-verifier.js +0 -186
- package/build/schemas/other/other-apis.js +0 -390
- package/build/scripts/update-api-status-doc.js +0 -44
- package/build/server-http.js +0 -85
- package/build/tools/definitions/marketing.js +0 -1381
- package/build/tools/tool-handlers/marketing.js +0 -312
- package/build/utils/account-management/account.js +0 -818
- package/build/utils/api-status-feed.js +0 -84
- package/build/utils/cli-ui.js +0 -47
- package/build/utils/order-management/dispute.js +0 -369
- package/build/utils/order-management/fulfillment.js +0 -205
- package/build/utils/other/edelivery.js +0 -235
- package/build/utils/schema-helpers.js +0 -13
- package/build/utils/scope-helper.js +0 -207
- package/build/utils/security-checker.js +0 -248
- package/build/utils/type-guards.js +0 -6
- /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
- /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
- /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
- /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
|
@@ -1,57 +1,57 @@
|
|
|
1
1
|
import { platform } from 'os';
|
|
2
2
|
import { spawn } from 'child_process';
|
|
3
3
|
import prompts from 'prompts';
|
|
4
|
-
|
|
5
|
-
* Placeholder renderer type kept for compatibility with clack-style setup code.
|
|
6
|
-
*/
|
|
7
|
-
export class ClackRenderer {
|
|
8
|
-
}
|
|
4
|
+
import { writeCliLine } from './cliOutput.js';
|
|
9
5
|
/**
|
|
10
6
|
* Preserves wizard configuration typing without transforming the config.
|
|
7
|
+
*
|
|
8
|
+
* @param config - Wizard configuration to preserve as a typed literal.
|
|
9
|
+
* @returns The same config object.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const wizard = defineWizard({ steps: [] });
|
|
14
|
+
* ```
|
|
11
15
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const child = spawn(command, args, {
|
|
35
|
-
stdio: 'ignore',
|
|
36
|
-
detached: true,
|
|
37
|
-
});
|
|
38
|
-
child.on('error', () => resolve());
|
|
39
|
-
child.unref();
|
|
40
|
-
resolve();
|
|
16
|
+
export const defineWizard = (config) => config;
|
|
17
|
+
const openUrl = (url) => new Promise((resolve) => {
|
|
18
|
+
const currentPlatform = platform();
|
|
19
|
+
let command = '';
|
|
20
|
+
let args = [];
|
|
21
|
+
switch (currentPlatform) {
|
|
22
|
+
case 'darwin':
|
|
23
|
+
command = 'open';
|
|
24
|
+
args = [url];
|
|
25
|
+
break;
|
|
26
|
+
case 'win32':
|
|
27
|
+
command = 'cmd';
|
|
28
|
+
args = ['/c', 'start', '', url];
|
|
29
|
+
break;
|
|
30
|
+
default:
|
|
31
|
+
command = 'xdg-open';
|
|
32
|
+
args = [url];
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
const child = spawn(command, args, {
|
|
36
|
+
stdio: 'ignore',
|
|
37
|
+
detached: true,
|
|
41
38
|
});
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
child.on('error', () => resolve());
|
|
40
|
+
child.unref();
|
|
41
|
+
resolve();
|
|
42
|
+
});
|
|
43
|
+
const getSelectDefaultIndex = (options, stepDefault) => {
|
|
44
44
|
if (!stepDefault)
|
|
45
45
|
return 0;
|
|
46
46
|
const index = options.findIndex((option) => option.value === stepDefault);
|
|
47
47
|
return index >= 0 ? index : 0;
|
|
48
|
-
}
|
|
49
|
-
async
|
|
48
|
+
};
|
|
49
|
+
const promptStep = async (step, optionsOverride, onCancel) => {
|
|
50
50
|
if (step.type === 'note') {
|
|
51
51
|
if (step.message)
|
|
52
|
-
|
|
52
|
+
writeCliLine(`\n ${step.message}`);
|
|
53
53
|
if (step.description)
|
|
54
|
-
|
|
54
|
+
writeCliLine(` ${step.description}\n`);
|
|
55
55
|
return { cancelled: false, value: undefined };
|
|
56
56
|
}
|
|
57
57
|
let cancelled = false;
|
|
@@ -119,11 +119,22 @@ async function promptStep(step, optionsOverride, onCancel) {
|
|
|
119
119
|
return { cancelled: false, value: responseValue };
|
|
120
120
|
}
|
|
121
121
|
return { cancelled: false, value: undefined };
|
|
122
|
-
}
|
|
122
|
+
};
|
|
123
123
|
/**
|
|
124
124
|
* Runs an interactive setup wizard and returns answers keyed by step id.
|
|
125
|
+
*
|
|
126
|
+
* @param config - Wizard steps and optional metadata.
|
|
127
|
+
* @param runOptions - Optional callbacks and providers for rendering/validation.
|
|
128
|
+
* @returns Answers keyed by step id; returns partial answers when cancelled.
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```ts
|
|
132
|
+
* const answers = await runWizard(wizardConfig, {
|
|
133
|
+
* optionsProvider: (stepId) => (stepId === 'environment' ? environments : undefined),
|
|
134
|
+
* });
|
|
135
|
+
* ```
|
|
125
136
|
*/
|
|
126
|
-
export async
|
|
137
|
+
export const runWizard = async (config, runOptions = {}) => {
|
|
127
138
|
const answers = {};
|
|
128
139
|
const indexByStepId = new Map(config.steps.map((step, index) => [step.id, index]));
|
|
129
140
|
let currentIndex = 0;
|
|
@@ -134,8 +145,8 @@ export async function runWizard(config, runOptions = {}) {
|
|
|
134
145
|
forcedNextStep = stepId;
|
|
135
146
|
},
|
|
136
147
|
showNote(title, body) {
|
|
137
|
-
|
|
138
|
-
|
|
148
|
+
writeCliLine(`\n ${title}`);
|
|
149
|
+
writeCliLine(` ${body}\n`);
|
|
139
150
|
},
|
|
140
151
|
openBrowser(url) {
|
|
141
152
|
return openUrl(url);
|
|
@@ -162,7 +173,7 @@ export async function runWizard(config, runOptions = {}) {
|
|
|
162
173
|
? await runOptions.asyncValidate(step.id, result.value)
|
|
163
174
|
: null;
|
|
164
175
|
while (validationError) {
|
|
165
|
-
|
|
176
|
+
writeCliLine(`\n ${validationError}\n`);
|
|
166
177
|
const retry = await promptStep(step, optionsOverride, runOptions.onCancel);
|
|
167
178
|
if (retry.cancelled)
|
|
168
179
|
return answers;
|
|
@@ -188,4 +199,4 @@ export async function runWizard(config, runOptions = {}) {
|
|
|
188
199
|
currentIndex += 1;
|
|
189
200
|
}
|
|
190
201
|
return answers;
|
|
191
|
-
}
|
|
202
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { z } from '../../utils/effectSchema.js';
|
|
2
|
+
/** Input accepted by getActiveListings. */
|
|
3
|
+
export const getActiveListingsSchema = z.object({
|
|
4
|
+
page: z.number().optional().describe('Page number, defaulting to 1'),
|
|
5
|
+
entriesPerPage: z.number().optional().describe('Items per page, defaulting to 50'),
|
|
6
|
+
});
|
|
7
|
+
/** Input accepted by getListing. */
|
|
8
|
+
export const getListingSchema = z.object({
|
|
9
|
+
itemId: z.string().describe('The eBay item ID to retrieve'),
|
|
10
|
+
});
|
|
11
|
+
/** Input accepted by createListing. */
|
|
12
|
+
export const createListingSchema = z.object({
|
|
13
|
+
item: z.record(z.unknown()).describe('Trading API Item payload for AddFixedPriceItem'),
|
|
14
|
+
});
|
|
15
|
+
/** Input accepted by reviseListing. */
|
|
16
|
+
export const reviseListingSchema = z.object({
|
|
17
|
+
itemId: z.string().describe('The eBay item ID to revise'),
|
|
18
|
+
fields: z.record(z.unknown()).describe('Trading API Item fields to update'),
|
|
19
|
+
});
|
|
20
|
+
/** Input accepted by endListing. */
|
|
21
|
+
export const endListingSchema = z.object({
|
|
22
|
+
itemId: z.string().describe('The eBay item ID to end'),
|
|
23
|
+
reason: z
|
|
24
|
+
.enum(['NotAvailable', 'Incorrect', 'LostOrBroken', 'OtherListingError', 'SellToHighBidder'])
|
|
25
|
+
.optional()
|
|
26
|
+
.describe('Trading API ending reason, defaulting to NotAvailable'),
|
|
27
|
+
});
|
|
28
|
+
/** Input accepted by relistItem. */
|
|
29
|
+
export const relistItemSchema = z.object({
|
|
30
|
+
itemId: z.string().describe('The eBay item ID to relist'),
|
|
31
|
+
modifications: z
|
|
32
|
+
.record(z.unknown())
|
|
33
|
+
.optional()
|
|
34
|
+
.describe('Optional Trading API Item fields to change while relisting'),
|
|
35
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-safe object guard for unknown JSON-like values.
|
|
3
|
+
*
|
|
4
|
+
* @param value - Unknown value to narrow.
|
|
5
|
+
* @returns True when the value is a non-array object.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```ts
|
|
9
|
+
* if (isRecord(value)) return value.id;
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const isRecord = (value) => typeof value === 'object' && value !== null && !Array.isArray(value);
|
package/build/utils/version.js
CHANGED
|
@@ -2,50 +2,65 @@ import { readFileSync } from 'fs';
|
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
import updateNotifier from 'update-notifier';
|
|
5
|
+
import { Effect, Either } from 'effect';
|
|
5
6
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
7
|
const __dirname = dirname(__filename);
|
|
7
8
|
const PACKAGE_JSON_PATH = join(__dirname, '../../package.json');
|
|
8
9
|
let cachedPackageJson = null;
|
|
9
|
-
|
|
10
|
+
const isPackageJson = (value) => {
|
|
10
11
|
if (typeof value !== 'object' || value === null) {
|
|
11
12
|
return false;
|
|
12
13
|
}
|
|
13
14
|
return (typeof Reflect.get(value, 'name') === 'string' &&
|
|
14
15
|
typeof Reflect.get(value, 'version') === 'string');
|
|
15
|
-
}
|
|
16
|
+
};
|
|
16
17
|
/**
|
|
17
18
|
* Reads and caches package metadata used by version helpers.
|
|
19
|
+
*
|
|
20
|
+
* @returns Parsed package metadata, or a fallback package identity.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* const pkg = getPackageJson();
|
|
25
|
+
* ```
|
|
18
26
|
*/
|
|
19
|
-
export
|
|
27
|
+
export const getPackageJson = () => {
|
|
20
28
|
if (cachedPackageJson) {
|
|
21
29
|
return cachedPackageJson;
|
|
22
30
|
}
|
|
23
|
-
try
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
cachedPackageJson = { name: 'ebay-mcp', version: '0.0.0' };
|
|
31
|
+
const loaded = Effect.runSync(Effect.either(Effect.try({
|
|
32
|
+
try: () => JSON.parse(readFileSync(PACKAGE_JSON_PATH, 'utf-8')),
|
|
33
|
+
catch: (error) => error,
|
|
34
|
+
})));
|
|
35
|
+
if (Either.isRight(loaded) && isPackageJson(loaded.right)) {
|
|
36
|
+
cachedPackageJson = loaded.right;
|
|
31
37
|
return cachedPackageJson;
|
|
32
38
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
39
|
+
cachedPackageJson = { name: 'ebay-mcp', version: '0.0.0' };
|
|
40
|
+
return cachedPackageJson;
|
|
41
|
+
};
|
|
37
42
|
/**
|
|
38
43
|
* Returns the package version from package.json.
|
|
44
|
+
*
|
|
45
|
+
* @returns Current package version.
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const version = getVersion();
|
|
50
|
+
* ```
|
|
39
51
|
*/
|
|
40
|
-
export
|
|
41
|
-
return getPackageJson().version;
|
|
42
|
-
}
|
|
52
|
+
export const getVersion = () => getPackageJson().version;
|
|
43
53
|
/**
|
|
44
54
|
* Returns the package name from package.json.
|
|
55
|
+
*
|
|
56
|
+
* @returns Current package name.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* const name = getPackageName();
|
|
61
|
+
* ```
|
|
45
62
|
*/
|
|
46
|
-
export
|
|
47
|
-
return getPackageJson().name;
|
|
48
|
-
}
|
|
63
|
+
export const getPackageName = () => getPackageJson().name;
|
|
49
64
|
const ONE_DAY_MS = 1000 * 60 * 60 * 24;
|
|
50
65
|
/**
|
|
51
66
|
* Surface a "newer version available" box in an interactive terminal — the
|
|
@@ -58,8 +73,16 @@ const ONE_DAY_MS = 1000 * 60 * 60 * 24;
|
|
|
58
73
|
* stdio); that path uses {@link getCachedUpdateNotice} instead. Dropping the
|
|
59
74
|
* old custom `message` lets update-notifier render its default colorized
|
|
60
75
|
* template (dim current → green latest, cyan command).
|
|
76
|
+
*
|
|
77
|
+
* @param options - Update-notifier options used by CLI/server callers.
|
|
78
|
+
* @returns Nothing; delegates display to update-notifier.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```ts
|
|
82
|
+
* checkForUpdates({ defer: true });
|
|
83
|
+
* ```
|
|
61
84
|
*/
|
|
62
|
-
export
|
|
85
|
+
export const checkForUpdates = (options = {}) => {
|
|
63
86
|
const pkg = getPackageJson();
|
|
64
87
|
const notifier = updateNotifier({
|
|
65
88
|
pkg,
|
|
@@ -70,7 +93,7 @@ export function checkForUpdates(options = {}) {
|
|
|
70
93
|
isGlobal: true,
|
|
71
94
|
defer: options.defer ?? false,
|
|
72
95
|
});
|
|
73
|
-
}
|
|
96
|
+
};
|
|
74
97
|
/**
|
|
75
98
|
* Build a one-line "update available" notice from update-notifier's cached
|
|
76
99
|
* daily check, for contexts with no TTY where {@link checkForUpdates} stays
|
|
@@ -82,8 +105,15 @@ export function checkForUpdates(options = {}) {
|
|
|
82
105
|
* hot path. Returns `undefined` when already current, or before the first
|
|
83
106
|
* background check has populated the cache (so the notice appears from the
|
|
84
107
|
* second run onward — update-notifier's normal behavior).
|
|
108
|
+
*
|
|
109
|
+
* @returns One-line update notice for stderr logging, or undefined when absent.
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```ts
|
|
113
|
+
* const notice = getCachedUpdateNotice();
|
|
114
|
+
* ```
|
|
85
115
|
*/
|
|
86
|
-
export
|
|
116
|
+
export const getCachedUpdateNotice = () => {
|
|
87
117
|
const pkg = getPackageJson();
|
|
88
118
|
const notifier = updateNotifier({
|
|
89
119
|
pkg,
|
|
@@ -91,14 +121,21 @@ export function getCachedUpdateNotice() {
|
|
|
91
121
|
});
|
|
92
122
|
const { update } = notifier;
|
|
93
123
|
if (!update || update.latest === pkg.version) {
|
|
94
|
-
return
|
|
124
|
+
return;
|
|
95
125
|
}
|
|
96
126
|
return `Update available ${pkg.version} → ${update.latest} — run \`npm i -g ${pkg.name}\` to update`;
|
|
97
|
-
}
|
|
127
|
+
};
|
|
98
128
|
/**
|
|
99
129
|
* Fetches update metadata without printing a notification.
|
|
130
|
+
*
|
|
131
|
+
* @returns Update metadata when a newer version exists, otherwise undefined.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* const info = await getUpdateInfo();
|
|
136
|
+
* ```
|
|
100
137
|
*/
|
|
101
|
-
export async
|
|
138
|
+
export const getUpdateInfo = async () => {
|
|
102
139
|
const pkg = getPackageJson();
|
|
103
140
|
const notifier = updateNotifier({
|
|
104
141
|
pkg,
|
|
@@ -112,5 +149,4 @@ export async function getUpdateInfo() {
|
|
|
112
149
|
name: pkg.name,
|
|
113
150
|
};
|
|
114
151
|
}
|
|
115
|
-
|
|
116
|
-
}
|
|
152
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ebay-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.14.0",
|
|
4
4
|
"description": "Model Context Protocol (MCP) server that exposes 100% of eBay's Sell APIs (322 tools across 270 endpoints) to AI assistants like Claude, Cursor, and Cline, covering inventory, order fulfillment, marketing, analytics, and developer tools with OAuth authentication and refresh-token support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "build/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"license": "MIT",
|
|
26
26
|
"files": [
|
|
27
27
|
"build/index.js",
|
|
28
|
-
"build/
|
|
28
|
+
"build/serverHttp.js",
|
|
29
29
|
"build/api/**/*.js",
|
|
30
30
|
"build/auth/**/*.js",
|
|
31
31
|
"build/config/**/*.js",
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"build/ui/*.html",
|
|
39
39
|
"build/types/index.js",
|
|
40
40
|
"build/types/ebay.js",
|
|
41
|
-
"build/types/
|
|
41
|
+
"build/types/ebayEnums.js",
|
|
42
42
|
"build/index.d.ts",
|
|
43
|
-
"build/
|
|
43
|
+
"build/serverHttp.d.ts",
|
|
44
44
|
"public/icons/*.png",
|
|
45
45
|
"README.md",
|
|
46
46
|
"docs/auth/production_scopes.json",
|
|
@@ -58,11 +58,12 @@
|
|
|
58
58
|
"@modelcontextprotocol/ext-apps": "1.7.4",
|
|
59
59
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
60
60
|
"chalk": "^5.6.2",
|
|
61
|
-
"commander": "^15.0.0",
|
|
62
61
|
"cors": "^2.8.6",
|
|
63
62
|
"dotenv": "^17.4.2",
|
|
64
63
|
"dotenv-stringify": "^3.0.1",
|
|
64
|
+
"effect": "^3.21.4",
|
|
65
65
|
"express": "^5.2.1",
|
|
66
|
+
"fast-xml-builder": "1.2.0",
|
|
66
67
|
"fast-xml-parser": "^5.9.0",
|
|
67
68
|
"helmet": "^8.2.0",
|
|
68
69
|
"jose": "^6.2.3",
|
|
@@ -102,20 +103,21 @@
|
|
|
102
103
|
},
|
|
103
104
|
"scripts": {
|
|
104
105
|
"build": "tsc && tsc-alias && npm run build:ui",
|
|
105
|
-
"build:ui": "tsx src/scripts/
|
|
106
|
+
"build:ui": "tsx src/scripts/buildUi.ts",
|
|
106
107
|
"start": "node build/index.js",
|
|
107
108
|
"dev": "tsx src/index.ts",
|
|
108
109
|
"test": "vitest run",
|
|
109
110
|
"test:coverage": "vitest run --coverage",
|
|
110
|
-
"test:integration": "vitest run --config vitest.integration.config.
|
|
111
|
+
"test:integration": "vitest run --config vitest.integration.config.cts",
|
|
111
112
|
"setup": "tsx src/scripts/setup.ts",
|
|
112
113
|
"skills": "tsx src/scripts/skills.ts",
|
|
113
|
-
"sync": "tsx src/scripts/
|
|
114
|
+
"sync": "tsx src/scripts/devSync.ts",
|
|
114
115
|
"diagnose": "tsx src/scripts/diagnostics.ts",
|
|
115
116
|
"typecheck": "tsc --noEmit",
|
|
116
117
|
"typecheck:ui": "tsc -p ui/tsconfig.json --noEmit",
|
|
117
118
|
"check": "tsc --noEmit && tsc -p ui/tsconfig.json --noEmit && biome check \"{src,ui}/**/*.{ts,tsx,js,json,md,css,html}\"",
|
|
118
119
|
"check:ci": "biome ci .",
|
|
120
|
+
"verify": "npm run check:ci && npm run typecheck && npm run typecheck:ui && npm run test && npm run build",
|
|
119
121
|
"fix": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true \"{src,ui}/**/*.{ts,tsx,js,json,md,css,html}\"",
|
|
120
122
|
"lint": "biome check .",
|
|
121
123
|
"lint:fix": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true .",
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
import { XMLBuilder, XMLParser } from 'fast-xml-parser';
|
|
2
|
-
import { getBaseUrl } from '../config/environment.js';
|
|
3
|
-
import { httpRequest } from '../utils/http.js';
|
|
4
|
-
import { apiLogger } from '../utils/logger.js';
|
|
5
|
-
import { isRecord } from '../utils/type-guards.js';
|
|
6
|
-
const COMPAT_LEVEL = '1451';
|
|
7
|
-
const SITE_ID = '0';
|
|
8
|
-
/**
|
|
9
|
-
* XML-based client for eBay Trading API calls that are not covered by REST APIs.
|
|
10
|
-
*/
|
|
11
|
-
export class TradingApiClient {
|
|
12
|
-
restClient;
|
|
13
|
-
baseUrl;
|
|
14
|
-
parser;
|
|
15
|
-
builder;
|
|
16
|
-
constructor(restClient) {
|
|
17
|
-
this.restClient = restClient;
|
|
18
|
-
const config = restClient.getConfig();
|
|
19
|
-
this.baseUrl = getBaseUrl(config.environment, config.apiBaseUrl);
|
|
20
|
-
this.parser = new XMLParser({
|
|
21
|
-
ignoreAttributes: false,
|
|
22
|
-
removeNSPrefix: true,
|
|
23
|
-
parseTagValue: true,
|
|
24
|
-
isArray: (_name) => {
|
|
25
|
-
const arrayTags = [
|
|
26
|
-
'Item',
|
|
27
|
-
'Errors',
|
|
28
|
-
'Error',
|
|
29
|
-
'NameValueList',
|
|
30
|
-
'Value',
|
|
31
|
-
'ShippingServiceOptions',
|
|
32
|
-
'InternationalShippingServiceOption',
|
|
33
|
-
'PaymentMethods',
|
|
34
|
-
'PictureURL',
|
|
35
|
-
'CompatibilityList',
|
|
36
|
-
'Variation',
|
|
37
|
-
];
|
|
38
|
-
return arrayTags.includes(_name);
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
this.builder = new XMLBuilder({
|
|
42
|
-
ignoreAttributes: false,
|
|
43
|
-
format: true,
|
|
44
|
-
suppressEmptyNode: true,
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* Return the Trading API base URL for the configured eBay environment.
|
|
49
|
-
*/
|
|
50
|
-
getTradingBaseUrl() {
|
|
51
|
-
return this.baseUrl;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Execute a named Trading API call with XML request/response conversion.
|
|
55
|
-
*/
|
|
56
|
-
async execute(callName, params) {
|
|
57
|
-
const requestTag = `${callName}Request`;
|
|
58
|
-
const responseTag = `${callName}Response`;
|
|
59
|
-
const xmlObj = {};
|
|
60
|
-
xmlObj[requestTag] = {
|
|
61
|
-
'@_xmlns': 'urn:ebay:apis:eBLBaseComponents',
|
|
62
|
-
...params,
|
|
63
|
-
};
|
|
64
|
-
const xmlBody = `<?xml version="1.0" encoding="utf-8"?>\n${this.builder.build(xmlObj)}`;
|
|
65
|
-
apiLogger.debug(`Trading API ${callName}`, { xmlBody });
|
|
66
|
-
const headers = {
|
|
67
|
-
'X-EBAY-API-SITEID': SITE_ID,
|
|
68
|
-
'X-EBAY-API-COMPATIBILITY-LEVEL': COMPAT_LEVEL,
|
|
69
|
-
'X-EBAY-API-CALL-NAME': callName,
|
|
70
|
-
'Content-Type': 'text/xml',
|
|
71
|
-
};
|
|
72
|
-
// Proxy auth mode: omit the IAF token and skip token acquisition — the proxy
|
|
73
|
-
// injects the credential the Trading API requires.
|
|
74
|
-
if (!this.restClient.getConfig().disableAuthHeader) {
|
|
75
|
-
headers['X-EBAY-API-IAF-TOKEN'] = await this.restClient.getOAuthClient().getAccessToken();
|
|
76
|
-
}
|
|
77
|
-
let responseXml;
|
|
78
|
-
try {
|
|
79
|
-
const response = await httpRequest({
|
|
80
|
-
method: 'POST',
|
|
81
|
-
url: `${this.baseUrl}/ws/api.dll`,
|
|
82
|
-
headers,
|
|
83
|
-
body: xmlBody,
|
|
84
|
-
timeoutMs: 30000,
|
|
85
|
-
responseType: 'text',
|
|
86
|
-
});
|
|
87
|
-
responseXml = response.data;
|
|
88
|
-
}
|
|
89
|
-
catch (error) {
|
|
90
|
-
const message = error instanceof Error ? error.message : 'Unknown HTTP error';
|
|
91
|
-
throw new Error(`Trading API ${callName} request failed: ${message}`);
|
|
92
|
-
}
|
|
93
|
-
let parsed;
|
|
94
|
-
try {
|
|
95
|
-
const parsedValue = this.parser.parse(responseXml);
|
|
96
|
-
if (!isRecord(parsedValue)) {
|
|
97
|
-
throw new Error('Trading API response must be an object');
|
|
98
|
-
}
|
|
99
|
-
parsed = parsedValue;
|
|
100
|
-
}
|
|
101
|
-
catch (e) {
|
|
102
|
-
throw new Error(`Failed to parse Trading API ${callName} response: ${e instanceof Error ? e.message : String(e)}`);
|
|
103
|
-
}
|
|
104
|
-
const resultValue = parsed[responseTag] || parsed;
|
|
105
|
-
if (!isRecord(resultValue)) {
|
|
106
|
-
throw new Error(`Trading API ${callName} response payload is not an object`);
|
|
107
|
-
}
|
|
108
|
-
const result = resultValue;
|
|
109
|
-
// Log warnings without failing
|
|
110
|
-
if (result.Ack === 'Warning') {
|
|
111
|
-
apiLogger.warn(`Trading API ${callName} returned warnings`, {
|
|
112
|
-
errors: result.Errors,
|
|
113
|
-
});
|
|
114
|
-
}
|
|
115
|
-
// Check for eBay errors
|
|
116
|
-
if (result.Ack === 'Failure' || result.Ack === 'PartialFailure') {
|
|
117
|
-
const errors = result.Errors;
|
|
118
|
-
const firstError = Array.isArray(errors) ? errors[0] : errors;
|
|
119
|
-
const message = firstError?.ShortMessage || firstError?.LongMessage || 'Unknown Trading API error';
|
|
120
|
-
throw new Error(message);
|
|
121
|
-
}
|
|
122
|
-
return result;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
import { buildValidatedPaginatedParams, getWithApiError, requireString, } from '../shared/request.js';
|
|
2
|
-
/**
|
|
3
|
-
* Build validated pagination query params.
|
|
4
|
-
*
|
|
5
|
-
* @param filter API filter expression.
|
|
6
|
-
* @param limit Maximum number of records.
|
|
7
|
-
* @param offset Zero-based pagination offset.
|
|
8
|
-
* @returns Query parameter object for paginated GET calls.
|
|
9
|
-
*/
|
|
10
|
-
export function buildPaginatedQueryParams(filter, limit, offset) {
|
|
11
|
-
return buildValidatedPaginatedParams(filter, limit, offset);
|
|
12
|
-
}
|
|
13
|
-
/**
|
|
14
|
-
* Validate that a required parameter is a non-empty string.
|
|
15
|
-
*
|
|
16
|
-
* @param value Value to validate.
|
|
17
|
-
* @param paramName Parameter name used in error text.
|
|
18
|
-
*/
|
|
19
|
-
export function assertRequiredString(value, paramName) {
|
|
20
|
-
requireString(value, paramName);
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Perform a GET request and wrap errors with endpoint-specific context.
|
|
24
|
-
*
|
|
25
|
-
* @param client Configured eBay API client.
|
|
26
|
-
* @param path Endpoint path to request.
|
|
27
|
-
* @param failureMessage Prefix text for thrown error messages.
|
|
28
|
-
* @returns API response payload.
|
|
29
|
-
*/
|
|
30
|
-
export async function getPathWithContextError(client, path, failureMessage) {
|
|
31
|
-
return await getWithApiError(client, path, failureMessage);
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Perform a GET request with query params and wrap errors with endpoint-specific context.
|
|
35
|
-
*
|
|
36
|
-
* @param client Configured eBay API client.
|
|
37
|
-
* @param path Endpoint path to request.
|
|
38
|
-
* @param params Query parameters sent with the request.
|
|
39
|
-
* @param failureMessage Prefix text for thrown error messages.
|
|
40
|
-
* @returns API response payload.
|
|
41
|
-
*/
|
|
42
|
-
export async function getWithContextError(client, path, params, failureMessage) {
|
|
43
|
-
return await getWithApiError(client, path, failureMessage, params);
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Perform a paginated GET request with validated filter/limit/offset params.
|
|
47
|
-
*
|
|
48
|
-
* @param client Configured eBay API client.
|
|
49
|
-
* @param path Endpoint path to request.
|
|
50
|
-
* @param failureMessage Prefix text for thrown error messages.
|
|
51
|
-
* @param filter API filter expression.
|
|
52
|
-
* @param limit Maximum number of records.
|
|
53
|
-
* @param offset Zero-based pagination offset.
|
|
54
|
-
* @returns API response payload.
|
|
55
|
-
*/
|
|
56
|
-
export async function getPaginatedWithContextError(client, path, failureMessage, filter, limit, offset) {
|
|
57
|
-
const params = buildPaginatedQueryParams(filter, limit, offset);
|
|
58
|
-
return await getWithContextError(client, path, params, failureMessage);
|
|
59
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Build legacy paginated query parameters, omitting falsy values.
|
|
3
|
-
*/
|
|
4
|
-
export function buildTruthyPaginatedParams(filter, limit, offset) {
|
|
5
|
-
const params = {};
|
|
6
|
-
if (filter) {
|
|
7
|
-
params.filter = filter;
|
|
8
|
-
}
|
|
9
|
-
if (limit) {
|
|
10
|
-
params.limit = limit;
|
|
11
|
-
}
|
|
12
|
-
if (offset) {
|
|
13
|
-
params.offset = offset;
|
|
14
|
-
}
|
|
15
|
-
return params;
|
|
16
|
-
}
|