@toolsdk.ai/registry 1.0.148 → 1.0.149
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.
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* 2. Callback: Exchange code for tokens + Notify caller
|
|
7
7
|
* 3. Refresh: Refresh access token
|
|
8
8
|
*/
|
|
9
|
-
import {
|
|
9
|
+
import { getRegistryBaseUrl } from "../../shared/config/environment";
|
|
10
10
|
import { createErrorResponse, createResponse } from "../../shared/utils/response-util";
|
|
11
11
|
import { repository } from "../package/package-handler";
|
|
12
12
|
import { oauthSessionStore } from "./oauth-session";
|
|
@@ -15,10 +15,8 @@ import { buildAuthorizationUrl, discoverAuthServerMetadata, discoverProtectedRes
|
|
|
15
15
|
* Get the Registry's OAuth callback URL
|
|
16
16
|
*/
|
|
17
17
|
function getRegistryCallbackUrl() {
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
const protocol = process.env.REGISTRY_PROTOCOL || "http";
|
|
21
|
-
return `${protocol}://${host}/api/v1/oauth/callback`;
|
|
18
|
+
const baseUrl = getRegistryBaseUrl();
|
|
19
|
+
return `${baseUrl}/api/v1/oauth/callback`;
|
|
22
20
|
}
|
|
23
21
|
/**
|
|
24
22
|
* Get MCP Server URL from package configuration
|
|
@@ -41,6 +41,14 @@ export function getServerPort() {
|
|
|
41
41
|
const port = process.env.PORT || process.env.MCP_SERVER_PORT;
|
|
42
42
|
return port ? parseInt(port, 10) : 3003;
|
|
43
43
|
}
|
|
44
|
+
export function getRegistryBaseUrl() {
|
|
45
|
+
const baseUrl = process.env.REGISTRY_BASE_URL;
|
|
46
|
+
if (baseUrl) {
|
|
47
|
+
return baseUrl.replace(/\/$/, "");
|
|
48
|
+
}
|
|
49
|
+
const port = getServerPort();
|
|
50
|
+
return `http://localhost:${port}`;
|
|
51
|
+
}
|
|
44
52
|
export function isSearchEnabled() {
|
|
45
53
|
return process.env.ENABLE_SEARCH === "true";
|
|
46
54
|
}
|