@equationalapplications/mcp-server 7.17.0 → 7.17.2

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/cli.js CHANGED
@@ -105,12 +105,14 @@ async function registerByEmail(client, email, opts) {
105
105
  }
106
106
  let ambiguousPoll = false;
107
107
  let intervalSeconds = Math.max(1, reg.poll.interval ?? 5);
108
+ let lastRemedy = null;
109
+ let remedyBackoffSeconds = 0;
108
110
  opts.info(`Check ${email} for a SynapseTree approval link (usually within a minute; it expires in 15 minutes).`);
109
111
  opts.info(`Approve only if the page shows this code: ${reg.user_code}`);
110
112
  for (; ; ) {
111
113
  const remaining = deadline - now();
112
114
  if (remaining <= 0) throw new ClaimError("invalid_grant", EXPIRED_MESSAGE);
113
- await sleep(Math.min(Math.max(intervalSeconds, 1), 60, remaining) * 1e3);
115
+ await sleep(Math.min(Math.max(intervalSeconds + remedyBackoffSeconds, 1) * 1e3, 6e4, remaining));
114
116
  let res;
115
117
  try {
116
118
  res = await client.call("oauthToken", { form: { grant_type: reg.poll.grant, assertion: reg.claim_token } });
@@ -136,9 +138,13 @@ async function registerByEmail(client, email, opts) {
136
138
  switch (body.error) {
137
139
  case "authorization_pending":
138
140
  if (typeof body.interval === "number") intervalSeconds = Math.max(1, body.interval);
141
+ lastRemedy = null;
142
+ remedyBackoffSeconds = 0;
139
143
  continue;
140
144
  case "slow_down":
141
145
  intervalSeconds = typeof body.interval === "number" ? Math.max(1, body.interval) : intervalSeconds + 5;
146
+ lastRemedy = null;
147
+ remedyBackoffSeconds = 0;
142
148
  continue;
143
149
  case "invalid_grant":
144
150
  throw new ClaimError(
@@ -147,8 +153,13 @@ async function registerByEmail(client, email, opts) {
147
153
  );
148
154
  default:
149
155
  if (REMEDY_CODES.has(body.error)) {
150
- opts.info(`${body.error}: ${body.error_description ?? "the account owner must clear this in the dashboard"}${body.error_uri ? ` \u2014 ${body.error_uri}` : ""}`);
151
- opts.info("Waiting; approve again once it is fixed.");
156
+ if (body.error !== lastRemedy) {
157
+ opts.info(`${body.error}: ${body.error_description ?? "the account owner must clear this in the dashboard"}${body.error_uri ? ` \u2014 ${body.error_uri}` : ""}`);
158
+ opts.info("Waiting; approve again once it is fixed.");
159
+ lastRemedy = body.error;
160
+ }
161
+ if (typeof body.interval === "number") intervalSeconds = Math.max(1, body.interval);
162
+ remedyBackoffSeconds = Math.min(remedyBackoffSeconds + 5, 25);
152
163
  continue;
153
164
  }
154
165
  throw new ClaimError(body.error, `${body.error}${body.error_description ? `: ${body.error_description}` : ""}`);
@@ -4504,7 +4515,7 @@ var TOOLS = [
4504
4515
  TOOLS.map((t) => t.name);
4505
4516
 
4506
4517
  // src/version.ts
4507
- var VERSION = "7.17.0" ;
4518
+ var VERSION = "7.17.2" ;
4508
4519
 
4509
4520
  // src/server.ts
4510
4521
  var SERVER_NAME = "synapsetree";