@stage-labs/metro 0.1.0-beta.17 → 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.
- package/dist/api.js +15 -8
- package/dist/cli.js +10 -9
- package/package.json +1 -1
package/dist/api.js
CHANGED
|
@@ -68,20 +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.
|
|
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 {
|
|
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/
|
|
82
|
+
const body = await get('/api/cli/mcp');
|
|
78
83
|
if (!isRecord(body) || typeof body.json !== 'string')
|
|
79
84
|
throw new Error('metro returned an unexpected response');
|
|
80
85
|
return body.json;
|
|
81
86
|
}
|
|
82
|
-
export async function
|
|
83
|
-
const body = await get('/api/session');
|
|
84
|
-
if (!isRecord(body) ||
|
|
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')
|
|
85
92
|
throw new Error('metro returned an unexpected response');
|
|
86
|
-
return body.email;
|
|
93
|
+
return { email: body.email, collection: body.collection };
|
|
87
94
|
}
|
package/dist/cli.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { claimCode, mcpServers, NotSignedIn,
|
|
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
|
|
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
|
|
12
|
-
metro mcp print
|
|
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(`
|
|
26
|
-
const {
|
|
27
|
-
writeToken(
|
|
28
|
-
process.stderr.write(`
|
|
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
|
-
|
|
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.
|
|
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": {
|