@fourier-labs/harbour 0.1.7 → 0.1.8-rc.1

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.
@@ -4,7 +4,7 @@ import { chmod, mkdir, readFile, rm, writeFile } from "node:fs/promises";
4
4
  import { homedir, platform } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
  import { spawn } from "node:child_process";
7
- const scopes = "harbour:operate harbour:source-save offline_access";
7
+ export const requestedOAuthScopes = "mcp";
8
8
  export function tokenStorePath(env = process.env) {
9
9
  return join(env.XDG_CONFIG_HOME?.trim() || join(homedir(), ".config"), "harbour", "tokens.json");
10
10
  }
@@ -65,7 +65,7 @@ export async function login(mcpUrl, tenant, output) {
65
65
  const state = randomBytes(24).toString("base64url");
66
66
  const challenge = createHash("sha256").update(verifier).digest("base64url");
67
67
  const authorize = new URL(metadata.authorization_endpoint);
68
- authorize.search = new URLSearchParams({ response_type: "code", client_id: registered.client_id, redirect_uri: callback.redirectUri, scope: scopes, state, resource: mcpUrl, code_challenge: challenge, code_challenge_method: "S256" }).toString();
68
+ authorize.search = new URLSearchParams({ response_type: "code", client_id: registered.client_id, redirect_uri: callback.redirectUri, scope: requestedOAuthScopes, state, resource: mcpUrl, code_challenge: challenge, code_challenge_method: "S256" }).toString();
69
69
  output("Harbour is opening your browser to sign in.");
70
70
  openBrowser(authorize.toString());
71
71
  output(`If it does not open, visit: ${authorize}`);
@@ -109,7 +109,7 @@ async function discover(mcpUrl) {
109
109
  const server = protectedResource.authorization_servers?.[0];
110
110
  if (!server)
111
111
  throw new Error("Harbour did not advertise a sign-in service.");
112
- const wellKnown = new URL("/.well-known/oauth-authorization-server", server).toString();
112
+ const wellKnown = authorizationServerMetadataUrl(server);
113
113
  const metadata = await json(wellKnown);
114
114
  if (!metadata.authorization_endpoint || !metadata.token_endpoint || !metadata.registration_endpoint)
115
115
  throw new Error("Harbour sign-in metadata is incomplete.");
@@ -123,6 +123,7 @@ async function token(endpoint, values) {
123
123
  }
124
124
  async function json(url, init) { const response = await fetch(url, { ...init, redirect: "error" }); if (!response.ok)
125
125
  throw new Error(`Harbour sign-in request failed (${response.status}).`); return response.json(); }
126
+ export function authorizationServerMetadataUrl(server) { return `${server.replace(/\/$/, "")}/.well-known/oauth-authorization-server`; }
126
127
  function validToken(value) { return Boolean(value && typeof value === "object" && typeof value.accessToken === "string" && typeof value.clientId === "string" && typeof value.tokenEndpoint === "string"); }
127
128
  function isMissing(error) { return Boolean(error && typeof error === "object" && error.code === "ENOENT"); }
128
129
  function loopbackCallback() {
@@ -1 +1 @@
1
- export const CLI_VERSION = "0.1.7";
1
+ export const CLI_VERSION = "0.1.8-rc.1";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fourier-labs/harbour",
3
- "version": "0.1.7",
3
+ "version": "0.1.8-rc.1",
4
4
  "description": "Harbour productionisation helper",
5
5
  "type": "module",
6
6
  "bin": { "harbour": "./dist/packages/harbour-cli/src/cli.js" },