@mcp-s/cli 0.0.13 → 0.0.14
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/dist/daemon.js +1 -1
- package/dist/index.js +12 -4
- package/package.json +1 -1
package/dist/daemon.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1298,7 +1298,7 @@ async function cleanupOrphanedDaemons() {
|
|
|
1298
1298
|
}
|
|
1299
1299
|
|
|
1300
1300
|
// src/version.ts
|
|
1301
|
-
var VERSION = "0.0.
|
|
1301
|
+
var VERSION = "0.0.14";
|
|
1302
1302
|
|
|
1303
1303
|
// src/client.ts
|
|
1304
1304
|
function getRetryConfig(settings) {
|
|
@@ -2514,12 +2514,20 @@ function getSkillInstallInfo() {
|
|
|
2514
2514
|
// src/commands/login.ts
|
|
2515
2515
|
async function loginCommand(options) {
|
|
2516
2516
|
const { configPath } = options;
|
|
2517
|
-
const { serverConfig } = await loadConfig(configPath);
|
|
2517
|
+
const { raw, serverConfig } = await loadConfig(configPath);
|
|
2518
2518
|
if (!isHttpServer(serverConfig)) {
|
|
2519
2519
|
throw new Error(
|
|
2520
2520
|
"Current server is a stdio server. OAuth login is only supported for HTTP servers."
|
|
2521
2521
|
);
|
|
2522
2522
|
}
|
|
2523
|
+
const THREE_HOURS_MS = 3 * 60 * 60 * 1e3;
|
|
2524
|
+
const storedTokens = await getStoredTokens(serverConfig.url);
|
|
2525
|
+
const expiredAt = storedTokens?.access_token_expired_at;
|
|
2526
|
+
const displayName = raw.org ?? serverConfig.url;
|
|
2527
|
+
if (expiredAt && expiredAt - Date.now() > THREE_HOURS_MS) {
|
|
2528
|
+
console.log(`Logged in to ${displayName}.`);
|
|
2529
|
+
return;
|
|
2530
|
+
}
|
|
2523
2531
|
const resourceMetadataUrl = `${new URL(serverConfig.url).origin}/.well-known/oauth-protected-resource`;
|
|
2524
2532
|
const resourceMetadata = await fetchProtectedResourceMetadata(resourceMetadataUrl);
|
|
2525
2533
|
if (!resourceMetadata?.authorization_servers?.[0]) {
|
|
@@ -2529,12 +2537,12 @@ async function loginCommand(options) {
|
|
|
2529
2537
|
}
|
|
2530
2538
|
const authServerUrl = resourceMetadata.authorization_servers[0];
|
|
2531
2539
|
const resourceUrl = resourceMetadata.resource;
|
|
2532
|
-
console.error(`Logging in to ${
|
|
2540
|
+
console.error(`Logging in to ${displayName}...`);
|
|
2533
2541
|
const tokens = await performOAuthFlow(authServerUrl, resourceUrl);
|
|
2534
2542
|
if (!tokens) {
|
|
2535
2543
|
throw new Error("Login failed. OAuth flow did not return tokens.");
|
|
2536
2544
|
}
|
|
2537
|
-
console.log(`Logged in to ${
|
|
2545
|
+
console.log(`Logged in to ${displayName} successfully.`);
|
|
2538
2546
|
}
|
|
2539
2547
|
|
|
2540
2548
|
// src/commands/init.ts
|