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.
Files changed (169) hide show
  1. package/README.de.md +3 -3
  2. package/README.es.md +3 -3
  3. package/README.fr.md +3 -3
  4. package/README.ja.md +3 -3
  5. package/README.ko.md +3 -3
  6. package/README.md +163 -41
  7. package/README.pt-BR.md +3 -3
  8. package/README.ru.md +3 -3
  9. package/README.zh-CN.md +3 -3
  10. package/build/api/account-management/account.js +633 -297
  11. package/build/api/analytics-and-report/analytics.js +111 -65
  12. package/build/api/client.js +199 -140
  13. package/build/api/clientRequestError.js +23 -0
  14. package/build/api/clientTrading.js +213 -0
  15. package/build/api/clientTradingError.js +4 -0
  16. package/build/api/communication/feedback.js +147 -59
  17. package/build/api/communication/message.js +134 -81
  18. package/build/api/communication/negotiation.js +65 -53
  19. package/build/api/communication/notification.js +458 -164
  20. package/build/api/developer/developer.js +99 -45
  21. package/build/api/index.js +23 -8
  22. package/build/api/listing-management/inventory.js +884 -338
  23. package/build/api/listing-metadata/metadata.js +416 -170
  24. package/build/api/listing-metadata/taxonomy.js +187 -42
  25. package/build/api/marketing-and-promotions/marketing.js +1392 -598
  26. package/build/api/marketing-and-promotions/recommendation.js +49 -24
  27. package/build/api/order-management/dispute.js +226 -45
  28. package/build/api/order-management/fulfillment.js +144 -71
  29. package/build/api/order-management/orderIssueHelpers.js +61 -0
  30. package/build/api/other/compliance.js +50 -38
  31. package/build/api/other/edelivery.js +603 -159
  32. package/build/api/other/finding.js +280 -0
  33. package/build/api/other/identity.js +30 -15
  34. package/build/api/other/translation.js +29 -14
  35. package/build/api/other/vero.js +113 -27
  36. package/build/api/rateLimitTracker.js +55 -0
  37. package/build/api/shared/request.js +189 -98
  38. package/build/api/trading/trading.js +154 -87
  39. package/build/auth/credentialSession.js +250 -0
  40. package/build/auth/oauth.js +298 -171
  41. package/build/auth/{oauth-metadata.js → oauthMetadata.js} +22 -6
  42. package/build/auth/oauthMiddleware.js +104 -0
  43. package/build/auth/{scope-utils.js → scopeUtils.js} +101 -28
  44. package/build/auth/tokenVerifier.js +243 -0
  45. package/build/auth/tokenVerifierError.js +21 -0
  46. package/build/config/environment.js +148 -113
  47. package/build/config/{tool-families.js → toolFamilies.js} +30 -14
  48. package/build/index.js +25 -19
  49. package/build/mcp/{http-transport.js → httpTransport.js} +102 -52
  50. package/build/mcp/readOnlyFilter.js +67 -0
  51. package/build/mcp/runtime.js +31 -13
  52. package/build/mcp/{tool-gating.js → toolGating.js} +77 -49
  53. package/build/mcp/{ui-bridge.js → uiBridge.js} +80 -23
  54. package/build/schemas/account-management/account.js +144 -6
  55. package/build/schemas/analytics/analytics.js +33 -19
  56. package/build/schemas/communication/messages.js +12 -42
  57. package/build/schemas/developer/developer.js +135 -0
  58. package/build/schemas/fulfillment/orders.js +183 -21
  59. package/build/schemas/index.js +27 -19
  60. package/build/schemas/inventory-management/inventory.js +17 -9
  61. package/build/schemas/marketing/marketing.js +480 -25
  62. package/build/schemas/metadata/metadata.js +11 -6
  63. package/build/schemas/other/finding.js +27 -0
  64. package/build/schemas/other/otherApis.js +424 -0
  65. package/build/schemas/taxonomy/taxonomy.js +11 -5
  66. package/build/scripts/{auto-setup.js → autoSetup.js} +87 -74
  67. package/build/scripts/{build-ui.js → buildUi.js} +6 -1
  68. package/build/scripts/{dev-sync.js → devSync.js} +169 -110
  69. package/build/scripts/diagnostics.js +52 -44
  70. package/build/scripts/{download-specs.js → downloadSpecs.js} +29 -21
  71. package/build/scripts/{interactive-setup.js → interactiveSetup.js} +84 -78
  72. package/build/scripts/setup.js +241 -178
  73. package/build/scripts/{setup-shared.js → setupShared.js} +29 -7
  74. package/build/scripts/skills.js +35 -27
  75. package/build/scripts/updateApiStatusDoc.js +71 -0
  76. package/build/serverHttp.js +90 -0
  77. package/build/skills/content.js +124 -118
  78. package/build/skills/index.js +22 -10
  79. package/build/skills/install.js +21 -10
  80. package/build/skills/markers.js +50 -15
  81. package/build/skills/{registry-snapshot.js → registrySnapshot.js} +8 -2
  82. package/build/skills/render.js +41 -14
  83. package/build/skills/targets.js +49 -17
  84. package/build/tools/categories/account.js +166 -264
  85. package/build/tools/categories/analytics.js +11 -22
  86. package/build/tools/categories/browse.js +17 -0
  87. package/build/tools/categories/communication.js +124 -399
  88. package/build/tools/categories/connector.js +23 -20
  89. package/build/tools/categories/developer.js +46 -159
  90. package/build/tools/categories/fulfillment.js +84 -215
  91. package/build/tools/categories/index.js +6 -14
  92. package/build/tools/categories/inventory.js +238 -293
  93. package/build/tools/categories/marketing.js +677 -39
  94. package/build/tools/categories/metadata.js +190 -117
  95. package/build/tools/categories/other.js +81 -208
  96. package/build/tools/categories/taxonomy.js +29 -20
  97. package/build/tools/categories/{token-management.js → tokenManagement.js} +187 -192
  98. package/build/tools/categories/trading.js +16 -47
  99. package/build/tools/contracts.js +34 -24
  100. package/build/tools/{define-tool.js → defineTool.js} +44 -29
  101. package/build/tools/registry.js +87 -29
  102. package/build/tools/schemas.js +3 -57
  103. package/build/tools/ui/archetypes.js +1 -0
  104. package/build/tools/ui/{map-helpers.js → mapHelpers.js} +69 -19
  105. package/build/tools/ui/maps.js +294 -80
  106. package/build/types/index.js +1 -1
  107. package/build/ui/card.html +14 -14
  108. package/build/ui/chart.html +14 -14
  109. package/build/ui/stat.html +87 -0
  110. package/build/ui/table.html +14 -14
  111. package/build/utils/apiStatusFeed.js +95 -0
  112. package/build/utils/cliOutput.js +15 -0
  113. package/build/utils/cliUi.js +108 -0
  114. package/build/utils/communication/feedback.js +57 -77
  115. package/build/utils/communication/message.js +69 -98
  116. package/build/utils/communication/negotiation.js +30 -57
  117. package/build/utils/communication/notification.js +112 -252
  118. package/build/utils/{date-converter.js → dateConverter.js} +62 -30
  119. package/build/utils/effectSchema.js +203 -0
  120. package/build/utils/effectSchemaAdapter.js +121 -0
  121. package/build/utils/effectSchemaChainMethods.js +146 -0
  122. package/build/utils/effectSchemaRefinements.js +104 -0
  123. package/build/utils/effectSchemaStringMethods.js +63 -0
  124. package/build/utils/effectSchemaTypes.js +47 -0
  125. package/build/utils/{env-parser.js → envParser.js} +10 -2
  126. package/build/utils/errors.js +7 -3
  127. package/build/utils/http.js +148 -89
  128. package/build/utils/{llm-client-detector.js → llmClientDetector.js} +295 -274
  129. package/build/utils/logger.js +127 -51
  130. package/build/utils/{oauth-helper.js → oauthHelper.js} +127 -90
  131. package/build/utils/other/compliance.js +18 -38
  132. package/build/utils/other/identity.js +2 -2
  133. package/build/utils/other/translation.js +4 -4
  134. package/build/utils/other/vero.js +36 -20
  135. package/build/utils/schemaHelpers.js +22 -0
  136. package/build/utils/scopeHelper.js +270 -0
  137. package/build/utils/securityChecker.js +316 -0
  138. package/build/utils/{setup-validator.js → setupValidator.js} +113 -94
  139. package/build/utils/{setup-wizard.js → setupWizard.js} +57 -46
  140. package/build/utils/{token-utils.js → tokenUtils.js} +2 -2
  141. package/build/utils/trading/trading.js +35 -0
  142. package/build/utils/typeGuards.js +12 -0
  143. package/build/utils/version.js +65 -29
  144. package/package.json +10 -8
  145. package/build/api/client-trading.js +0 -124
  146. package/build/api/communication/shared.js +0 -59
  147. package/build/api/shared/query-params.js +0 -16
  148. package/build/auth/credential-session.js +0 -166
  149. package/build/auth/oauth-middleware.js +0 -100
  150. package/build/auth/token-verifier.js +0 -186
  151. package/build/schemas/other/other-apis.js +0 -390
  152. package/build/scripts/update-api-status-doc.js +0 -44
  153. package/build/server-http.js +0 -85
  154. package/build/tools/definitions/marketing.js +0 -1381
  155. package/build/tools/tool-handlers/marketing.js +0 -312
  156. package/build/utils/account-management/account.js +0 -818
  157. package/build/utils/api-status-feed.js +0 -84
  158. package/build/utils/cli-ui.js +0 -47
  159. package/build/utils/order-management/dispute.js +0 -369
  160. package/build/utils/order-management/fulfillment.js +0 -205
  161. package/build/utils/other/edelivery.js +0 -235
  162. package/build/utils/schema-helpers.js +0 -13
  163. package/build/utils/scope-helper.js +0 -207
  164. package/build/utils/security-checker.js +0 -248
  165. package/build/utils/type-guards.js +0 -6
  166. /package/build/auth/{oauth-types.js → oauthTypes.js} +0 -0
  167. /package/build/{server-http.d.ts → serverHttp.d.ts} +0 -0
  168. /package/build/tools/ui/{view-models.js → viewModels.js} +0 -0
  169. /package/build/types/{ebay-enums.js → ebayEnums.js} +0 -0
