autorouter-mcp 0.2.6 → 0.2.7

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/README.md CHANGED
@@ -370,6 +370,7 @@ autorouter update --check # is there a newer version?
370
370
  autorouter login # which servers need a grant
371
371
  autorouter login remote-server # authorize one (opens a browser)
372
372
  autorouter login remote-server --device # headless: enter a code elsewhere
373
+ autorouter login remote-server --no-reindex # authorize, index later
373
374
  autorouter logout remote-server # forget a stored grant
374
375
  ```
375
376
 
@@ -410,9 +411,17 @@ has a token to borrow:
410
411
 
411
412
  ```sh
412
413
  autorouter login remote-server
413
- autorouter reindex
414
414
  ```
415
415
 
416
+ A new grant is followed by a reindex automatically, because the capabilities
417
+ behind it are not searchable until the catalog has seen them — a grant on its
418
+ own changes nothing the router can reach. `--no-reindex` skips it when you are
419
+ authorizing several servers in a row and would rather index once at the end.
420
+
421
+ Only a login that actually stores a new grant triggers it. `--list-scopes` and a
422
+ server that already had a grant both change nothing, so neither pays for an
423
+ index rebuild.
424
+
416
425
  Registration is RFC 7591 dynamic client registration, so there is no app to
417
426
  create first. Tokens live in `~/.autorouter/oauth/<server>.json` at `0600` and
418
427
  are refreshed automatically; `logout` deletes them. The loopback redirect uses a
package/dist/cli.js CHANGED
@@ -22323,6 +22323,7 @@ async function runLogin(opts) {
22323
22323
  return result;
22324
22324
  return {
22325
22325
  ok: true,
22326
+ authorized: true,
22326
22327
  message: `${entry.name}: authorized.` + (result.grantedScope ? `
22327
22328
  ${summarizeScopes(result.grantedScope)}` : "")
22328
22329
  };
@@ -22466,7 +22467,11 @@ Opening your browser to authorize ${entry.name}:
22466
22467
  try {
22467
22468
  const first = await auth(provider, { serverUrl: entry.url, scope });
22468
22469
  if (first === "AUTHORIZED") {
22469
- return { ok: true, message: `${entry.name}: already authorized (existing grant is still valid).` };
22470
+ return {
22471
+ ok: true,
22472
+ authorized: true,
22473
+ message: `${entry.name}: already authorized (existing grant is still valid).`
22474
+ };
22470
22475
  }
22471
22476
  pendingState = (await readAuth(entry.name)).state;
22472
22477
  const code = mode === "manual" ? await readPastedCode(pendingState) : await withTimeout2(codePromise, 5 * 60000, "waiting for the browser callback");
@@ -22478,8 +22483,12 @@ Opening your browser to authorize ${entry.name}:
22478
22483
  await writeAuth(entry.name, { requestedScope: scope });
22479
22484
  const stored = await readAuth(entry.name);
22480
22485
  const granted = stored.tokens?.scope ?? scope;
22481
- return { ok: true, message: `${entry.name}: authorized.${granted ? `
22482
- ${summarizeScopes(granted)}` : ""}` };
22486
+ return {
22487
+ ok: true,
22488
+ authorized: true,
22489
+ message: `${entry.name}: authorized.${granted ? `
22490
+ ${summarizeScopes(granted)}` : ""}`
22491
+ };
22483
22492
  } catch (err) {
22484
22493
  return { ok: false, message: `${entry.name}: ${err instanceof Error ? err.message : String(err)}` };
22485
22494
  } finally {
@@ -22814,7 +22823,7 @@ Updated to ${latest.version}. Restart any harness with the router running to pic
22814
22823
  }
22815
22824
 
22816
22825
  // src/cli.ts
22817
- var VERSION2 = "0.2.6";
22826
+ var VERSION2 = "0.2.7";
22818
22827
  var USAGE = `autorouter — one search tool instead of every tool
22819
22828
 
22820
22829
  autorouter serve Run as an MCP server over stdio (default)
@@ -22870,6 +22879,7 @@ Options
22870
22879
  any narrowing the previous grant carried
22871
22880
  --scopes S login: request exactly these scopes (comma or space separated)
22872
22881
  --list-scopes login: show what the server offers, authorize nothing
22882
+ --no-reindex login: skip the reindex that otherwise follows a new grant
22873
22883
  --device login: RFC 8628 — print a code to enter on another device and
22874
22884
  poll for the result. No browser or open port needed here.
22875
22885
  --manual login: print the authorization URL, then read the redirect you
