ebay-mcp 1.14.1 → 1.14.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 +1 -0
- package/build/api/clientTrading.js +2 -3
- package/build/config/environment.js +56 -0
- package/build/scripts/devSync.js +28 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -234,6 +234,7 @@ EBAY_CLIENT_SECRET=your_client_secret
|
|
|
234
234
|
EBAY_ENVIRONMENT=sandbox # or "production"
|
|
235
235
|
EBAY_REDIRECT_URI=your_runame
|
|
236
236
|
EBAY_MARKETPLACE_ID=EBAY_US # default marketplace (overridable per tool)
|
|
237
|
+
# EBAY_SITE_ID=0 # Trading API site override; defaults from EBAY_MARKETPLACE_ID
|
|
237
238
|
EBAY_CONTENT_LANGUAGE=en-US # default request content language
|
|
238
239
|
EBAY_USER_REFRESH_TOKEN=your_token # for higher rate limits
|
|
239
240
|
EBAY_MCP_UI=on # interactive MCP Apps views (beta); "off" forces plain JSON
|
|
@@ -2,19 +2,18 @@ import XmlBuilder from 'fast-xml-builder';
|
|
|
2
2
|
import { XMLParser } from 'fast-xml-parser';
|
|
3
3
|
import { TradingApiFailure } from '../api/clientTradingError.js';
|
|
4
4
|
import { EbayApiError } from '../api/shared/request.js';
|
|
5
|
-
import { getBaseUrl } from '../config/environment.js';
|
|
5
|
+
import { getBaseUrl, getTradingSiteId } from '../config/environment.js';
|
|
6
6
|
import { getErrorMessage } from '../utils/errors.js';
|
|
7
7
|
import { httpRequestEffect } from '../utils/http.js';
|
|
8
8
|
import { apiLogger } from '../utils/logger.js';
|
|
9
9
|
import { isRecord } from '../utils/typeGuards.js';
|
|
10
10
|
import { Effect } from 'effect';
|
|
11
11
|
const COMPAT_LEVEL = '1451';
|
|
12
|
-
const SITE_ID = '0';
|
|
13
12
|
const TRADING_ENDPOINT_PATH = '/ws/api.dll';
|
|
14
13
|
const TRADING_XMLNS = 'urn:ebay:apis:eBLBaseComponents';
|
|
15
14
|
const buildTradingPath = (baseUrl) => `${baseUrl}${TRADING_ENDPOINT_PATH}`;
|
|
16
15
|
const buildTradingHeaders = (callName) => ({
|
|
17
|
-
'X-EBAY-API-SITEID':
|
|
16
|
+
'X-EBAY-API-SITEID': getTradingSiteId(),
|
|
18
17
|
'X-EBAY-API-COMPATIBILITY-LEVEL': COMPAT_LEVEL,
|
|
19
18
|
'X-EBAY-API-CALL-NAME': callName,
|
|
20
19
|
'Content-Type': 'text/xml',
|
|
@@ -219,6 +219,62 @@ export const getEbayConfig = () => {
|
|
|
219
219
|
disableAuthHeader,
|
|
220
220
|
};
|
|
221
221
|
};
|
|
222
|
+
/**
|
|
223
|
+
* Trading API site IDs for each REST marketplace ID.
|
|
224
|
+
*
|
|
225
|
+
* The Trading API predates the REST marketplace IDs and identifies a site with
|
|
226
|
+
* a numeric `X-EBAY-API-SITEID` header instead. The mapping is fixed by eBay.
|
|
227
|
+
*
|
|
228
|
+
* @see https://developer.ebay.com/devzone/merchandising/docs/CallRef/Enums/GlobalIdList.html
|
|
229
|
+
*/
|
|
230
|
+
const TRADING_SITE_IDS = {
|
|
231
|
+
EBAY_AT: '16',
|
|
232
|
+
EBAY_AU: '15',
|
|
233
|
+
EBAY_BE: '23',
|
|
234
|
+
EBAY_CA: '2',
|
|
235
|
+
EBAY_CH: '193',
|
|
236
|
+
EBAY_DE: '77',
|
|
237
|
+
EBAY_ES: '186',
|
|
238
|
+
EBAY_FR: '71',
|
|
239
|
+
EBAY_GB: '3',
|
|
240
|
+
EBAY_HK: '201',
|
|
241
|
+
EBAY_IE: '205',
|
|
242
|
+
EBAY_IN: '203',
|
|
243
|
+
EBAY_IT: '101',
|
|
244
|
+
EBAY_MY: '207',
|
|
245
|
+
EBAY_NL: '146',
|
|
246
|
+
EBAY_PH: '211',
|
|
247
|
+
EBAY_PL: '212',
|
|
248
|
+
EBAY_SG: '216',
|
|
249
|
+
EBAY_US: '0',
|
|
250
|
+
};
|
|
251
|
+
const DEFAULT_TRADING_SITE_ID = '0';
|
|
252
|
+
/**
|
|
253
|
+
* Get the Trading API site ID for the configured marketplace.
|
|
254
|
+
*
|
|
255
|
+
* Derived from `EBAY_MARKETPLACE_ID` so a single setting drives both REST and
|
|
256
|
+
* Trading traffic. `EBAY_SITE_ID` overrides it for sites this map does not
|
|
257
|
+
* cover, or when REST and Trading must target different sites.
|
|
258
|
+
*
|
|
259
|
+
* Listing on a non-US site with the wrong site ID fails at eBay: the currency
|
|
260
|
+
* belongs to the marketplace, so an EUR listing sent to site 0 is rejected
|
|
261
|
+
* with "Invalid auction currency".
|
|
262
|
+
*
|
|
263
|
+
* @returns Numeric Trading API site ID sent as `X-EBAY-API-SITEID`.
|
|
264
|
+
* @example
|
|
265
|
+
* ```ts
|
|
266
|
+
* // EBAY_MARKETPLACE_ID=EBAY_DE
|
|
267
|
+
* const siteId = getTradingSiteId(); // '77'
|
|
268
|
+
* ```
|
|
269
|
+
*/
|
|
270
|
+
export const getTradingSiteId = () => {
|
|
271
|
+
const override = (process.env.EBAY_SITE_ID ?? '').trim();
|
|
272
|
+
if (override !== '') {
|
|
273
|
+
return override;
|
|
274
|
+
}
|
|
275
|
+
const marketplaceId = (process.env.EBAY_MARKETPLACE_ID ?? '').trim() || 'EBAY_US';
|
|
276
|
+
return TRADING_SITE_IDS[marketplaceId] ?? DEFAULT_TRADING_SITE_ID;
|
|
277
|
+
};
|
|
222
278
|
/**
|
|
223
279
|
* Get the eBay REST API base URL for the configured environment.
|
|
224
280
|
*
|
package/build/scripts/devSync.js
CHANGED
|
@@ -330,28 +330,28 @@ const KNOWN_OPERATION_MAPPINGS = {
|
|
|
330
330
|
// Feedback API
|
|
331
331
|
getitemsawaitingfeedback: ['ebay_get_awaiting_feedback'],
|
|
332
332
|
leavefeedback: ['ebay_leave_feedback_for_buyer'],
|
|
333
|
-
// Notification API
|
|
333
|
+
// Notification API — tools use the ebay_*_notification_* naming convention
|
|
334
334
|
getconfig: ['ebay_get_notification_config'],
|
|
335
335
|
updateconfig: ['ebay_update_notification_config'],
|
|
336
|
-
getdestinations: ['
|
|
337
|
-
createdestination: ['
|
|
338
|
-
getdestination: ['
|
|
339
|
-
updatedestination: ['
|
|
340
|
-
deletedestination: ['
|
|
341
|
-
getsubscriptions: ['
|
|
342
|
-
createsubscription: ['
|
|
343
|
-
getsubscription: ['
|
|
344
|
-
updatesubscription: ['
|
|
345
|
-
deletesubscription: ['
|
|
346
|
-
disablesubscription: ['
|
|
347
|
-
enablesubscription: ['
|
|
348
|
-
testsubscription: ['
|
|
349
|
-
createsubscriptionfilter: ['
|
|
350
|
-
getsubscriptionfilter: ['
|
|
351
|
-
deletesubscriptionfilter: ['
|
|
352
|
-
gettopic: ['
|
|
353
|
-
gettopics: ['
|
|
354
|
-
getpublickey: ['
|
|
336
|
+
getdestinations: ['ebay_get_notification_destinations'],
|
|
337
|
+
createdestination: ['ebay_create_notification_destination'],
|
|
338
|
+
getdestination: ['ebay_get_notification_destination'],
|
|
339
|
+
updatedestination: ['ebay_update_notification_destination'],
|
|
340
|
+
deletedestination: ['ebay_delete_notification_destination'],
|
|
341
|
+
getsubscriptions: ['ebay_get_notification_subscriptions'],
|
|
342
|
+
createsubscription: ['ebay_create_notification_subscription'],
|
|
343
|
+
getsubscription: ['ebay_get_notification_subscription'],
|
|
344
|
+
updatesubscription: ['ebay_update_notification_subscription'],
|
|
345
|
+
deletesubscription: ['ebay_delete_notification_subscription'],
|
|
346
|
+
disablesubscription: ['ebay_disable_notification_subscription'],
|
|
347
|
+
enablesubscription: ['ebay_enable_notification_subscription'],
|
|
348
|
+
testsubscription: ['ebay_test_notification_subscription'],
|
|
349
|
+
createsubscriptionfilter: ['ebay_create_notification_subscription_filter'],
|
|
350
|
+
getsubscriptionfilter: ['ebay_get_notification_subscription_filter'],
|
|
351
|
+
deletesubscriptionfilter: ['ebay_delete_notification_subscription_filter'],
|
|
352
|
+
gettopic: ['ebay_get_notification_topic'],
|
|
353
|
+
gettopics: ['ebay_get_notification_topics'],
|
|
354
|
+
getpublickey: ['ebay_get_notification_public_key'],
|
|
355
355
|
// Negotiation API
|
|
356
356
|
findeligibleitems: ['ebay_find_eligible_items'],
|
|
357
357
|
// Marketing API
|
|
@@ -397,10 +397,15 @@ function getImplementedApiMethods() {
|
|
|
397
397
|
catch: (error) => error,
|
|
398
398
|
})));
|
|
399
399
|
if (Either.isRight(source)) {
|
|
400
|
-
// Match
|
|
401
|
-
|
|
400
|
+
// Match async methods and class-field arrow endpoints (`name = (` / `public name = (`).
|
|
401
|
+
// Many area classes omit the `public` keyword (notification, trading, feedback, …).
|
|
402
|
+
const methodMatches = source.right.matchAll(/(?:async\s+(\w+)\s*\(|(?:public\s+)?(\w+)\s*=\s*(?:async\s*)?\()/g);
|
|
402
403
|
for (const match of methodMatches) {
|
|
403
|
-
|
|
404
|
+
const name = match[1] ?? match[2];
|
|
405
|
+
// Skip common non-method bindings that the broader regex can catch.
|
|
406
|
+
if (!name || name === 'const' || name === 'let' || name === 'var')
|
|
407
|
+
continue;
|
|
408
|
+
methods.add(normalizeForMatching(name));
|
|
404
409
|
}
|
|
405
410
|
}
|
|
406
411
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ebay-mcp",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.2",
|
|
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",
|