@@ -23,18 +23,20 @@
23
23
  /* eslint-disable n/no-process-exit */
24
24
  import prompts from 'prompts';
25
25
  import chalk from 'chalk';
26
+ import { Effect, Either } from 'effect';
26
27
  import { writeFileSync } from 'fs';
27
28
  import { join, dirname } from 'path';
28
29
  import { fileURLToPath } from 'url';
29
- import { runSecurityChecks, displaySecurityResults, hasCriticalFailures, } from '../utils/security-checker.js';
30
- import { displayFirstTimeDeveloperGuide, getRuNameHelp, interactiveOAuthFlow, displayManualOAuthInstructions, } from '../utils/oauth-helper.js';
31
- import { displayScopeCategories, getRecommendedScopes, displayScopeVerification, } from '../utils/scope-helper.js';
32
- import { detectLLMClients, configureLLMClient } from '../utils/llm-client-detector.js';
33
- import { validateSetup, displayRecommendations } from '../utils/setup-validator.js';
34
- import { loadExistingConfig, readEnvironment } from './setup-shared.js';
30
+ import { runSecurityChecks, displaySecurityResults, hasCriticalFailures, } from '../utils/securityChecker.js';
31
+ import { displayFirstTimeDeveloperGuide, getRuNameHelp, interactiveOAuthFlow, displayManualOAuthInstructions, } from '../utils/oauthHelper.js';
32
+ import { displayScopeCategories, getRecommendedScopes, displayScopeVerification, } from '../utils/scopeHelper.js';
33
+ import { detectLLMClients, configureLLMClient } from '../utils/llmClientDetector.js';
34
+ import { validateSetup, displayRecommendations } from '../utils/setupValidator.js';
35
+ import { loadExistingConfig, readEnvironment } from './setupShared.js';
35
36
  import { EbaySellerApi } from '../api/index.js';