@@ -22899,15 +22909,9 @@ async function main(argv) {
22899
22909
  return await cmdCall(positionals[0], flags);
22900
22910
  case "list":
22901
22911
  return await cmdList(flags);
22902
- case "reindex": {
22903
- const router = await Router.create({ force: true });
22904
- console.log(`Reindexed: ${router.summary()}`);
22905
- const failures = Object.entries(router.catalog.errors);
22906
- for (const [name, err] of failures)
22907
- console.error(` unreachable: ${name}: ${oneLine(err, 100)}`);
22908
- await router.close();
22912
+ case "reindex":
22913
+ await cmdReindex();
22909
22914
  return 0;
22910
- }
22911
22915
  case "doctor":
22912
22916
  console.log(await runDoctor(process.cwd()));
22913
22917
  return 0;
@@ -22989,6 +22993,14 @@ async function cmdRemove(name) {
22989
22993
  console.log(await runRemove(name));
22990
22994
  return 0;
22991
22995
  }
22996
+ async function cmdReindex() {
22997
+ const router = await Router.create({ force: true });
22998
+ console.log(`Reindexed: ${router.summary()}`);
22999
+ for (const [name, err] of Object.entries(router.catalog.errors)) {
23000
+ console.error(` unreachable: ${name}: ${oneLine(err, 100)}`);
23001
+ }
23002
+ await router.close();
23003
+ }
22992
23004
  async function cmdLogin(server, flags) {
22993
23005
  if (!server) {
22994
23006
  const resolved = await resolveConfig(process.cwd());
@@ -23038,10 +23050,20 @@ ${pending.length} need a grant; each is a separate authorization:`);
23038
23050
  manual: Boolean(flags.manual)
23039
23051
  });
23040
23052
  console.log(result.message);
23041
- if (result.ok && !flags["list-scopes"]) {
23042
- console.log("Re-run `autorouter reindex` to pick up its capabilities.");
23053
+ if (!result.authorized)
23054
+ return result.ok ? 0 : 1;
23055
+ if (flags["no-reindex"]) {
23056
+ console.log("Skipped the reindex; run `autorouter reindex` to pick up its capabilities.");
23057
+ return 0;
23043
23058
  }
23044
- return result.ok ? 0 : 1;
23059
+ try {
23060
+ await cmdReindex();
23061
+ } catch (err) {
23062
+ console.error(`
23063
+ The grant was saved, but the reindex failed: ${oneLine(err instanceof Error ? err.message : String(err), 200)}
23064
+ ` + ` Run \`autorouter reindex\` once that is resolved.`);
23065
+ }
23066
+ return 0;
23045
23067
  }
23046
23068
  async function cmdLogout(server) {
23047
23069
  if (!server) {
@@ -23326,7 +23348,7 @@ function parseArgs(argv) {
23326
23348
  command = `--${name}`;
23327
23349
  continue;
23328
23350
  }
23329
- const boolean = ["raw", "json", "yes", "dry-run", "force", "servers-only", "read-only", "all-scopes", "list-scopes", "device", "manual", "check"].includes(name) && !(name === "json" && command === "add");
23351
+ const boolean = ["raw", "json", "yes", "dry-run", "force", "servers-only", "read-only", "all-scopes", "list-scopes", "device", "manual", "check", "no-reindex"].includes(name) && !(name === "json" && command === "add");
23330
23352
  if (boolean) {
23331
23353
  flags[name] = true;
23332
23354
  } else if (inline !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "autorouter-mcp",
3
- "version": "0.2.6",
3
+ "version": "0.2.7",
4
4
  "description": "One search tool instead of every tool: an MCP capability router for Claude Code, Codex, Cursor and anything else that speaks MCP.",
5
5
  "mcpName": "io.github.Webb-Ventures/autorouter",
6
6
  "license": "MIT",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "io.github.Webb-Ventures/autorouter",
4
4
  "title": "autorouter",
5
5
  "description": "An MCP capability router: one search tool instead of every server's tool schema.",
6
- "version": "0.2.6",
6
+ "version": "0.2.7",
7
7
  "websiteUrl": "https://github.com/Webb-Ventures/autorouter",
8
8
  "repository": {
9
9
  "url": "https://github.com/Webb-Ventures/autorouter",
@@ -14,7 +14,7 @@
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "autorouter-mcp",
17
- "version": "0.2.6",
17
+ "version": "0.2.7",
18
18
  "transport": { "type": "stdio" },
19
19
  "packageArguments": [{ "type": "positional", "value": "serve" }],
20
20
  "environmentVariables": [