@adeu/mcp-server 1.20.0 → 1.21.0

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/src/tools/auth.ts DELETED
@@ -1,57 +0,0 @@
1
- // FILE: node/packages/mcp-server/src/tools/auth.ts
2
- import { DesktopAuthManager } from "../desktop-auth.js";
3
- import { BACKEND_URL } from "../shared.js";
4
- import { ToolResult } from "../response-builders.js";
5
-
6
- export async function login_to_adeu_cloud(): Promise<ToolResult> {
7
- try {
8
- const apiKey = await DesktopAuthManager.ensureAuthenticated();
9
-
10
- const res = await fetch(`${BACKEND_URL}/api/v1/auth/me`, {
11
- headers: {
12
- Authorization: `Bearer ${apiKey}`,
13
- Accept: "application/json",
14
- },
15
- signal: AbortSignal.timeout(15_000),
16
- });
17
-
18
- if (res.status === 401) {
19
- DesktopAuthManager.clearApiKey();
20
- throw new Error(
21
- "Your previous session expired. The stale key has been cleared. Please call `login_to_adeu_cloud` ONE MORE TIME to log in fresh.",
22
- );
23
- }
24
- if (!res.ok) throw new Error(`HTTP Error: ${res.status}`);
25
-
26
- const data: any = await res.json();
27
- const email = data.email || "Unknown Email";
28
- return {
29
- content: [
30
- {
31
- type: "text",
32
- text:
33
- `Login successful. You are now authenticated to Adeu Cloud as the user ` +
34
- `who owns the provider account \`${email}\` (the account used for SSO).\n\n` +
35
- `This single login grants access to ALL of this user's linked provider ` +
36
- `accounts and ALL of their mailboxes for the duration of this session — ` +
37
- `not just \`${email}\`. Call \`list_available_mailboxes\` to see every mailbox ` +
38
- `that can be queried or drafted from.`,
39
- },
40
- ],
41
- };
42
- } catch (err: any) {
43
- return { isError: true, content: [{ type: "text", text: err.message }] };
44
- }
45
- }
46
-
47
- export async function logout_of_adeu_cloud(): Promise<ToolResult> {
48
- DesktopAuthManager.clearApiKey();
49
- return {
50
- content: [
51
- {
52
- type: "text",
53
- text: "Successfully logged out. The local API key has been removed.",
54
- },
55
- ],
56
- };
57
- }