36
37
  import { EbayOAuthClient } from '../auth/oauth.js';
37
38
  import { getErrorMessage } from '../utils/errors.js';
39
+ import process from 'node:process';
38
40
  const __filename = fileURLToPath(import.meta.url);
39
41
  const __dirname = dirname(__filename);
40
42
  const PROJECT_ROOT = join(__dirname, '../..');
@@ -49,7 +51,7 @@ const ebayColors = {
49
51
  };
50
52
  function readOptionalEnvironment(value) {
51
53
  if (!value) {
52
- return undefined;
54
+ return;
53
55
  }
54
56
  return readEnvironment(value);
55
57
  }
@@ -169,75 +171,76 @@ async function acquireRefreshToken(config, useInteractiveFlow) {
169
171
  }
170
172
  // Exchange code for tokens
171
173
  console.log(chalk.cyan('\n🔄 Exchanging authorization code for tokens...\n'));
172
- try {
174
+ const tokenData = await Effect.runPromise(Effect.either(Effect.gen(function* () {
173
175
  const oauthClient = new EbayOAuthClient(config);
174
- const tokenData = await oauthClient.exchangeCodeForToken(authCode);
175
- console.log(chalk.green('✓ Successfully obtained tokens!\n'));
176
- return tokenData.refresh_token;
177
- }
178
- catch (error) {
179
- console.log(chalk.red(`✗ Failed to exchange code: ${getErrorMessage(error, String(error))}\n`));
176
+ return yield* oauthClient.exchangeCodeForToken(authCode);
177
+ })));
178
+ if (Either.isLeft(tokenData)) {
179
+ console.log(chalk.red(`✗ Failed to exchange code: ${getErrorMessage(tokenData.left, String(tokenData.left))}\n`));
180
180
  return null;
181
181
  }
182
+ console.log(chalk.green('✓ Successfully obtained tokens!\n'));
183
+ return tokenData.right.refresh_token;
182
184
  }
