ebay-mcp 1.4.3
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 +201 -0
- package/README.md +586 -0
- package/build/api/account-management/account.d.ts +216 -0
- package/build/api/account-management/account.js +305 -0
- package/build/api/analytics-and-report/analytics.d.ts +33 -0
- package/build/api/analytics-and-report/analytics.js +102 -0
- package/build/api/client.d.ts +89 -0
- package/build/api/client.js +343 -0
- package/build/api/communication/feedback.d.ts +45 -0
- package/build/api/communication/feedback.js +119 -0
- package/build/api/communication/message.d.ts +55 -0
- package/build/api/communication/message.js +131 -0
- package/build/api/communication/negotiation.d.ts +39 -0
- package/build/api/communication/negotiation.js +97 -0
- package/build/api/communication/notification.d.ts +128 -0
- package/build/api/communication/notification.js +373 -0
- package/build/api/index.d.ts +96 -0
- package/build/api/index.js +121 -0
- package/build/api/listing-management/inventory.d.ts +216 -0
- package/build/api/listing-management/inventory.js +633 -0
- package/build/api/listing-metadata/metadata.d.ts +154 -0
- package/build/api/listing-metadata/metadata.js +485 -0
- package/build/api/listing-metadata/taxonomy.d.ts +38 -0
- package/build/api/listing-metadata/taxonomy.js +58 -0
- package/build/api/marketing-and-promotions/marketing.d.ts +395 -0
- package/build/api/marketing-and-promotions/marketing.js +565 -0
- package/build/api/marketing-and-promotions/recommendation.d.ts +20 -0
- package/build/api/marketing-and-promotions/recommendation.js +32 -0
- package/build/api/order-management/dispute.d.ts +65 -0
- package/build/api/order-management/dispute.js +69 -0
- package/build/api/order-management/fulfillment.d.ts +80 -0
- package/build/api/order-management/fulfillment.js +89 -0
- package/build/api/other/compliance.d.ts +26 -0
- package/build/api/other/compliance.js +47 -0
- package/build/api/other/edelivery.d.ts +153 -0
- package/build/api/other/edelivery.js +219 -0
- package/build/api/other/identity.d.ts +17 -0
- package/build/api/other/identity.js +24 -0
- package/build/api/other/translation.d.ts +14 -0
- package/build/api/other/translation.js +22 -0
- package/build/api/other/vero.d.ts +30 -0
- package/build/api/other/vero.js +48 -0
- package/build/auth/oauth-metadata.d.ts +46 -0
- package/build/auth/oauth-metadata.js +59 -0
- package/build/auth/oauth-middleware.d.ts +35 -0
- package/build/auth/oauth-middleware.js +99 -0
- package/build/auth/oauth-types.d.ts +66 -0
- package/build/auth/oauth-types.js +4 -0
- package/build/auth/oauth.d.ts +93 -0
- package/build/auth/oauth.js +383 -0
- package/build/auth/scope-utils.d.ts +70 -0
- package/build/auth/scope-utils.js +304 -0
- package/build/auth/token-verifier.d.ts +57 -0
- package/build/auth/token-verifier.js +172 -0
- package/build/config/environment.d.ts +61 -0
- package/build/config/environment.js +260 -0
- package/build/index.d.ts +1 -0
- package/build/index.js +98 -0
- package/build/schemas/account-management/account.d.ts +5324 -0
- package/build/schemas/account-management/account.js +366 -0
- package/build/schemas/analytics/analytics.d.ts +167 -0
- package/build/schemas/analytics/analytics.js +191 -0
- package/build/schemas/communication/messages.d.ts +1872 -0
- package/build/schemas/communication/messages.js +348 -0
- package/build/schemas/fulfillment/orders.d.ts +4655 -0
- package/build/schemas/fulfillment/orders.js +317 -0
- package/build/schemas/index.d.ts +2100 -0
- package/build/schemas/index.js +68 -0
- package/build/schemas/inventory-management/inventory.d.ts +6419 -0
- package/build/schemas/inventory-management/inventory.js +450 -0
- package/build/schemas/marketing/marketing.d.ts +14181 -0
- package/build/schemas/marketing/marketing.js +1088 -0
- package/build/schemas/metadata/metadata.d.ts +5259 -0
- package/build/schemas/metadata/metadata.js +614 -0
- package/build/schemas/other/other-apis.d.ts +257 -0
- package/build/schemas/other/other-apis.js +372 -0
- package/build/schemas/taxonomy/taxonomy.d.ts +215 -0
- package/build/schemas/taxonomy/taxonomy.js +571 -0
- package/build/scripts/auto-setup.d.ts +12 -0
- package/build/scripts/auto-setup.js +277 -0
- package/build/scripts/diagnostics.d.ts +8 -0
- package/build/scripts/diagnostics.js +299 -0
- package/build/scripts/download-specs.d.ts +1 -0
- package/build/scripts/download-specs.js +116 -0
- package/build/scripts/interactive-setup.d.ts +21 -0
- package/build/scripts/interactive-setup.js +723 -0
- package/build/server-http.d.ts +11 -0
- package/build/server-http.js +361 -0
- package/build/tools/definitions/account-with-schemas.d.ts +39 -0
- package/build/tools/definitions/account-with-schemas.js +170 -0
- package/build/tools/definitions/account.d.ts +12 -0
- package/build/tools/definitions/account.js +428 -0
- package/build/tools/definitions/analytics.d.ts +25 -0
- package/build/tools/definitions/analytics.js +66 -0
- package/build/tools/definitions/communication.d.ts +12 -0
- package/build/tools/definitions/communication.js +151 -0
- package/build/tools/definitions/fulfillment.d.ts +12 -0
- package/build/tools/definitions/fulfillment.js +326 -0
- package/build/tools/definitions/index.d.ts +25 -0
- package/build/tools/definitions/index.js +37 -0
- package/build/tools/definitions/inventory.d.ts +12 -0
- package/build/tools/definitions/inventory.js +429 -0
- package/build/tools/definitions/marketing.d.ts +12 -0
- package/build/tools/definitions/marketing.js +1095 -0
- package/build/tools/definitions/metadata.d.ts +12 -0
- package/build/tools/definitions/metadata.js +188 -0
- package/build/tools/definitions/other.d.ts +13 -0
- package/build/tools/definitions/other.js +309 -0
- package/build/tools/definitions/taxonomy.d.ts +25 -0
- package/build/tools/definitions/taxonomy.js +64 -0
- package/build/tools/definitions/token-management.d.ts +35 -0
- package/build/tools/definitions/token-management.js +103 -0
- package/build/tools/index.d.ts +11 -0
- package/build/tools/index.js +1003 -0
- package/build/tools/schemas.d.ts +14764 -0
- package/build/tools/schemas.js +667 -0
- package/build/tools/tool-definitions.d.ts +35 -0
- package/build/tools/tool-definitions.js +3534 -0
- package/build/types/application-settings/developerAnalyticsV1BetaOas3.d.ts +197 -0
- package/build/types/application-settings/developerAnalyticsV1BetaOas3.js +5 -0
- package/build/types/application-settings/developerClientRegistrationV1Oas3.d.ts +155 -0
- package/build/types/application-settings/developerClientRegistrationV1Oas3.js +5 -0
- package/build/types/application-settings/developerKeyManagementV1Oas3.d.ts +246 -0
- package/build/types/application-settings/developerKeyManagementV1Oas3.js +5 -0
- package/build/types/ebay-enums.d.ts +1204 -0
- package/build/types/ebay-enums.js +1330 -0
- package/build/types/ebay.d.ts +143 -0
- package/build/types/ebay.js +123 -0
- package/build/types/index.d.ts +6 -0
- package/build/types/index.js +10 -0
- package/build/types/sell-apps/account-management/sellAccountV1Oas3.d.ts +2579 -0
- package/build/types/sell-apps/account-management/sellAccountV1Oas3.js +5 -0
- package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.d.ts +446 -0
- package/build/types/sell-apps/analytics-and-report/sellAnalyticsV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.d.ts +705 -0
- package/build/types/sell-apps/communication/commerceFeedbackV1BetaOas3.js +5 -0
- package/build/types/sell-apps/communication/commerceMessageV1Oas3.d.ts +590 -0
- package/build/types/sell-apps/communication/commerceMessageV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/commerceNotificationV1Oas3.d.ts +1276 -0
- package/build/types/sell-apps/communication/commerceNotificationV1Oas3.js +5 -0
- package/build/types/sell-apps/communication/sellNegotiationV1Oas3.d.ts +277 -0
- package/build/types/sell-apps/communication/sellNegotiationV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.d.ts +3133 -0
- package/build/types/sell-apps/listing-management/sellInventoryV1Oas3.js +5 -0
- package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.d.ts +2289 -0
- package/build/types/sell-apps/listing-metadata/sellMetadataV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.d.ts +6650 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.d.ts +172 -0
- package/build/types/sell-apps/markeitng-and-promotions/sellRecommendationV1Oas3.js +5 -0
- package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.d.ts +1869 -0
- package/build/types/sell-apps/order-management/sellFulfillmentV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.d.ts +178 -0
- package/build/types/sell-apps/other-apis/commerceIdentityV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.d.ts +128 -0
- package/build/types/sell-apps/other-apis/commerceTranslationV1BetaOas3.js +5 -0
- package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.d.ts +417 -0
- package/build/types/sell-apps/other-apis/commerceVeroV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.d.ts +273 -0
- package/build/types/sell-apps/other-apis/sellComplianceV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.d.ts +2537 -0
- package/build/types/sell-apps/other-apis/sellEdeliveryInternationalShippingOas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.d.ts +6650 -0
- package/build/types/sell-apps/other-apis/sellMarketingV1Oas3.js +5 -0
- package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.d.ts +172 -0
- package/build/types/sell-apps/other-apis/sellRecommendationV1Oas3.js +5 -0
- package/build/utils/account-management/account.d.ts +1094 -0
- package/build/utils/account-management/account.js +831 -0
- package/build/utils/communication/feedback.d.ts +152 -0
- package/build/utils/communication/feedback.js +216 -0
- package/build/utils/communication/message.d.ts +174 -0
- package/build/utils/communication/message.js +242 -0
- package/build/utils/communication/negotiation.d.ts +123 -0
- package/build/utils/communication/negotiation.js +150 -0
- package/build/utils/communication/notification.d.ts +370 -0
- package/build/utils/communication/notification.js +369 -0
- package/build/utils/date-converter.d.ts +59 -0
- package/build/utils/date-converter.js +160 -0
- package/build/utils/llm-client-detector.d.ts +54 -0
- package/build/utils/llm-client-detector.js +318 -0
- package/build/utils/oauth-helper.d.ts +37 -0
- package/build/utils/oauth-helper.js +315 -0
- package/build/utils/order-management/dispute.d.ts +346 -0
- package/build/utils/order-management/dispute.js +369 -0
- package/build/utils/order-management/fulfillment.d.ts +200 -0
- package/build/utils/order-management/fulfillment.js +205 -0
- package/build/utils/other/compliance.d.ts +49 -0
- package/build/utils/other/compliance.js +76 -0
- package/build/utils/other/edelivery.d.ts +310 -0
- package/build/utils/other/edelivery.js +241 -0
- package/build/utils/other/identity.d.ts +13 -0
- package/build/utils/other/identity.js +13 -0
- package/build/utils/other/translation.d.ts +28 -0
- package/build/utils/other/translation.js +41 -0
- package/build/utils/other/vero.d.ts +61 -0
- package/build/utils/other/vero.js +90 -0
- package/build/utils/scope-helper.d.ts +49 -0
- package/build/utils/scope-helper.js +207 -0
- package/build/utils/security-checker.d.ts +46 -0
- package/build/utils/security-checker.js +248 -0
- package/build/utils/setup-validator.d.ts +25 -0
- package/build/utils/setup-validator.js +305 -0
- package/build/utils/token-utils.d.ts +40 -0
- package/build/utils/token-utils.js +40 -0
- package/package.json +115 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Setup Validation Module
|
|
3
|
+
*
|
|
4
|
+
* Tests the configuration after setup to ensure everything is working properly.
|
|
5
|
+
*/
|
|
6
|
+
import { existsSync, readFileSync } from 'fs';
|
|
7
|
+
import { join } from 'path';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import { EbayOAuthClient } from '../auth/oauth.js';
|
|
10
|
+
import { getOAuthAuthorizationUrl } from '../config/environment.js';
|
|
11
|
+
/**
|
|
12
|
+
* Parse .env file manually
|
|
13
|
+
*/
|
|
14
|
+
function parseEnvFile(filePath) {
|
|
15
|
+
const env = {};
|
|
16
|
+
if (!existsSync(filePath)) {
|
|
17
|
+
return env;
|
|
18
|
+
}
|
|
19
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
20
|
+
const lines = content.split('\n');
|
|
21
|
+
for (const line of lines) {
|
|
22
|
+
const trimmed = line.trim();
|
|
23
|
+
// Skip empty lines and comments
|
|
24
|
+
if (!trimmed || trimmed.startsWith('#')) {
|
|
25
|
+
continue;
|
|
26
|
+
}
|
|
27
|
+
// Parse KEY=VALUE
|
|
28
|
+
const match = /^([^=]+)=(.*)$/.exec(trimmed);
|
|
29
|
+
if (match) {
|
|
30
|
+
const key = match[1].trim();
|
|
31
|
+
let value = match[2].trim();
|
|
32
|
+
// Remove quotes if present
|
|
33
|
+
if ((value.startsWith('"') && value.endsWith('"')) ||
|
|
34
|
+
(value.startsWith("'") && value.endsWith("'"))) {
|
|
35
|
+
value = value.slice(1, -1);
|
|
36
|
+
}
|
|
37
|
+
env[key] = value;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
return env;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Validate .env file exists and is readable
|
|
44
|
+
*/
|
|
45
|
+
function validateEnvFile(projectRoot) {
|
|
46
|
+
const envPath = join(projectRoot, '.env');
|
|
47
|
+
if (!existsSync(envPath)) {
|
|
48
|
+
return {
|
|
49
|
+
test: '.env File Existence',
|
|
50
|
+
passed: false,
|
|
51
|
+
message: 'Configuration file not found',
|
|
52
|
+
error: `.env file does not exist at ${envPath}`,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
readFileSync(envPath, 'utf-8');
|
|
57
|
+
return {
|
|
58
|
+
test: '.env File Existence',
|
|
59
|
+
passed: true,
|
|
60
|
+
message: 'Configuration file exists and is readable',
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
catch (error) {
|
|
64
|
+
return {
|
|
65
|
+
test: '.env File Existence',
|
|
66
|
+
passed: false,
|
|
67
|
+
message: 'Configuration file cannot be read',
|
|
68
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Validate required app credentials are present
|
|
74
|
+
*/
|
|
75
|
+
function validateAppCredentials(envVars) {
|
|
76
|
+
const required = ['EBAY_CLIENT_ID', 'EBAY_CLIENT_SECRET', 'EBAY_REDIRECT_URI'];
|
|
77
|
+
const missing = [];
|
|
78
|
+
for (const key of required) {
|
|
79
|
+
if (!envVars[key] || envVars[key].trim() === '') {
|
|
80
|
+
missing.push(key);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
if (missing.length > 0) {
|
|
84
|
+
return {
|
|
85
|
+
test: 'App Credentials',
|
|
86
|
+
passed: false,
|
|
87
|
+
message: 'Missing required app credentials',
|
|
88
|
+
error: `Missing: ${missing.join(', ')}`,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
return {
|
|
92
|
+
test: 'App Credentials',
|
|
93
|
+
passed: true,
|
|
94
|
+
message: 'All required app credentials are present',
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Validate environment setting
|
|
99
|
+
*/
|
|
100
|
+
function validateEnvironment(envVars) {
|
|
101
|
+
const env = envVars.EBAY_ENVIRONMENT || 'sandbox';
|
|
102
|
+
if (env !== 'sandbox' && env !== 'production') {
|
|
103
|
+
return {
|
|
104
|
+
test: 'Environment Setting',
|
|
105
|
+
passed: false,
|
|
106
|
+
message: 'Invalid environment value',
|
|
107
|
+
error: `EBAY_ENVIRONMENT must be "sandbox" or "production", got "${env}"`,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
test: 'Environment Setting',
|
|
112
|
+
passed: true,
|
|
113
|
+
message: `Environment set to "${env}"`,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* Check if user tokens are configured
|
|
118
|
+
*/
|
|
119
|
+
function validateUserTokens(envVars) {
|
|
120
|
+
const hasRefreshToken = envVars.EBAY_USER_REFRESH_TOKEN && envVars.EBAY_USER_REFRESH_TOKEN.trim() !== '';
|
|
121
|
+
if (!hasRefreshToken) {
|
|
122
|
+
return {
|
|
123
|
+
test: 'User Tokens (Optional)',
|
|
124
|
+
passed: true,
|
|
125
|
+
message: 'No user tokens configured (app token only mode)',
|
|
126
|
+
error: 'To enable user-specific API calls, set EBAY_USER_REFRESH_TOKEN',
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
test: 'User Tokens',
|
|
131
|
+
passed: true,
|
|
132
|
+
message: 'User refresh token is configured',
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Test OAuth client initialization
|
|
137
|
+
*/
|
|
138
|
+
async function validateOAuthInitialization(config) {
|
|
139
|
+
try {
|
|
140
|
+
const oauthClient = new EbayOAuthClient(config);
|
|
141
|
+
await oauthClient.initialize();
|
|
142
|
+
return {
|
|
143
|
+
test: 'OAuth Client Initialization',
|
|
144
|
+
passed: true,
|
|
145
|
+
message: 'OAuth client initialized successfully',
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
return {
|
|
150
|
+
test: 'OAuth Client Initialization',
|
|
151
|
+
passed: false,
|
|
152
|
+
message: 'Failed to initialize OAuth client',
|
|
153
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Test OAuth URL generation
|
|
159
|
+
*/
|
|
160
|
+
function validateOAuthURL(config) {
|
|
161
|
+
try {
|
|
162
|
+
if (!config.redirectUri) {
|
|
163
|
+
return {
|
|
164
|
+
test: 'OAuth URL Generation',
|
|
165
|
+
passed: false,
|
|
166
|
+
message: 'Redirect URI is required for OAuth URL generation',
|
|
167
|
+
error: 'EBAY_REDIRECT_URI is not configured',
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
const url = getOAuthAuthorizationUrl(config.clientId, config.redirectUri, config.environment);
|
|
171
|
+
if (!url.startsWith('http')) {
|
|
172
|
+
return {
|
|
173
|
+
test: 'OAuth URL Generation',
|
|
174
|
+
passed: false,
|
|
175
|
+
message: 'Invalid OAuth URL generated',
|
|
176
|
+
error: 'Generated URL is not valid',
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
return {
|
|
180
|
+
test: 'OAuth URL Generation',
|
|
181
|
+
passed: true,
|
|
182
|
+
message: 'OAuth URL can be generated',
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
catch (error) {
|
|
186
|
+
return {
|
|
187
|
+
test: 'OAuth URL Generation',
|
|
188
|
+
passed: false,
|
|
189
|
+
message: 'Failed to generate OAuth URL',
|
|
190
|
+
error: error instanceof Error ? error.message : 'Unknown error',
|
|
191
|
+
};
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Run all validation tests
|
|
196
|
+
*/
|
|
197
|
+
export async function validateSetup(projectRoot) {
|
|
198
|
+
const results = [];
|
|
199
|
+
console.log(chalk.bold.cyan('\n🧪 Running Configuration Tests...\n'));
|
|
200
|
+
// Test 1: .env file exists
|
|
201
|
+
const envFileResult = validateEnvFile(projectRoot);
|
|
202
|
+
results.push(envFileResult);
|
|
203
|
+
printResult(envFileResult);
|
|
204
|
+
if (!envFileResult.passed) {
|
|
205
|
+
return {
|
|
206
|
+
totalTests: 1,
|
|
207
|
+
passed: 0,
|
|
208
|
+
failed: 1,
|
|
209
|
+
results,
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
// Parse .env file
|
|
213
|
+
const envPath = join(projectRoot, '.env');
|
|
214
|
+
const envVars = parseEnvFile(envPath);
|
|
215
|
+
// Test 2: App credentials
|
|
216
|
+
const appCredsResult = validateAppCredentials(envVars);
|
|
217
|
+
results.push(appCredsResult);
|
|
218
|
+
printResult(appCredsResult);
|
|
219
|
+
// Test 3: Environment setting
|
|
220
|
+
const envResult = validateEnvironment(envVars);
|
|
221
|
+
results.push(envResult);
|
|
222
|
+
printResult(envResult);
|
|
223
|
+
// Test 4: User tokens (optional)
|
|
224
|
+
const userTokensResult = validateUserTokens(envVars);
|
|
225
|
+
results.push(userTokensResult);
|
|
226
|
+
printResult(userTokensResult);
|
|
227
|
+
// If app credentials are valid, test OAuth functionality
|
|
228
|
+
if (appCredsResult.passed) {
|
|
229
|
+
const config = {
|
|
230
|
+
clientId: envVars.EBAY_CLIENT_ID,
|
|
231
|
+
clientSecret: envVars.EBAY_CLIENT_SECRET,
|
|
232
|
+
redirectUri: envVars.EBAY_REDIRECT_URI,
|
|
233
|
+
environment: (envVars.EBAY_ENVIRONMENT || 'sandbox'),
|
|
234
|
+
};
|
|
235
|
+
// Test 5: OAuth initialization
|
|
236
|
+
const oauthInitResult = await validateOAuthInitialization(config);
|
|
237
|
+
results.push(oauthInitResult);
|
|
238
|
+
printResult(oauthInitResult);
|
|
239
|
+
// Test 6: OAuth URL generation
|
|
240
|
+
if (oauthInitResult.passed) {
|
|
241
|
+
const oauthURLResult = validateOAuthURL(config);
|
|
242
|
+
results.push(oauthURLResult);
|
|
243
|
+
printResult(oauthURLResult);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
// Calculate summary
|
|
247
|
+
const passed = results.filter((r) => r.passed).length;
|
|
248
|
+
const failed = results.length - passed;
|
|
249
|
+
// Print summary
|
|
250
|
+
console.log(chalk.gray('\n' + '─'.repeat(60)));
|
|
251
|
+
console.log(chalk.bold.white('\n📊 Validation Summary\n'));
|
|
252
|
+
console.log(` Total Tests: ${results.length}`);
|
|
253
|
+
console.log(` ${chalk.green('✓ Passed:')} ${passed}`);
|
|
254
|
+
console.log(` ${chalk.red('✗ Failed:')} ${failed}`);
|
|
255
|
+
if (failed === 0) {
|
|
256
|
+
console.log(chalk.green.bold('\n✨ All tests passed! Configuration is valid.\n'));
|
|
257
|
+
}
|
|
258
|
+
else {
|
|
259
|
+
console.log(chalk.yellow.bold('\n⚠️ Some tests failed. Please review the errors above.\n'));
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
totalTests: results.length,
|
|
263
|
+
passed,
|
|
264
|
+
failed,
|
|
265
|
+
results,
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Print a single validation result
|
|
270
|
+
*/
|
|
271
|
+
function printResult(result) {
|
|
272
|
+
const icon = result.passed ? chalk.green('✓') : chalk.red('✗');
|
|
273
|
+
const status = result.passed ? chalk.green('PASS') : chalk.red('FAIL');
|
|
274
|
+
console.log(`${icon} ${chalk.bold(result.test)}: ${status}`);
|
|
275
|
+
console.log(` ${chalk.gray(result.message)}`);
|
|
276
|
+
if (result.error) {
|
|
277
|
+
console.log(` ${chalk.yellow('→')} ${chalk.yellow(result.error)}`);
|
|
278
|
+
}
|
|
279
|
+
console.log('');
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Display recommendations based on validation results
|
|
283
|
+
*/
|
|
284
|
+
export function displayRecommendations(summary) {
|
|
285
|
+
const hasUserTokens = summary.results.some((r) => r.test === 'User Tokens' && r.passed && !r.error);
|
|
286
|
+
console.log(chalk.bold.cyan('💡 Recommendations:\n'));
|
|
287
|
+
if (!hasUserTokens) {
|
|
288
|
+
console.log(chalk.yellow(' ⚠️ User tokens not configured'));
|
|
289
|
+
console.log(chalk.gray(' • You can only use app token for limited API access'));
|
|
290
|
+
console.log(chalk.gray(' • To enable full API access, use the ebay_get_oauth_url tool'));
|
|
291
|
+
console.log(chalk.gray(' • Then save your refresh token to EBAY_USER_REFRESH_TOKEN in .env\n'));
|
|
292
|
+
}
|
|
293
|
+
if (summary.failed > 0) {
|
|
294
|
+
console.log(chalk.red(' ❌ Configuration has errors'));
|
|
295
|
+
console.log(chalk.gray(' • Review the failed tests above'));
|
|
296
|
+
console.log(chalk.gray(' • Update your .env file with correct values'));
|
|
297
|
+
console.log(chalk.gray(' • Run the setup wizard again: npm run setup\n'));
|
|
298
|
+
}
|
|
299
|
+
else {
|
|
300
|
+
console.log(chalk.green(' ✅ Configuration is complete and valid'));
|
|
301
|
+
console.log(chalk.gray(' • Restart your MCP client (Claude Desktop, Cline, etc.)'));
|
|
302
|
+
console.log(chalk.gray(' • The eBay MCP server should now be available'));
|
|
303
|
+
console.log(chalk.gray(' • Try using tools like: ebay_get_user, ebay_get_oauth_url\n'));
|
|
304
|
+
}
|
|
305
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for token utility tools
|
|
4
|
+
*/
|
|
5
|
+
export declare const ConvertDateToTimestampSchema: z.ZodObject<{
|
|
6
|
+
dateInput: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
7
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
8
|
+
dateInput: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
9
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
10
|
+
dateInput: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
11
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
12
|
+
export declare const ValidateTokenExpirySchema: z.ZodObject<{
|
|
13
|
+
accessTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
14
|
+
refreshTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
15
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
16
|
+
accessTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
17
|
+
refreshTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
18
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
19
|
+
accessTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
20
|
+
refreshTokenExpiry: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
|
|
21
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
22
|
+
export declare const SetUserTokensWithExpirySchema: z.ZodObject<{
|
|
23
|
+
accessToken: z.ZodString;
|
|
24
|
+
refreshToken: z.ZodString;
|
|
25
|
+
accessTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
26
|
+
refreshTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
27
|
+
autoRefresh: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
28
|
+
}, "passthrough", z.ZodTypeAny, z.objectOutputType<{
|
|
29
|
+
accessToken: z.ZodString;
|
|
30
|
+
refreshToken: z.ZodString;
|
|
31
|
+
accessTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
32
|
+
refreshTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
33
|
+
autoRefresh: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
34
|
+
}, z.ZodTypeAny, "passthrough">, z.objectInputType<{
|
|
35
|
+
accessToken: z.ZodString;
|
|
36
|
+
refreshToken: z.ZodString;
|
|
37
|
+
accessTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
38
|
+
refreshTokenExpiry: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>;
|
|
39
|
+
autoRefresh: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
40
|
+
}, z.ZodTypeAny, "passthrough">>;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Zod schemas for token utility tools
|
|
4
|
+
*/
|
|
5
|
+
export const ConvertDateToTimestampSchema = z
|
|
6
|
+
.object({
|
|
7
|
+
dateInput: z
|
|
8
|
+
.union([z.string(), z.number()])
|
|
9
|
+
.describe('Date to convert. Supports ISO 8601 strings (e.g., "2025-01-15T10:30:00Z"), Unix timestamps (seconds or milliseconds), or relative time (e.g., "in 2 hours")'),
|
|
10
|
+
})
|
|
11
|
+
.passthrough();
|
|
12
|
+
export const ValidateTokenExpirySchema = z
|
|
13
|
+
.object({
|
|
14
|
+
accessTokenExpiry: z
|
|
15
|
+
.union([z.string(), z.number()])
|
|
16
|
+
.describe('Access token expiry time. Can be ISO date string, Unix timestamp (seconds or milliseconds), or relative time'),
|
|
17
|
+
refreshTokenExpiry: z
|
|
18
|
+
.union([z.string(), z.number()])
|
|
19
|
+
.describe('Refresh token expiry time. Can be ISO date string, Unix timestamp (seconds or milliseconds), or relative time'),
|
|
20
|
+
})
|
|
21
|
+
.passthrough();
|
|
22
|
+
export const SetUserTokensWithExpirySchema = z
|
|
23
|
+
.object({
|
|
24
|
+
accessToken: z.string().min(1).describe('eBay user access token'),
|
|
25
|
+
refreshToken: z.string().min(1).describe('eBay user refresh token'),
|
|
26
|
+
accessTokenExpiry: z
|
|
27
|
+
.union([z.string(), z.number()])
|
|
28
|
+
.optional()
|
|
29
|
+
.describe("Optional: Access token expiry time. If not provided, defaults to 2 hours from now. Can be ISO date string, Unix timestamp, or relative time (e.g., 'in 7200 seconds')"),
|
|
30
|
+
refreshTokenExpiry: z
|
|
31
|
+
.union([z.string(), z.number()])
|
|
32
|
+
.optional()
|
|
33
|
+
.describe('Optional: Refresh token expiry time. If not provided, defaults to 18 months from now. Can be ISO date string, Unix timestamp, or relative time'),
|
|
34
|
+
autoRefresh: z
|
|
35
|
+
.boolean()
|
|
36
|
+
.optional()
|
|
37
|
+
.default(true)
|
|
38
|
+
.describe('If true and access token is expired but refresh token is valid, automatically refresh the access token. Default: true'),
|
|
39
|
+
})
|
|
40
|
+
.passthrough();
|
package/package.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "ebay-mcp",
|
|
3
|
+
"version": "1.4.3",
|
|
4
|
+
"description": "MCP server for eBay APIs - provides access to eBay developer functionality through MCP (Model Context Protocol)",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "build/index.js",
|
|
7
|
+
"types": "build/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"ebay-mcp": "build/index.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc && tsc-alias",
|
|
13
|
+
"watch": "tsc --watch",
|
|
14
|
+
"dev": "tsx src/index.ts",
|
|
15
|
+
"dev:http": "tsx src/server-http.ts",
|
|
16
|
+
"start": "node build/index.js",
|
|
17
|
+
"start:http": "node build/server-http.js",
|
|
18
|
+
"clean": "rm -rf build",
|
|
19
|
+
"prepare": "npm run build",
|
|
20
|
+
"postinstall": "npm run auto-setup --if-present || true",
|
|
21
|
+
"setup": "tsx src/scripts/interactive-setup.ts",
|
|
22
|
+
"auto-setup": "node build/scripts/auto-setup.js",
|
|
23
|
+
"diagnose": "tsx src/scripts/diagnostics.ts",
|
|
24
|
+
"diagnose:export": "tsx src/scripts/diagnostics.ts --export",
|
|
25
|
+
"typecheck": "tsc --noEmit",
|
|
26
|
+
"test": "vitest run",
|
|
27
|
+
"test:watch": "vitest",
|
|
28
|
+
"test:ui": "vitest --ui",
|
|
29
|
+
"test:coverage": "vitest run --coverage",
|
|
30
|
+
"test:integration": "vitest run tests/integration",
|
|
31
|
+
"download:specs": "tsx src/scripts/download-specs.ts",
|
|
32
|
+
"test:endpoints": "tsx src/scripts/test-endpoints.ts",
|
|
33
|
+
"generate:types": "bash src/scripts/generate-types.sh",
|
|
34
|
+
"lint": "eslint .",
|
|
35
|
+
"lint:fix": "eslint . --fix",
|
|
36
|
+
"format": "prettier --write \"src/**/*.{ts,js,json,md}\" \"tests/**/*.{ts,js,json}\"",
|
|
37
|
+
"format:check": "prettier --check \"src/**/*.{ts,js,json,md}\" \"tests/**/*.{ts,js,json}\"",
|
|
38
|
+
"check": "npm run typecheck && npm run lint && npm run format:check",
|
|
39
|
+
"docker:build": "docker-compose build",
|
|
40
|
+
"docker:up": "docker-compose up -d",
|
|
41
|
+
"docker:down": "docker-compose down",
|
|
42
|
+
"docker:logs": "docker-compose logs -f",
|
|
43
|
+
"docker:restart": "docker-compose restart"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"mcp",
|
|
47
|
+
"ebay",
|
|
48
|
+
"ebay-api",
|
|
49
|
+
"model-context-protocol",
|
|
50
|
+
"ai-tools",
|
|
51
|
+
"ai",
|
|
52
|
+
"llm",
|
|
53
|
+
"mcp",
|
|
54
|
+
"documentation",
|
|
55
|
+
"api",
|
|
56
|
+
"ebay",
|
|
57
|
+
"server",
|
|
58
|
+
"backend"
|
|
59
|
+
],
|
|
60
|
+
"author": "Yosef Hayim Sabag",
|
|
61
|
+
"license": "MIT",
|
|
62
|
+
"files": [
|
|
63
|
+
"build",
|
|
64
|
+
"README.md"
|
|
65
|
+
],
|
|
66
|
+
"repository": {
|
|
67
|
+
"type": "git",
|
|
68
|
+
"url": "https://github.com/YosefHayim/ebay-mcp.git"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://github.com/YosefHayim/ebay-mcp#readme",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/YosefHayim/ebay-mcp/issues"
|
|
73
|
+
},
|
|
74
|
+
"dependencies": {
|
|
75
|
+
"@modelcontextprotocol/sdk": "^1.21.1",
|
|
76
|
+
"axios": "^1.7.9",
|
|
77
|
+
"chalk": "^5.6.2",
|
|
78
|
+
"cors": "^2.8.5",
|
|
79
|
+
"dotenv": "^16.4.7",
|
|
80
|
+
"express": "^5.1.0",
|
|
81
|
+
"helmet": "^8.1.0",
|
|
82
|
+
"jose": "^6.1.1",
|
|
83
|
+
"jsonwebtoken": "^9.0.2",
|
|
84
|
+
"prompts": "^2.4.2",
|
|
85
|
+
"zod": "3",
|
|
86
|
+
"zod-to-json-schema": "^3.24.6"
|
|
87
|
+
},
|
|
88
|
+
"devDependencies": {
|
|
89
|
+
"@eslint/js": "^9.39.1",
|
|
90
|
+
"@types/cors": "^2.8.19",
|
|
91
|
+
"@types/express": "^5.0.5",
|
|
92
|
+
"@types/jsonwebtoken": "^9.0.10",
|
|
93
|
+
"@types/node": "^22.10.2",
|
|
94
|
+
"@types/prompts": "^2.4.9",
|
|
95
|
+
"@types/supertest": "^6.0.3",
|
|
96
|
+
"@vitest/coverage-v8": "^4.0.8",
|
|
97
|
+
"@vitest/ui": "^4.0.8",
|
|
98
|
+
"eslint": "^9.39.1",
|
|
99
|
+
"eslint-config-prettier": "^10.1.8",
|
|
100
|
+
"eslint-plugin-n": "^17.23.1",
|
|
101
|
+
"eslint-plugin-vitest": "^0.5.4",
|
|
102
|
+
"nock": "^14.0.10",
|
|
103
|
+
"openapi-typescript": "^7.10.1",
|
|
104
|
+
"prettier": "^3.6.2",
|
|
105
|
+
"supertest": "^7.1.4",
|
|
106
|
+
"tsc-alias": "^1.8.16",
|
|
107
|
+
"tsx": "^4.19.2",
|
|
108
|
+
"typescript": "^5.9.3",
|
|
109
|
+
"typescript-eslint": "^8.46.4",
|
|
110
|
+
"vitest": "^4.0.8"
|
|
111
|
+
},
|
|
112
|
+
"engines": {
|
|
113
|
+
"node": ">=18.0.0"
|
|
114
|
+
}
|
|
115
|
+
}
|