@adeu/mcp-server 1.7.5 → 1.9.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.
@@ -109,6 +109,7 @@ export async function search_and_fetch_emails(args: any): Promise<ToolResult> {
109
109
  folder: args.folder,
110
110
  limit: args.limit ?? 10,
111
111
  offset: args.offset ?? 0,
112
+ mailbox_address: args.mailbox_address,
112
113
  };
113
114
 
114
115
  // Remove undefined fields
@@ -164,7 +165,10 @@ export async function search_and_fetch_emails(args: any): Promise<ToolResult> {
164
165
  lines.push(
165
166
  "⚠️ **ACTION REQUIRED**: To read the full body of an email and download its attachments, call this tool again and provide the exact `email_id`.",
166
167
  );
167
- return { content: [{ type: "text", text: lines.join("\n") }] };
168
+ return {
169
+ content: [{ type: "text", text: lines.join("\n") }],
170
+ structuredContent: data,
171
+ };
168
172
  }
169
173
 
170
174
  if (data.type === "full_email") {
@@ -238,7 +242,10 @@ export async function search_and_fetch_emails(args: any): Promise<ToolResult> {
238
242
  );
239
243
  }
240
244
  }
241
- return { content: [{ type: "text", text: lines.join("\n") }] };
245
+ return {
246
+ content: [{ type: "text", text: lines.join("\n") }],
247
+ structuredContent: data,
248
+ };
242
249
  }
243
250
 
244
251
  return {
@@ -265,6 +272,9 @@ export async function create_email_draft(args: any): Promise<ToolResult> {
265
272
  );
266
273
  }
267
274
  if (args.subject) formData.append("subject", args.subject);
275
+ if (args.mailbox_address) {
276
+ formData.append("mailbox_address", args.mailbox_address);
277
+ }
268
278
 
269
279
  if (args.to_recipients) {
270
280
  const recips =
@@ -311,3 +321,52 @@ export async function create_email_draft(args: any): Promise<ToolResult> {
311
321
  ],
312
322
  };
313
323
  }
324
+ export async function list_available_mailboxes(): Promise<ToolResult> {
325
+ const apiKey = await getCloudAuthToken();
326
+
327
+ const res = await fetch(`${BACKEND_URL}/api/v1/users/me/shared-mailboxes`, {
328
+ method: "GET",
329
+ headers: {
330
+ Authorization: `Bearer ${apiKey}`,
331
+ Accept: "application/json",
332
+ },
333
+ });
334
+
335
+ if (res.status === 401) {
336
+ DesktopAuthManager.clearApiKey();
337
+ throw new Error(
338
+ "Authentication expired. Please call `login_to_adeu_cloud` to re-authenticate.",
339
+ );
340
+ }
341
+ if (!res.ok) {
342
+ throw new Error(`Failed to list available mailboxes: ${await res.text()}`);
343
+ }
344
+
345
+ const mailboxes: any[] = await res.json();
346
+ if (!mailboxes.length) {
347
+ return {
348
+ content: [
349
+ {
350
+ type: "text",
351
+ text: "No configured mailboxes found for your profile.",
352
+ },
353
+ ],
354
+ };
355
+ }
356
+
357
+ const lines = [
358
+ "### Connected Mailboxes",
359
+ "Below is the list of connected mailboxes you have access to. Use the `email_address` as the `mailbox_address` parameter in other tools to query or draft from a specific mailbox:",
360
+ "",
361
+ ];
362
+
363
+ for (const box of mailboxes) {
364
+ lines.push(
365
+ `- **${box.display_name || "Personal Mailbox"}**\n - **Email Address**: \`${box.email_address}\`\n - **Auto-Processing**: ${box.auto_process_enabled ? "Enabled" : "Disabled"}\n - **Write-Back Mode**: \`${box.write_back_preference}\``,
366
+ );
367
+ }
368
+
369
+ return {
370
+ content: [{ type: "text", text: lines.join("\n") }],
371
+ };
372
+ }
package/tsup.config.ts CHANGED
@@ -1,26 +1,50 @@
1
- import { defineConfig } from 'tsup';
1
+ // FILE: node/packages/mcp-server/tsup.config.ts
2
+ import { defineConfig } from "tsup";
3
+ import { cpSync, existsSync } from "node:fs";
4
+ import { join } from "node:path";
5
+
6
+ function copyAssets(outDir: string) {
7
+ if (existsSync("src/templates")) {
8
+ cpSync("src/templates", join(outDir, "templates"), {
9
+ recursive: true,
10
+ force: true,
11
+ });
12
+ }
13
+ if (existsSync("src/assets")) {
14
+ cpSync("src/assets", join(outDir, "assets"), {
15
+ recursive: true,
16
+ force: true,
17
+ });
18
+ }
19
+ }
2
20
 
3
21
  export default defineConfig([
4
22
  {
5
- entry: ['src/index.ts'],
6
- format: ['esm'],
23
+ entry: ["src/index.ts"],
24
+ format: ["esm"],
7
25
  dts: true,
8
26
  sourcemap: true,
9
27
  clean: true,
10
- outDir: 'dist',
28
+ outDir: "dist",
11
29
  banner: {
12
- js: '#!/usr/bin/env node',
30
+ js: "#!/usr/bin/env node",
31
+ },
32
+ onSuccess: async () => {
33
+ copyAssets("dist");
13
34
  },
14
35
  },
15
36
  {
16
- entry: ['src/index.ts'],
17
- format: ['esm'],
18
- outExtension: () => ({ js: '.js' }),
37
+ entry: ["src/index.ts"],
38
+ format: ["esm"],
39
+ outExtension: () => ({ js: ".js" }),
19
40
  noExternal: [/(.*)/], // Bundle all NPM dependencies
20
41
  external: [/^node:/], // Leave Node.js native built-ins external
21
- outDir: '../../../desktop-extension',
42
+ outDir: "../../../desktop-extension",
22
43
  dts: false,
23
44
  sourcemap: false,
24
45
  clean: false, // Don't clean the whole dir (preserves icon and manifest)
25
- }
26
- ]);
46
+ onSuccess: async () => {
47
+ copyAssets("../../../desktop-extension");
48
+ },
49
+ },
50
+ ]);