@topolo/mcp 0.11.9 → 0.11.10
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/index.js +51 -45
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -2818,52 +2818,58 @@ async function refreshCredentialIfNeeded(environment = selectedEnvironment(), op
|
|
|
2818
2818
|
if (process.env[`${prefix}_API_KEY`] || process.env[`${prefix}_ACCESS_TOKEN`] || environment === "production" && process.env.TOPOLO_API_KEY || environment === "production" && process.env.TOPOLO_ACCESS_TOKEN) {
|
|
2819
2819
|
return resolveCredential(environment);
|
|
2820
2820
|
}
|
|
2821
|
-
const
|
|
2822
|
-
|
|
2823
|
-
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
);
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
|
|
2858
|
-
|
|
2821
|
+
const observed = profileForEnvironment(await readConfig(), environment).credential;
|
|
2822
|
+
return withConfigWriteLock(async () => {
|
|
2823
|
+
const config = await readConfig();
|
|
2824
|
+
const profile = profileForEnvironment(config, environment);
|
|
2825
|
+
const cred = profile.credential;
|
|
2826
|
+
if (!cred || cred.kind !== "access_token") return cred ?? null;
|
|
2827
|
+
if (!cred.refreshToken || !profile.oauthClientId) return cred;
|
|
2828
|
+
if (options.force && observed?.kind === "access_token" && observed.accessToken !== cred.accessToken) {
|
|
2829
|
+
return cred;
|
|
2830
|
+
}
|
|
2831
|
+
const now = Math.floor(Date.now() / 1e3);
|
|
2832
|
+
if (!options.force && cred.expiresAt && cred.expiresAt - REFRESH_SKEW_SECONDS > now) return cred;
|
|
2833
|
+
const serviceUrls = resolveServiceUrls(profile.serviceUrls, environment);
|
|
2834
|
+
if (environment === "local" && !serviceUrls?.auth) {
|
|
2835
|
+
throw new TopoloSdkError2(
|
|
2836
|
+
"environment_service_url_required",
|
|
2837
|
+
"Local Topolo credential refresh requires an explicit local Auth service origin."
|
|
2838
|
+
);
|
|
2839
|
+
}
|
|
2840
|
+
try {
|
|
2841
|
+
const oauth = new TopoloOAuth({
|
|
2842
|
+
serviceUrls
|
|
2843
|
+
});
|
|
2844
|
+
const tokens = await oauth.refreshToken({
|
|
2845
|
+
clientId: profile.oauthClientId,
|
|
2846
|
+
refreshToken: cred.refreshToken
|
|
2847
|
+
});
|
|
2848
|
+
const refreshed = {
|
|
2849
|
+
kind: "access_token",
|
|
2850
|
+
accessToken: tokens.access_token,
|
|
2851
|
+
...tokens.refresh_token ? { refreshToken: tokens.refresh_token } : { refreshToken: cred.refreshToken },
|
|
2852
|
+
expiresAt: Math.floor(Date.now() / 1e3) + tokens.expires_in
|
|
2853
|
+
};
|
|
2854
|
+
const activeContext = profile.activeContext;
|
|
2855
|
+
const activeEntry = activeContext ? profile.contexts?.[activeContext] : void 0;
|
|
2856
|
+
const updated = activeContext && activeEntry ? writeProfileConfig(config, environment, {
|
|
2857
|
+
credential: refreshed,
|
|
2858
|
+
contexts: {
|
|
2859
|
+
...profile.contexts ?? {},
|
|
2860
|
+
[activeContext]: {
|
|
2861
|
+
...activeEntry,
|
|
2862
|
+
credential: refreshed,
|
|
2863
|
+
oauthClientId: activeEntry.oauthClientId ?? profile.oauthClientId
|
|
2864
|
+
}
|
|
2859
2865
|
}
|
|
2860
|
-
}
|
|
2861
|
-
|
|
2862
|
-
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
}
|
|
2866
|
+
}) : environment === "production" && !config.profiles?.production ? { ...config, credential: refreshed } : writeProfileConfig(config, environment, { credential: refreshed });
|
|
2867
|
+
await writeConfig(updated);
|
|
2868
|
+
return refreshed;
|
|
2869
|
+
} catch {
|
|
2870
|
+
return cred;
|
|
2871
|
+
}
|
|
2872
|
+
});
|
|
2867
2873
|
}
|
|
2868
2874
|
async function refreshContextCredentialIfNeeded(environment, key, options = {}) {
|
|
2869
2875
|
return withConfigWriteLock(async () => {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@topolo/mcp",
|
|
3
|
-
"version": "0.11.
|
|
4
|
-
"topoloPublishedVersion": "0.11.
|
|
3
|
+
"version": "0.11.10",
|
|
4
|
+
"topoloPublishedVersion": "0.11.10",
|
|
5
5
|
"description": "Model Context Protocol server for the Topolo platform. Exposes scope-gated tools that third-party agents (Claude, Codex, etc.) can call natively.",
|
|
6
6
|
"license": "UNLICENSED",
|
|
7
7
|
"author": "Topolo",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
38
|
-
"@topolo/sdk": "0.11.
|
|
38
|
+
"@topolo/sdk": "0.11.10"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
41
|
"@types/node": "^20.12.0",
|