183
- else {
184
- // Manual flow
185
- displayManualOAuthInstructions(config.clientId, config.redirectUri || 'http://localhost:3000/oauth/callback', config.environment, getRecommendedScopes(config.environment));
186
- const response = await prompts({
187
- type: 'text',
188
- name: 'refreshToken',
189
- message: 'Paste your refresh token here:',
190
- validate: (value) => {
191
- if (!value || value.trim() === '') {
192
- return 'Refresh token is required';
193
- }
194
- const cleanValue = value.trim().replace(/^["']|["']$/g, '');
195
- if (!cleanValue.startsWith('v^1.1#')) {
196
- return 'Token should start with "v^1.1#"';
197
- }
198
- return true;
199
- },
200
- });
201
- if (!response.refreshToken) {
202
- return null;
203
- }
204
- return response.refreshToken.trim().replace(/^["']|["']$/g, '');
185
+ // Manual flow
186
+ displayManualOAuthInstructions(config.clientId, config.redirectUri || 'http://localhost:3000/oauth/callback', config.environment, getRecommendedScopes(config.environment));
187
+ const response = await prompts({
188
+ type: 'text',
189
+ name: 'refreshToken',
190
+ message: 'Paste your refresh token here:',
191
+ validate: (value) => {
192
+ if (!value || value.trim() === '') {
193
+ return 'Refresh token is required';
194
+ }
195
+ const cleanValue = value.trim().replace(/^["']|["']$/g, '');
196
+ if (!cleanValue.startsWith('v^1.1#')) {
197
+ return 'Token should start with "v^1.1#"';
198
+ }
199
+ return true;
200
+ },
201
+ });
202
+ if (!response.refreshToken) {
203
+ return null;
205
204
  }
205
+ return response.refreshToken.trim().replace(/^["']|["']$/g, '');
206
206
  }
207
207
  async function validateAndGenerateTokens(config) {
208
208
  console.log(chalk.bold.cyan('\n🔄 Validating Credentials & Generating Tokens...\n'));
209
- try {
209
+ const validated = await Effect.runPromise(Effect.either(Effect.gen(function* () {
210
210
  const ebayConfig = {
211
211
  clientId: config.EBAY_CLIENT_ID,
212
212
  clientSecret: config.EBAY_CLIENT_SECRET,
213
213
  redirectUri: config.EBAY_REDIRECT_URI,
214
214
  environment: readEnvironment(config.EBAY_ENVIRONMENT),
215
+ accessToken: config.EBAY_USER_ACCESS_TOKEN,
216
+ refreshToken: config.EBAY_USER_REFRESH_TOKEN,
215
217
  };
216
218
  // Set up OAuth client with refresh token
217
219
  const oauthClient = new EbayOAuthClient(ebayConfig);
218
220
  // Set the refresh token
219
221
  if (config.EBAY_USER_REFRESH_TOKEN) {
220
- // Manually set tokens to trigger initialization
221
- process.env.EBAY_USER_REFRESH_TOKEN = config.EBAY_USER_REFRESH_TOKEN;
222
- process.env.EBAY_USER_ACCESS_TOKEN = '';
223
222
  console.log(chalk.cyan(' → Initializing OAuth client...'));
224
- await oauthClient.initialize();
223
+ yield* oauthClient.initialize();
225
224
  // Get tokens (this will auto-refresh if needed)
226
225
  console.log(chalk.cyan(' → Refreshing access token from refresh token...'));
227
- const accessToken = await oauthClient.getAccessToken();
226
+ const accessToken = yield* oauthClient.getAccessToken();
228
227
  // Store the generated access token
229
228
  config.EBAY_USER_ACCESS_TOKEN = accessToken;
230
229
  console.log(chalk.green(' ✓ Access token generated successfully'));
231
230
  // Generate app access token
232
231
  console.log(chalk.cyan(' → Generating app access token...'));
233
- const appToken = await oauthClient.getOrRefreshAppAccessToken();
232
+ const appToken = yield* oauthClient.getOrRefreshAppAccessToken();
234
233
  config.EBAY_APP_ACCESS_TOKEN = appToken;
235
234
  console.log(chalk.green(' ✓ App access token generated successfully'));
236
235
  // Test with Identity API
237
236
  console.log(chalk.cyan(' → Verifying credentials with eBay Identity API...'));
238
- const api = new EbaySellerApi(ebayConfig);
239
- await api.initialize();
240
- const userInfo = await api.identity.getUser();
237
+ const api = new EbaySellerApi({
238
+ ...ebayConfig,
239
+ accessToken,
240
+ appAccessToken: appToken,
241
+ });
242
+ yield* api.initialize();
243
+ const userInfo = yield* api.identity.getUser();
241
244
  if (userInfo) {
242
245
  console.log(chalk.green('\n✓ Successfully validated credentials!\n'));
243
246
  console.log(chalk.bold.white('📋 Your eBay Account Information:\n'));
@@ -252,30 +255,28 @@ async function validateAndGenerateTokens(config) {
252
255
  }
253
256
  return true;
254
257
  }
255
- else {
256
- console.log(chalk.yellow('⚠️ No refresh token provided, skipping validation\n'));
257
- return false;
258
- }
258
+ console.log(chalk.yellow('⚠️ No refresh token provided, skipping validation\n'));
259
+ return false;
260
+ })));
261
+ if (Either.isRight(validated)) {
262
+ return validated.right;
259
263
  }
260
- catch (error) {
261
- console.log(chalk.red('\n✗ Validation failed\n'));
262
- if (error instanceof Error) {
263
- console.log(chalk.yellow(` Error: ${error.message}\n`));
264
- if (error.message.includes('401') || error.message.includes('Unauthorized')) {
265
- console.log(chalk.gray(' Possible causes:'));
266
- console.log(chalk.gray(' • Invalid or expired refresh token'));
267
- console.log(chalk.gray(' • Token from different environment (sandbox vs production)'));
268
- console.log(chalk.gray(' • Incorrect client credentials\n'));
269
- }
270
- }
271
- const retry = await prompts({
272
- type: 'confirm',
273
- name: 'retry',
274
- message: 'Would you like to retry with different credentials?',
275
- initial: true,
276
- });
277
- return retry.retry === true;
264
+ const message = getErrorMessage(validated.left, String(validated.left));
265
+ console.log(chalk.red('\n✗ Validation failed\n'));
266
+ console.log(chalk.yellow(` Error: ${message}\n`));
267
+ if (message.includes('401') || message.includes('Unauthorized')) {
268
+ console.log(chalk.gray(' Possible causes:'));
269
+ console.log(chalk.gray(' • Invalid or expired refresh token'));
270
+ console.log(chalk.gray(' • Token from different environment (sandbox vs production)'));
271
+ console.log(chalk.gray(' • Incorrect client credentials\n'));
278
272
  }
273
+ const retry = await prompts({
274
+ type: 'confirm',
275
+ name: 'retry',
276
+ message: 'Would you like to retry with different credentials?',
277
+ initial: true,
278
+ });
279
+ return retry.retry === true;
279
280
  }
280
281
  // ═══════════════════════════════════════════════════════════════════════════
281
282
  // LLM Client Detection and Configuration
@@ -386,11 +387,11 @@ async function detectAndConfigureLLMClients() {
386
387
  if (success) {
387
388
  console.log(chalk.green(` ✓ Successfully configured ${client.displayName}`));
388
389
  console.log(chalk.gray(` 📁 Config file: ${client.configPath}`));
389
- console.log(chalk.dim(` 🔗 MCP server added to configuration\n`));
390
+ console.log(chalk.dim(' 🔗 MCP server added to configuration\n'));
390
391
  }
391
392
  else {
392
393
  console.log(chalk.red(` ✗ Failed to configure ${client.displayName}`));
393
- console.log(chalk.yellow(` ⚠️ Manual setup required`));
394
+ console.log(chalk.yellow(' ⚠️ Manual setup required'));
394
395
  console.log(chalk.gray(` 📄 Config path: ${client.configPath}\n`));
395
396
  }
396
397
  }
@@ -451,7 +452,7 @@ networks:
451
452
  driver: bridge
452
453
  `;
453
454
  writeFileSync(dockerComposePath, dockerComposeContent, 'utf-8');
454
- console.log(chalk.green(` ✓ Generated docker-compose.yml`));
455
+ console.log(chalk.green(' ✓ Generated docker-compose.yml'));
455
456
  console.log(chalk.bold.white('\n📖 Docker Usage:\n'));
456
457
  console.log(chalk.gray(' Build and start: ') + chalk.cyan('docker-compose up -d'));
457
458
  console.log(chalk.gray(' View logs: ') + chalk.cyan('docker-compose logs -f'));
@@ -509,7 +510,10 @@ async function runInteractiveSetup(args) {
509
510
  // Check if user needs first-time guide
510
511
  const existingConfig = loadExistingConfig(PROJECT_ROOT);
511
512
  const hasExisting = Object.keys(existingConfig).length > 0;
512
- if (!hasExisting) {
513
+ if (hasExisting) {
514
+ console.log(chalk.cyan('\n📋 Found existing configuration.\n'));
515
+ }
516
+ else {
513
517
  const needsGuide = await prompts({
514
518
  type: 'confirm',
515
519
  name: 'value',
@@ -527,9 +531,6 @@ async function runInteractiveSetup(args) {
527
531
  displayLogo();
528
532
  }
529
533
  }
530
- else {
531
- console.log(chalk.cyan('\n📋 Found existing configuration.\n'));
532
- }
533
534
  // Environment selection
534
535
  let environment = args.environment || existingConfig.EBAY_ENVIRONMENT || 'sandbox';
535
536
  if (!args.environment) {
@@ -742,7 +743,12 @@ process.on('SIGINT', () => {
742
743
  process.exit(0);
743
744
  });
744
745
  // Run main
745
- main().catch((error) => {
746
- console.error(chalk.red('\n❌ Setup failed:'), error);
747
- process.exit(1);
746
+ void Effect.runPromise(Effect.either(Effect.tryPromise({
747
+ try: () => main(),
748
+ catch: (error) => error,
749
+ }))).then((result) => {
750
+ if (Either.isLeft(result)) {
751
+ console.error(chalk.red('\n❌ Setup failed:'), getErrorMessage(result.left));
752
+ process.exitCode = 1;
753
+ }
748
754
  });