tru-mcp 0.14.5 → 0.14.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.
@@ -14,6 +14,7 @@ export const authenticateTool = {
14
14
  handler: async (args) => {
15
15
  try {
16
16
  // Check if already authenticated (unless switching accounts)
17
+ let previousEmail = null;
17
18
  if (!args.switch_account) {
18
19
  const existing = await checkExistingAuth();
19
20
  if (existing) {
@@ -22,11 +23,11 @@ export const authenticateTool = {
22
23
  {
23
24
  type: "text",
24
25
  text: `Already authenticated as ${existing.email}.\n\n` +
25
- `IMPORTANT: Use AskUserQuestion to confirm this is the right account:\n` +
26
- ` question: "You're already logged in as ${existing.email}. Is this the account you want to use?"\n` +
26
+ `Use AskUserQuestion to confirm this is the right account:\n` +
27
+ ` question: "You're logged in as ${existing.email}. Is this the account you want to use?"\n` +
27
28
  ` options:\n` +
28
29
  ` - label: "Yes, continue"\n` +
29
- ` description: "Use ${existing.email} for this setup"\n` +
30
+ ` description: "Use ${existing.email}"\n` +
30
31
  ` - label: "Switch account"\n` +
31
32
  ` description: "Log in with a different email"\n` +
32
33
  `If they choose "Switch account", call login(switch_account: true).`,
@@ -35,22 +36,31 @@ export const authenticateTool = {
35
36
  };
36
37
  }
37
38
  }
39
+ else {
40
+ // Remember the current email before switching so we can detect if it didn't change
41
+ const existing = await checkExistingAuth();
42
+ previousEmail = existing?.email || null;
43
+ }
38
44
  const result = await loginViaBrowser({
39
45
  switchAccount: args.switch_account,
40
46
  });
47
+ // If this was a switch attempt but same email came back, don't loop — just proceed
48
+ const switchedButSame = args.switch_account && previousEmail === result.email;
41
49
  return {
42
50
  content: [
43
51
  {
44
52
  type: "text",
45
- text: `Authenticated successfully as ${result.email}. Credentials saved locally.\n\n` +
46
- `IMPORTANT: Use AskUserQuestion to confirm this is the right account before proceeding:\n` +
47
- ` question: "You're logged in as ${result.email}. Is this the account you want to use?"\n` +
48
- ` options:\n` +
49
- ` - label: "Yes, continue"\n` +
50
- ` description: "Use ${result.email} for this setup"\n` +
51
- ` - label: "Switch account"\n` +
52
- ` description: "Log in with a different email"\n` +
53
- `If they choose "Switch account", call login(switch_account: true).`,
53
+ text: switchedButSame
54
+ ? `Authenticated as ${result.email} (same account). Proceeding with this account.`
55
+ : `Authenticated successfully as ${result.email}. Credentials saved locally.\n\n` +
56
+ `Use AskUserQuestion to confirm this is the right account before proceeding:\n` +
57
+ ` question: "You're now logged in as ${result.email}. Is this the account you want to use?"\n` +
58
+ ` options:\n` +
59
+ ` - label: "Yes, continue"\n` +
60
+ ` description: "Use ${result.email} for this setup"\n` +
61
+ ` - label: "Switch account"\n` +
62
+ ` description: "Log in with a different email"\n` +
63
+ `If they choose "Switch account", call login(switch_account: true).`,
54
64
  },
55
65
  ],
56
66
  };
@@ -1 +1 @@
1
- {"version":3,"file":"authenticate.js","sourceRoot":"","sources":["../../src/tools/authenticate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAElE,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,IAAI,EAAE,OAAO;IACb,WAAW,EACT,yCAAyC;QACzC,sGAAsG;QACtG,sDAAsD;QACtD,iFAAiF;QACjF,gKAAgK;IAClK,WAAW,EAAE;QACX,cAAc,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oDAAoD,CAAC;KACtG;IACD,OAAO,EAAE,KAAK,EAAE,IAAkC,EAAE,EAAE;QACpD,IAAI,CAAC;YACH,6DAA6D;YAC7D,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC;gBACzB,MAAM,QAAQ,GAAG,MAAM,iBAAiB,EAAE,CAAC;gBAC3C,IAAI,QAAQ,EAAE,CAAC;oBACb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YACjE,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,gCAAgC,OAAO,EAAE;qBAChD;iBACF;gBACD,OAAO,EAAE,IAAI;aACd,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,UAAU,GAAG;IACxB,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,kFAAkF;IAC/F,WAAW,EAAE,EAAE;IACf,OAAO,EAAE,KAAK,EAAE,KAA4B,EAAE,EAAE;QAC9C,MAAM,MAAM,GAAG,aAAa,EAAE,CAAC;QAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;aACvE,CAAC;QACJ,CAAC;QACD,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;QAC3B,SAAS,EAAE,CAAC;QACZ,OAAO;YACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,cAAc,KAAK,sDAAsD,EAAE,CAAC;SACtH,CAAC;IACJ,CAAC;CACF,CAAC"}
@@ -26,7 +26,7 @@ const GUIDE = `
26
26
  Display this banner EXACTLY as-is:
27
27
  ${OWL_BANNER}
28
28
 
29
- Then IMMEDIATELY call the **AskUserQuestion** tool with this question. Do NOT print these options as plain text — you MUST use the interactive AskUserQuestion tool:
29
+ Then use AskUserQuestion to ask which path:
30
30
 
31
31
  question: "Which path fits your needs?"
32
32
  header: "Setup"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tru-mcp",
3
- "version": "0.14.5",
3
+ "version": "0.14.7",
4
4
  "description": "MCP server for tru — auth, billing, and risk signals in one API",
5
5
  "type": "module",
6
6
  "bin": {