Skip to content

Commit 760b569

Browse files
napoleondclaude
andcommitted
feat(atxp): show registered phone number in whoami output
Fetches phone number from phone.mcp.atxp.ai in parallel with the account info request and displays it when present. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 24a1530 commit 760b569

File tree

1 file changed

+17
-6
lines changed

1 file changed

+17
-6
lines changed

packages/atxp/src/commands/whoami.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import chalk from 'chalk';
22
import { getConnection } from '../config.js';
3+
import { callTool } from '../call-tool.js';
34

45
const DEFAULT_ACCOUNTS_URL = 'https://accounts.atxp.ai';
56

@@ -42,12 +43,19 @@ export async function whoamiCommand(): Promise<void> {
4243

4344
try {
4445
const credentials = Buffer.from(`${token}:`).toString('base64');
45-
const response = await fetch(`${baseUrl}/me`, {
46-
headers: {
47-
'Authorization': `Basic ${credentials}`,
48-
'Content-Type': 'application/json',
49-
},
50-
});
46+
47+
// Fetch account info and phone number in parallel
48+
const [response, phoneNumber] = await Promise.all([
49+
fetch(`${baseUrl}/me`, {
50+
headers: {
51+
'Authorization': `Basic ${credentials}`,
52+
'Content-Type': 'application/json',
53+
},
54+
}),
55+
callTool('phone.mcp.atxp.ai', 'phone_check_sms', {})
56+
.then((r) => { try { return JSON.parse(r).phoneNumber || null; } catch { return null; } })
57+
.catch(() => null),
58+
]);
5159

5260
if (!response.ok) {
5361
if (response.status === 401) {
@@ -79,6 +87,9 @@ export async function whoamiCommand(): Promise<void> {
7987
if (data.email) {
8088
console.log(' ' + chalk.bold('Email:') + ' ' + chalk.cyan(data.email));
8189
}
90+
if (phoneNumber) {
91+
console.log(' ' + chalk.bold('Phone:') + ' ' + chalk.cyan(phoneNumber));
92+
}
8293
if (data.displayName) {
8394
console.log(' ' + chalk.bold('Display Name:') + ' ' + data.displayName);
8495
}

0 commit comments

Comments
 (0)