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