@reproapp/mcp 0.0.1 → 0.0.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/package.json +1 -1
- package/src/index.js +41 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -810,7 +810,7 @@ function shouldRetryWithInteractiveAuth(error, config) {
|
|
|
810
810
|
return false;
|
|
811
811
|
}
|
|
812
812
|
const statusCode = error && typeof error === 'object' ? error.statusCode : null;
|
|
813
|
-
return statusCode === 401;
|
|
813
|
+
return statusCode === 401 && !isRemoteAuthConfigurationError(error);
|
|
814
814
|
}
|
|
815
815
|
|
|
816
816
|
function shouldRetryApiWithInteractiveAuth(error, config) {
|
|
@@ -821,6 +821,18 @@ function shouldRetryApiWithInteractiveAuth(error, config) {
|
|
|
821
821
|
return statusCode === 401 || statusCode === 403;
|
|
822
822
|
}
|
|
823
823
|
|
|
824
|
+
function isRemoteAuthConfigurationError(error) {
|
|
825
|
+
if (!error || typeof error !== 'object') {
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
828
|
+
const messages = [
|
|
829
|
+
typeof error.message === 'string' ? error.message : '',
|
|
830
|
+
typeof error.details?.error === 'string' ? error.details.error : '',
|
|
831
|
+
typeof error.details?.message === 'string' ? error.details.message : '',
|
|
832
|
+
];
|
|
833
|
+
return messages.some((message) => message.includes('App-user bearer auth is not configured'));
|
|
834
|
+
}
|
|
835
|
+
|
|
824
836
|
function resolveAuthFilePath(value) {
|
|
825
837
|
if (typeof value === 'string' && value.trim()) {
|
|
826
838
|
return path.resolve(value.trim());
|
|
@@ -1279,11 +1291,38 @@ async function resolveScope(input, config, client) {
|
|
|
1279
1291
|
}
|
|
1280
1292
|
|
|
1281
1293
|
if (client && typeof client.executeTool === 'function') {
|
|
1282
|
-
return client.executeTool('resolve_scope', input);
|
|
1294
|
+
return client.executeTool('resolve_scope', sanitizeRemoteResolveScopeInput(input));
|
|
1283
1295
|
}
|
|
1284
1296
|
throw rpcError(-32602, 'appId or sessionId is required to resolve scope');
|
|
1285
1297
|
}
|
|
1286
1298
|
|
|
1299
|
+
function sanitizeRemoteResolveScopeInput(input) {
|
|
1300
|
+
const sanitized = {};
|
|
1301
|
+
for (const key of ['tenantId', 'sessionId', 'appId']) {
|
|
1302
|
+
const value = optionalNonEmptyString(input[key]);
|
|
1303
|
+
if (value) {
|
|
1304
|
+
sanitized[key] = value;
|
|
1305
|
+
}
|
|
1306
|
+
}
|
|
1307
|
+
|
|
1308
|
+
if (input.timeRange && typeof input.timeRange === 'object' && !Array.isArray(input.timeRange)) {
|
|
1309
|
+
const timeRange = {};
|
|
1310
|
+
const from = optionalNonEmptyString(input.timeRange.from);
|
|
1311
|
+
const to = optionalNonEmptyString(input.timeRange.to);
|
|
1312
|
+
if (from) {
|
|
1313
|
+
timeRange.from = from;
|
|
1314
|
+
}
|
|
1315
|
+
if (to) {
|
|
1316
|
+
timeRange.to = to;
|
|
1317
|
+
}
|
|
1318
|
+
if (Object.keys(timeRange).length > 0) {
|
|
1319
|
+
sanitized.timeRange = timeRange;
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
|
|
1323
|
+
return sanitized;
|
|
1324
|
+
}
|
|
1325
|
+
|
|
1287
1326
|
async function checkPrivacyCoverage(input, config, client) {
|
|
1288
1327
|
if (!client || typeof client.requestApi !== 'function') {
|
|
1289
1328
|
throw rpcError(-32603, 'This MCP client cannot fetch app privacy policies');
|