@stage-labs/metro 0.1.0-beta.18 → 0.1.0-beta.19

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.
Files changed (3) hide show
  1. package/dist/api.js +16 -11
  2. package/dist/cli.js +10 -9
  3. package/package.json +1 -1
package/dist/api.js CHANGED
@@ -68,22 +68,27 @@ async function post(path, body) {
68
68
  export async function claimCode(code) {
69
69
  const body = await post('/api/cli/claim', { code });
70
70
  if (!isRecord(body) ||
71
- typeof body.session !== 'string' ||
72
- typeof body.email !== 'string')
71
+ typeof body.token !== 'string' ||
72
+ typeof body.email !== 'string' ||
73
+ typeof body.collection !== 'string')
73
74
  throw new Error('metro returned an unexpected response');
74
- return { session: body.session, email: body.email };
75
+ return {
76
+ token: body.token,
77
+ email: body.email,
78
+ collection: body.collection,
79
+ };
75
80
  }
76
81
  export async function mcpServers() {
77
- const body = await get('/api/connectors');
78
- if (!isRecord(body))
82
+ const body = await get('/api/cli/mcp');
83
+ if (!isRecord(body) || typeof body.json !== 'string')
79
84
  throw new Error('metro returned an unexpected response');
80
- if (typeof body.json !== 'string')
81
- throw new NotSignedIn('this sign-in cannot read your connectors — run `metro login` again');
82
85
  return body.json;
83
86
  }
84
- export async function sessionEmail() {
85
- const body = await get('/api/session');
86
- if (!isRecord(body) || typeof body.email !== 'string')
87
+ export async function whoisAuthorized() {
88
+ const body = await get('/api/cli/session');
89
+ if (!isRecord(body) ||
90
+ typeof body.email !== 'string' ||
91
+ typeof body.collection !== 'string')
87
92
  throw new Error('metro returned an unexpected response');
88
- return body.email;
93
+ return { email: body.email, collection: body.collection };
89
94
  }
package/dist/cli.js CHANGED
@@ -1,15 +1,15 @@
1
1
  #!/usr/bin/env node
2
- import { claimCode, mcpServers, NotSignedIn, sessionEmail } from './api.js';
2
+ import { claimCode, mcpServers, NotSignedIn, whoisAuthorized, } from './api.js';
3
3
  import { askLine } from './prompt.js';
4
4
  import { clearToken, credentialsPath, metroUrl, metroWebUrl, writeToken, } from './store.js';
5
5
  import { update } from './update.js';
6
6
  import { currentVersion } from './version.js';
7
7
  const USAGE = `metro — the command line for your MCP connectors
8
8
 
9
- metro login sign in with a code from the metro web UI
9
+ metro login authorize a connector collection with a code from the web UI
10
10
  metro logout forget this machine's sign-in
11
- metro whoami print the account this machine is signed in as
12
- metro mcp print an mcpServers block for every connector
11
+ metro whoami print the account and collection this machine may read
12
+ metro mcp print the mcpServers block for the authorized collection
13
13
  metro update update to the newest published version
14
14
  metro version print this CLI's version
15
15
 
@@ -22,13 +22,14 @@ Start Claude Code with all of them, without writing them to disk:
22
22
  METRO_UI_URL where the web UI lives (default https://metro.box)
23
23
  `;
24
24
  async function login() {
25
- process.stderr.write(`Get a code from ${metroWebUrl()}/#/settings\n`);
26
- const { session, email } = await claimCode(await askLine('Paste it here: '));
27
- writeToken(session);
28
- process.stderr.write(`Signed in as ${email}. Stored in ${credentialsPath()}\n`);
25
+ process.stderr.write(`Choose a connector collection at ${metroWebUrl()}/#/authorize\n`);
26
+ const { token, email, collection } = await claimCode(await askLine('Paste the code here: '));
27
+ writeToken(token);
28
+ process.stderr.write(`Authorized '${collection}' for ${email}. Stored in ${credentialsPath()}\n`);
29
29
  }
30
30
  async function whoami() {
31
- process.stdout.write(`${await sessionEmail()} on ${metroUrl()}\n`);
31
+ const { email, collection } = await whoisAuthorized();
32
+ process.stdout.write(`${email} · collection '${collection}' on ${metroUrl()}\n`);
32
33
  }
33
34
  const HELP = new Set([undefined, 'help', '--help', '-h']);
34
35
  const COMMANDS = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stage-labs/metro",
3
- "version": "0.1.0-beta.18",
3
+ "version": "0.1.0-beta.19",
4
4
  "description": "The metro command line. Sign in once per machine, then hand your MCP connector list to Claude Code without the credentials touching disk, argv or shell history.",
5
5
  "license": "MIT",
6
6
  "repository": {