@hyperstar/mcp 0.1.17 → 0.1.18

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.
@@ -9,7 +9,7 @@ export function createCliAuthClient(options) {
9
9
  code,
10
10
  code_verifier: verifier,
11
11
  client_id: CLI_CLIENT_ID,
12
- redirect_uri: redirectUri,
12
+ loopback_redirect: toLoopbackRedirect(redirectUri),
13
13
  }),
14
14
  refresh: async (refreshToken) => requestRefresh(fetcher, options.apiBaseUrl, now, {
15
15
  refresh_token: refreshToken,
@@ -102,6 +102,23 @@ async function requestToken(fetcher, apiBaseUrl, now, body) {
102
102
  }
103
103
  return parseTokenPair(payload, now);
104
104
  }
105
+ /** Convert the local callback URL to the API-safe descriptor. */
106
+ function toLoopbackRedirect(redirectUri) {
107
+ const url = new URL(redirectUri);
108
+ const port = Number(url.port);
109
+ if (url.protocol !== "http:" ||
110
+ url.pathname !== "/callback" ||
111
+ (url.hostname !== "127.0.0.1" && url.hostname !== "localhost") ||
112
+ !Number.isInteger(port) ||
113
+ port < 1024 ||
114
+ port > 65535) {
115
+ throw new Error("Hyperstar CLI callback URL was invalid");
116
+ }
117
+ return {
118
+ host: url.hostname === "127.0.0.1" ? "ipv4" : "localhost",
119
+ port,
120
+ };
121
+ }
105
122
  /** Rotate a refresh token using the backend refresh route. */
106
123
  async function requestRefresh(fetcher, apiBaseUrl, now, body) {
107
124
  const response = await fetcher(buildApiUrl(apiBaseUrl, "/api/v1/cli-auth/refresh"), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperstar/mcp",
3
- "version": "0.1.17",
3
+ "version": "0.1.18",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "description": "Local stdio MCP server and CLI for Hyperstar headless workflows.",