oauth-callback 1.2.1 → 1.2.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/mcp.js CHANGED
@@ -47,16 +47,15 @@ function inMemoryStore() {
47
47
  }
48
48
 
49
49
  // node_modules/open/index.js
50
- import process6 from "node:process";
51
- import { Buffer } from "node:buffer";
50
+ import process7 from "node:process";
52
51
  import path from "node:path";
53
52
  import { fileURLToPath } from "node:url";
54
- import { promisify as promisify5 } from "node:util";
55
- import childProcess from "node:child_process";
53
+ import childProcess3 from "node:child_process";
56
54
  import fs5, { constants as fsConstants2 } from "node:fs/promises";
57
55
 
58
56
  // node_modules/wsl-utils/index.js
59
- import process2 from "node:process";
57
+ import { promisify as promisify2 } from "node:util";
58
+ import childProcess2 from "node:child_process";
60
59
  import fs4, { constants as fsConstants } from "node:fs/promises";
61
60
 
62
61
  // node_modules/is-wsl/index.js
@@ -128,7 +127,54 @@ var isWsl = () => {
128
127
  };
129
128
  var is_wsl_default = process.env.__IS_WSL_TEST__ ? isWsl : isWsl();
130
129
 
130
+ // node_modules/powershell-utils/index.js
131
+ import process2 from "node:process";
132
+ import { Buffer } from "node:buffer";
133
+ import { promisify } from "node:util";
134
+ import childProcess from "node:child_process";
135
+ var execFile = promisify(childProcess.execFile);
136
+ var powerShellPath = () => `${process2.env.SYSTEMROOT || process2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
137
+ var executePowerShell = async (command, options = {}) => {
138
+ const {
139
+ powerShellPath: psPath,
140
+ ...execFileOptions
141
+ } = options;
142
+ const encodedCommand = executePowerShell.encodeCommand(command);
143
+ return execFile(psPath ?? powerShellPath(), [
144
+ ...executePowerShell.argumentsPrefix,
145
+ encodedCommand
146
+ ], {
147
+ encoding: "utf8",
148
+ ...execFileOptions
149
+ });
150
+ };
151
+ executePowerShell.argumentsPrefix = [
152
+ "-NoProfile",
153
+ "-NonInteractive",
154
+ "-ExecutionPolicy",
155
+ "Bypass",
156
+ "-EncodedCommand"
157
+ ];
158
+ executePowerShell.encodeCommand = (command) => Buffer.from(command, "utf16le").toString("base64");
159
+ executePowerShell.escapeArgument = (value) => `'${String(value).replaceAll("'", "''")}'`;
160
+
161
+ // node_modules/wsl-utils/utilities.js
162
+ function parseMountPointFromConfig(content) {
163
+ for (const line of content.split(`
164
+ `)) {
165
+ if (/^\s*#/.test(line)) {
166
+ continue;
167
+ }
168
+ const match = /^\s*root\s*=\s*(?<mountPoint>"[^"]*"|'[^']*'|[^#]*)/.exec(line);
169
+ if (!match) {
170
+ continue;
171
+ }
172
+ return match.groups.mountPoint.trim().replaceAll(/^["']|["']$/g, "");
173
+ }
174
+ }
175
+
131
176
  // node_modules/wsl-utils/index.js
177
+ var execFile2 = promisify2(childProcess2.execFile);
132
178
  var wslDrivesMountPoint = (() => {
133
179
  const defaultMountPoint = "/mnt/";
134
180
  let mountPoint;
@@ -146,11 +192,11 @@ var wslDrivesMountPoint = (() => {
146
192
  return defaultMountPoint;
147
193
  }
148
194
  const configContent = await fs4.readFile(configFilePath, { encoding: "utf8" });
149
- const configMountPoint = /(?<!#.*)root\s*=\s*(?<mountPoint>.*)/g.exec(configContent);
150
- if (!configMountPoint) {
195
+ const parsedMountPoint = parseMountPointFromConfig(configContent);
196
+ if (parsedMountPoint === undefined) {
151
197
  return defaultMountPoint;
152
198
  }
153
- mountPoint = configMountPoint.groups.mountPoint.trim();
199
+ mountPoint = parsedMountPoint;
154
200
  mountPoint = mountPoint.endsWith("/") ? mountPoint : `${mountPoint}/`;
155
201
  return mountPoint;
156
202
  };
@@ -159,11 +205,36 @@ var powerShellPathFromWsl = async () => {
159
205
  const mountPoint = await wslDrivesMountPoint();
160
206
  return `${mountPoint}c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe`;
161
207
  };
162
- var powerShellPath = async () => {
163
- if (is_wsl_default) {
164
- return powerShellPathFromWsl();
208
+ var powerShellPath2 = is_wsl_default ? powerShellPathFromWsl : powerShellPath;
209
+ var canAccessPowerShellPromise;
210
+ var canAccessPowerShell = async () => {
211
+ canAccessPowerShellPromise ??= (async () => {
212
+ try {
213
+ const psPath = await powerShellPath2();
214
+ await fs4.access(psPath, fsConstants.X_OK);
215
+ return true;
216
+ } catch {
217
+ return false;
218
+ }
219
+ })();
220
+ return canAccessPowerShellPromise;
221
+ };
222
+ var wslDefaultBrowser = async () => {
223
+ const psPath = await powerShellPath2();
224
+ const command = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
225
+ const { stdout } = await executePowerShell(command, { powerShellPath: psPath });
226
+ return stdout.trim();
227
+ };
228
+ var convertWslPathToWindows = async (path) => {
229
+ if (/^[a-z]+:\/\//i.test(path)) {
230
+ return path;
231
+ }
232
+ try {
233
+ const { stdout } = await execFile2("wslpath", ["-aw", path], { encoding: "utf8" });
234
+ return stdout.trim();
235
+ } catch {
236
+ return path;
165
237
  }
166
- return `${process2.env.SYSTEMROOT || process2.env.windir || String.raw`C:\Windows`}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`;
167
238
  };
168
239
 
169
240
  // node_modules/define-lazy-prop/index.js
@@ -185,15 +256,15 @@ function defineLazyProperty(object, propertyName, valueGetter) {
185
256
  }
186
257
 
187
258
  // node_modules/default-browser/index.js
188
- import { promisify as promisify4 } from "node:util";
259
+ import { promisify as promisify6 } from "node:util";
189
260
  import process5 from "node:process";
190
- import { execFile as execFile4 } from "node:child_process";
261
+ import { execFile as execFile6 } from "node:child_process";
191
262
 
192
263
  // node_modules/default-browser-id/index.js
193
- import { promisify } from "node:util";
264
+ import { promisify as promisify3 } from "node:util";
194
265
  import process3 from "node:process";
195
- import { execFile } from "node:child_process";
196
- var execFileAsync = promisify(execFile);
266
+ import { execFile as execFile3 } from "node:child_process";
267
+ var execFileAsync = promisify3(execFile3);
197
268
  async function defaultBrowserId() {
198
269
  if (process3.platform !== "darwin") {
199
270
  throw new Error("macOS only");
@@ -205,9 +276,9 @@ async function defaultBrowserId() {
205
276
 
206
277
  // node_modules/run-applescript/index.js
207
278
  import process4 from "node:process";
208
- import { promisify as promisify2 } from "node:util";
209
- import { execFile as execFile2, execFileSync } from "node:child_process";
210
- var execFileAsync2 = promisify2(execFile2);
279
+ import { promisify as promisify4 } from "node:util";
280
+ import { execFile as execFile4, execFileSync } from "node:child_process";
281
+ var execFileAsync2 = promisify4(execFile4);
211
282
  async function runAppleScript(script, { humanReadableOutput = true } = {}) {
212
283
  if (process4.platform !== "darwin") {
213
284
  throw new Error("macOS only");
@@ -224,20 +295,28 @@ tell application "System Events" to get value of property list item "CFBundleNam
224
295
  }
225
296
 
226
297
  // node_modules/default-browser/windows.js
227
- import { promisify as promisify3 } from "node:util";
228
- import { execFile as execFile3 } from "node:child_process";
229
- var execFileAsync3 = promisify3(execFile3);
298
+ import { promisify as promisify5 } from "node:util";
299
+ import { execFile as execFile5 } from "node:child_process";
300
+ var execFileAsync3 = promisify5(execFile5);
230
301
  var windowsBrowserProgIds = {
231
- AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
232
- MSEdgeDHTML: { name: "Edge", id: "com.microsoft.edge" },
233
302
  MSEdgeHTM: { name: "Edge", id: "com.microsoft.edge" },
234
- "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" },
235
- FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
303
+ MSEdgeBHTML: { name: "Edge Beta", id: "com.microsoft.edge.beta" },
304
+ MSEdgeDHTML: { name: "Edge Dev", id: "com.microsoft.edge.dev" },
305
+ AppXq0fevzme2pys62n3e0fbqa7peapykr8v: { name: "Edge", id: "com.microsoft.edge.old" },
236
306
  ChromeHTML: { name: "Chrome", id: "com.google.chrome" },
307
+ ChromeBHTML: { name: "Chrome Beta", id: "com.google.chrome.beta" },
308
+ ChromeDHTML: { name: "Chrome Dev", id: "com.google.chrome.dev" },
309
+ ChromiumHTM: { name: "Chromium", id: "org.chromium.Chromium" },
237
310
  BraveHTML: { name: "Brave", id: "com.brave.Browser" },
238
311
  BraveBHTML: { name: "Brave Beta", id: "com.brave.Browser.beta" },
239
- BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" }
312
+ BraveDHTML: { name: "Brave Dev", id: "com.brave.Browser.dev" },
313
+ BraveSSHTM: { name: "Brave Nightly", id: "com.brave.Browser.nightly" },
314
+ FirefoxURL: { name: "Firefox", id: "org.mozilla.firefox" },
315
+ OperaStable: { name: "Opera", id: "com.operasoftware.Opera" },
316
+ VivaldiHTM: { name: "Vivaldi", id: "com.vivaldi.Vivaldi" },
317
+ "IE.HTTP": { name: "Internet Explorer", id: "com.microsoft.ie" }
240
318
  };
319
+ var _windowsBrowserProgIdMap = new Map(Object.entries(windowsBrowserProgIds));
241
320
 
242
321
  class UnknownBrowserError extends Error {
243
322
  }
@@ -261,7 +340,7 @@ async function defaultBrowser(_execFileAsync = execFileAsync3) {
261
340
  }
262
341
 
263
342
  // node_modules/default-browser/index.js
264
- var execFileAsync4 = promisify4(execFile4);
343
+ var execFileAsync4 = promisify6(execFile6);
265
344
  var titleize = (string) => string.toLowerCase().replaceAll(/(?:^|\s|-)\S/g, (x) => x.toUpperCase());
266
345
  async function defaultBrowser2() {
267
346
  if (process5.platform === "darwin") {
@@ -281,42 +360,29 @@ async function defaultBrowser2() {
281
360
  throw new Error("Only macOS, Linux, and Windows are supported");
282
361
  }
283
362
 
363
+ // node_modules/is-in-ssh/index.js
364
+ import process6 from "node:process";
365
+ var isInSsh = Boolean(process6.env.SSH_CONNECTION || process6.env.SSH_CLIENT || process6.env.SSH_TTY);
366
+ var is_in_ssh_default = isInSsh;
367
+
284
368
  // node_modules/open/index.js
285
- var execFile5 = promisify5(childProcess.execFile);
286
- var __dirname2 = path.dirname(fileURLToPath(import.meta.url));
369
+ var fallbackAttemptSymbol = Symbol("fallbackAttempt");
370
+ var __dirname2 = import.meta.url ? path.dirname(fileURLToPath(import.meta.url)) : "";
287
371
  var localXdgOpenPath = path.join(__dirname2, "xdg-open");
288
- var { platform, arch } = process6;
289
- async function getWindowsDefaultBrowserFromWsl() {
290
- const powershellPath = await powerShellPath();
291
- const rawCommand = String.raw`(Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice").ProgId`;
292
- const encodedCommand = Buffer.from(rawCommand, "utf16le").toString("base64");
293
- const { stdout } = await execFile5(powershellPath, [
294
- "-NoProfile",
295
- "-NonInteractive",
296
- "-ExecutionPolicy",
297
- "Bypass",
298
- "-EncodedCommand",
299
- encodedCommand
300
- ], { encoding: "utf8" });
301
- const progId = stdout.trim();
302
- const browserMap = {
303
- ChromeHTML: "com.google.chrome",
304
- BraveHTML: "com.brave.Browser",
305
- MSEdgeHTM: "com.microsoft.edge",
306
- FirefoxURL: "org.mozilla.firefox"
307
- };
308
- return browserMap[progId] ? { id: browserMap[progId] } : {};
309
- }
310
- var pTryEach = async (array, mapper) => {
311
- let latestError;
312
- for (const item of array) {
372
+ var { platform, arch } = process7;
373
+ var tryEachApp = async (apps, opener) => {
374
+ if (apps.length === 0) {
375
+ return;
376
+ }
377
+ const errors = [];
378
+ for (const app of apps) {
313
379
  try {
314
- return await mapper(item);
380
+ return await opener(app);
315
381
  } catch (error) {
316
- latestError = error;
382
+ errors.push(error);
317
383
  }
318
384
  }
319
- throw latestError;
385
+ throw new AggregateError(errors, "Failed to open in all supported apps");
320
386
  };
321
387
  var baseOpen = async (options) => {
322
388
  options = {
@@ -326,34 +392,39 @@ var baseOpen = async (options) => {
326
392
  allowNonzeroExitCode: false,
327
393
  ...options
328
394
  };
395
+ const isFallbackAttempt = options[fallbackAttemptSymbol] === true;
396
+ delete options[fallbackAttemptSymbol];
329
397
  if (Array.isArray(options.app)) {
330
- return pTryEach(options.app, (singleApp) => baseOpen({
398
+ return tryEachApp(options.app, (singleApp) => baseOpen({
331
399
  ...options,
332
- app: singleApp
400
+ app: singleApp,
401
+ [fallbackAttemptSymbol]: true
333
402
  }));
334
403
  }
335
404
  let { name: app, arguments: appArguments = [] } = options.app ?? {};
336
405
  appArguments = [...appArguments];
337
406
  if (Array.isArray(app)) {
338
- return pTryEach(app, (appName) => baseOpen({
407
+ return tryEachApp(app, (appName) => baseOpen({
339
408
  ...options,
340
409
  app: {
341
410
  name: appName,
342
411
  arguments: appArguments
343
- }
412
+ },
413
+ [fallbackAttemptSymbol]: true
344
414
  }));
345
415
  }
346
416
  if (app === "browser" || app === "browserPrivate") {
347
417
  const ids = {
348
418
  "com.google.chrome": "chrome",
349
419
  "google-chrome.desktop": "chrome",
350
- "com.brave.Browser": "brave",
420
+ "com.brave.browser": "brave",
351
421
  "org.mozilla.firefox": "firefox",
352
422
  "firefox.desktop": "firefox",
353
423
  "com.microsoft.msedge": "edge",
354
424
  "com.microsoft.edge": "edge",
355
425
  "com.microsoft.edgemac": "edge",
356
- "microsoft-edge.desktop": "edge"
426
+ "microsoft-edge.desktop": "edge",
427
+ "com.apple.safari": "safari"
357
428
  };
358
429
  const flags = {
359
430
  chrome: "--incognito",
@@ -361,10 +432,20 @@ var baseOpen = async (options) => {
361
432
  firefox: "--private-window",
362
433
  edge: "--inPrivate"
363
434
  };
364
- const browser = is_wsl_default ? await getWindowsDefaultBrowserFromWsl() : await defaultBrowser2();
435
+ let browser;
436
+ if (is_wsl_default) {
437
+ const progId = await wslDefaultBrowser();
438
+ const browserInfo = _windowsBrowserProgIdMap.get(progId);
439
+ browser = browserInfo ?? {};
440
+ } else {
441
+ browser = await defaultBrowser2();
442
+ }
365
443
  if (browser.id in ids) {
366
- const browserName = ids[browser.id];
444
+ const browserName = ids[browser.id.toLowerCase()];
367
445
  if (app === "browserPrivate") {
446
+ if (browserName === "safari") {
447
+ throw new Error("Safari doesn't support opening in private mode via command line");
448
+ }
368
449
  appArguments.push(flags[browserName]);
369
450
  }
370
451
  return baseOpen({
@@ -380,6 +461,10 @@ var baseOpen = async (options) => {
380
461
  let command;
381
462
  const cliArguments = [];
382
463
  const childProcessOptions = {};
464
+ let shouldUseWindowsInWsl = false;
465
+ if (is_wsl_default && !isInsideContainer() && !is_in_ssh_default && !app) {
466
+ shouldUseWindowsInWsl = await canAccessPowerShell();
467
+ }
383
468
  if (platform === "darwin") {
384
469
  command = "open";
385
470
  if (options.wait) {
@@ -394,29 +479,35 @@ var baseOpen = async (options) => {
394
479
  if (app) {
395
480
  cliArguments.push("-a", app);
396
481
  }
397
- } else if (platform === "win32" || is_wsl_default && !isInsideContainer() && !app) {
398
- command = await powerShellPath();
399
- cliArguments.push("-NoProfile", "-NonInteractive", "-ExecutionPolicy", "Bypass", "-EncodedCommand");
482
+ } else if (platform === "win32" || shouldUseWindowsInWsl) {
483
+ command = await powerShellPath2();
484
+ cliArguments.push(...executePowerShell.argumentsPrefix);
400
485
  if (!is_wsl_default) {
401
486
  childProcessOptions.windowsVerbatimArguments = true;
402
487
  }
403
- const encodedArguments = ["Start"];
488
+ if (is_wsl_default && options.target) {
489
+ options.target = await convertWslPathToWindows(options.target);
490
+ }
491
+ const encodedArguments = ["$ProgressPreference = 'SilentlyContinue';", "Start"];
404
492
  if (options.wait) {
405
493
  encodedArguments.push("-Wait");
406
494
  }
407
495
  if (app) {
408
- encodedArguments.push(`"\`"${app}\`""`);
496
+ encodedArguments.push(executePowerShell.escapeArgument(app));
409
497
  if (options.target) {
410
498
  appArguments.push(options.target);
411
499
  }
412
500
  } else if (options.target) {
413
- encodedArguments.push(`"${options.target}"`);
501
+ encodedArguments.push(executePowerShell.escapeArgument(options.target));
414
502
  }
415
503
  if (appArguments.length > 0) {
416
- appArguments = appArguments.map((argument) => `"\`"${argument}\`""`);
504
+ appArguments = appArguments.map((argument) => executePowerShell.escapeArgument(argument));
417
505
  encodedArguments.push("-ArgumentList", appArguments.join(","));
418
506
  }
419
- options.target = Buffer.from(encodedArguments.join(" "), "utf16le").toString("base64");
507
+ options.target = executePowerShell.encodeCommand(encodedArguments.join(" "));
508
+ if (!options.wait) {
509
+ childProcessOptions.stdio = "ignore";
510
+ }
420
511
  } else {
421
512
  if (app) {
422
513
  command = app;
@@ -427,7 +518,7 @@ var baseOpen = async (options) => {
427
518
  await fs5.access(localXdgOpenPath, fsConstants2.X_OK);
428
519
  exeLocalXdgOpen = true;
429
520
  } catch {}
430
- const useSystemXdgOpen = process6.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
521
+ const useSystemXdgOpen = process7.versions.electron ?? (platform === "android" || isBundled || !exeLocalXdgOpen);
431
522
  command = useSystemXdgOpen ? "xdg-open" : localXdgOpenPath;
432
523
  }
433
524
  if (appArguments.length > 0) {
@@ -444,12 +535,12 @@ var baseOpen = async (options) => {
444
535
  if (options.target) {
445
536
  cliArguments.push(options.target);
446
537
  }
447
- const subprocess = childProcess.spawn(command, cliArguments, childProcessOptions);
538
+ const subprocess = childProcess3.spawn(command, cliArguments, childProcessOptions);
448
539
  if (options.wait) {
449
540
  return new Promise((resolve, reject) => {
450
541
  subprocess.once("error", reject);
451
542
  subprocess.once("close", (exitCode) => {
452
- if (!options.allowNonzeroExitCode && exitCode > 0) {
543
+ if (!options.allowNonzeroExitCode && exitCode !== 0) {
453
544
  reject(new Error(`Exited with code ${exitCode}`));
454
545
  return;
455
546
  }
@@ -457,8 +548,30 @@ var baseOpen = async (options) => {
457
548
  });
458
549
  });
459
550
  }
551
+ if (isFallbackAttempt) {
552
+ return new Promise((resolve, reject) => {
553
+ subprocess.once("error", reject);
554
+ subprocess.once("spawn", () => {
555
+ subprocess.once("close", (exitCode) => {
556
+ subprocess.off("error", reject);
557
+ if (exitCode !== 0) {
558
+ reject(new Error(`Exited with code ${exitCode}`));
559
+ return;
560
+ }
561
+ subprocess.unref();
562
+ resolve(subprocess);
563
+ });
564
+ });
565
+ });
566
+ }
460
567
  subprocess.unref();
461
- return subprocess;
568
+ return new Promise((resolve, reject) => {
569
+ subprocess.once("error", reject);
570
+ subprocess.once("spawn", () => {
571
+ subprocess.off("error", reject);
572
+ resolve(subprocess);
573
+ });
574
+ });
462
575
  };
463
576
  var open = (target, options) => {
464
577
  if (typeof target !== "string") {
@@ -479,7 +592,7 @@ function detectArchBinary(binary) {
479
592
  }
480
593
  return archBinary;
481
594
  }
482
- function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
595
+ function detectPlatformBinary({ [platform]: platformBinary }, { wsl } = {}) {
483
596
  if (wsl && is_wsl_default) {
484
597
  return detectArchBinary(wsl);
485
598
  }
@@ -488,11 +601,14 @@ function detectPlatformBinary({ [platform]: platformBinary }, { wsl }) {
488
601
  }
489
602
  return detectArchBinary(platformBinary);
490
603
  }
491
- var apps = {};
604
+ var apps = {
605
+ browser: "browser",
606
+ browserPrivate: "browserPrivate"
607
+ };
492
608
  defineLazyProperty(apps, "chrome", () => detectPlatformBinary({
493
609
  darwin: "google chrome",
494
610
  win32: "chrome",
495
- linux: ["google-chrome", "google-chrome-stable", "chromium"]
611
+ linux: ["google-chrome", "google-chrome-stable", "chromium", "chromium-browser"]
496
612
  }, {
497
613
  wsl: {
498
614
  ia32: "/mnt/c/Program Files (x86)/Google/Chrome/Application/chrome.exe",
@@ -523,8 +639,9 @@ defineLazyProperty(apps, "edge", () => detectPlatformBinary({
523
639
  }, {
524
640
  wsl: "/mnt/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"
525
641
  }));
526
- defineLazyProperty(apps, "browser", () => "browser");
527
- defineLazyProperty(apps, "browserPrivate", () => "browserPrivate");
642
+ defineLazyProperty(apps, "safari", () => detectPlatformBinary({
643
+ darwin: "Safari"
644
+ }));
528
645
  var open_default = open;
529
646
 
530
647
  // src/errors.ts
@@ -695,6 +812,9 @@ class BunCallbackServer extends BaseCallbackServer {
695
812
  async stopServer() {
696
813
  if (!this.server)
697
814
  return;
815
+ while (this.server.pendingRequests > 0) {
816
+ await new Promise((resolve) => setTimeout(resolve, 10));
817
+ }
698
818
  this.server.stop();
699
819
  this.server = undefined;
700
820
  }
@@ -745,6 +865,7 @@ class NodeCallbackServer extends BaseCallbackServer {
745
865
  async stopServer() {
746
866
  if (!this.server)
747
867
  return;
868
+ this.server.closeAllConnections();
748
869
  return new Promise((resolve) => {
749
870
  this.server?.close(() => {
750
871
  this.server = undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mHAAmH;IACnH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oFAAoF;IACpF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,iEAAiE;IACjE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxE,4CAA4C;IAC5C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAoRD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAKrD"}
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,0CAA0C;IAC1C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kEAAkE;IAClE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,mHAAmH;IACnH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sDAAsD;IACtD,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,oFAAoF;IACpF,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,mDAAmD;IACnD,KAAK,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7C,iEAAiE;IACjE,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACxE,4CAA4C;IAC5C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;CACvB;AAyRD;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAKrD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oauth-callback",
3
- "version": "1.2.1",
4
- "description": "Lightweight OAuth 2.0 callback handler for Node.js, Deno, and Bun with built-in browser flow, MCP support, and zero dependencies",
3
+ "version": "1.2.2",
4
+ "description": "Lightweight OAuth 2.0 callback handler for Node.js, Deno, and Bun with built-in browser flow and MCP SDK integration",
5
5
  "keywords": [
6
6
  "oauth",
7
7
  "oauth2",
@@ -64,7 +64,7 @@
64
64
  "./package.json": "./package.json"
65
65
  },
66
66
  "dependencies": {
67
- "open": "^10.2.0"
67
+ "open": "^11.0.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@modelcontextprotocol/sdk": ">=1.17.0 <2",
@@ -79,15 +79,16 @@
79
79
  }
80
80
  },
81
81
  "devDependencies": {
82
- "@modelcontextprotocol/sdk": "^1.17.3",
83
- "@types/deno": "^2.3.0",
84
- "@types/node": "^24.3.0",
82
+ "@modelcontextprotocol/sdk": "^1.25.2",
83
+ "@types/bun": "^1.3.6",
84
+ "@types/deno": "^2.5.0",
85
+ "@types/node": "^24.10.9",
85
86
  "@types/open": "^6.2.1",
86
- "@types/bun": "^1.2.20",
87
- "mermaid": "^11.9.0",
88
- "prettier": "^3.6.2",
89
- "publint": "^0.3.12",
90
- "typescript": "^5.9.2",
87
+ "bun-types": "^1.2.20",
88
+ "mermaid": "^11.12.2",
89
+ "prettier": "^3.8.0",
90
+ "publint": "^0.3.16",
91
+ "typescript": "^5.9.3",
91
92
  "vitepress": "^1.6.4",
92
93
  "vitepress-plugin-mermaid": "^2.0.17"
93
94
  },