@agenticmail/mcp 0.9.2 → 0.9.5

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.
Files changed (2) hide show
  1. package/dist/index.js +14 -9
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -22364,7 +22364,7 @@ async function heartbeat() {
22364
22364
  }
22365
22365
 
22366
22366
  // src/tools.ts
22367
- import { recordToolCall } from "@agenticmail/core";
22367
+ import { recordToolCall, redactSecret } from "@agenticmail/core";
22368
22368
  import { AsyncLocalStorage } from "async_hooks";
22369
22369
 
22370
22370
  // src/tool-catalog.ts
@@ -22592,7 +22592,7 @@ async function apiRequest(method, path, body, useMasterKey = false, timeoutMs =
22592
22592
  const perCallKey = toolCallContext.getStore()?.apiKey ?? null;
22593
22593
  const key = useMasterKey && MASTER_KEY ? MASTER_KEY : perCallKey ?? API_KEY;
22594
22594
  if (process.env.AGENTICMAIL_MCP_DEBUG) {
22595
- console.error(`[mcp-debug] apiRequest ${method} ${path} | perCall=${perCallKey ? perCallKey.slice(0, 12) + "\u2026" : "none"} | resolved=${key.slice(0, 12)}\u2026`);
22595
+ console.error(`[mcp-debug] apiRequest ${method} ${path} | perCall=${perCallKey ? redactSecret(perCallKey) : "none"} | resolved=${redactSecret(key)}`);
22596
22596
  }
22597
22597
  if (!key) {
22598
22598
  throw new Error(useMasterKey ? "Master key is required for this operation. Set AGENTICMAIL_MASTER_KEY." : "API key is not configured. Set AGENTICMAIL_API_KEY (or pass _account to use a per-agent key).");
@@ -23637,7 +23637,7 @@ async function handleToolCall(name, args2) {
23637
23637
  }
23638
23638
  }
23639
23639
  if (process.env.AGENTICMAIL_MCP_DEBUG) {
23640
- console.error(`[mcp-debug] handleToolCall name=${name} requested=${requestedAccount ?? "none"} accountKey=${accountKey ? accountKey.slice(0, 12) + "\u2026" : "null"} ACCOUNT_KEYS.size=${ACCOUNT_KEYS.size}`);
23640
+ console.error(`[mcp-debug] handleToolCall name=${name} requested=${requestedAccount ?? "none"} accountKey=${accountKey ? redactSecret(accountKey) : "null"} ACCOUNT_KEYS.size=${ACCOUNT_KEYS.size}`);
23641
23641
  }
23642
23642
  return toolCallContext.run({ apiKey: accountKey }, () => dispatchToolCall(name, args2, useMaster));
23643
23643
  }
@@ -24024,7 +24024,7 @@ ${lines.join("\n")}`;
24024
24024
  if (action === "untag_message") {
24025
24025
  if (!args2.id || !args2.uid) throw new Error("id and uid are required");
24026
24026
  const folder = args2.folder || "INBOX";
24027
- await apiRequest("DELETE", `/tags/${args2.id}/messages/${args2.uid}?folder=${encodeURIComponent(folder)}`);
24027
+ await apiRequest("DELETE", `/tags/${args2.id}/messages/${args2.uid}?folder=${encodeURIComponent(String(folder))}`);
24028
24028
  return `Removed tag from message UID ${args2.uid} in ${folder}`;
24029
24029
  }
24030
24030
  if (action === "get_messages") {
@@ -24043,10 +24043,14 @@ ${r.messages.map((m) => ` UID ${m.uid} (${m.folder})`).join("\n")}`;
24043
24043
  throw new Error("Invalid action");
24044
24044
  }
24045
24045
  case "create_account": {
24046
+ const hostTag = process.env.AGENTICMAIL_MCP_HOST?.trim();
24047
+ const userMetadata = args2.metadata && typeof args2.metadata === "object" && !Array.isArray(args2.metadata) ? args2.metadata : void 0;
24048
+ const metadata = hostTag ? { ...userMetadata ?? {}, host: hostTag } : userMetadata;
24046
24049
  const result = await apiRequest("POST", "/accounts", {
24047
24050
  name: args2.name,
24048
24051
  domain: args2.domain,
24049
- role: args2.role
24052
+ role: args2.role,
24053
+ ...metadata ? { metadata } : {}
24050
24054
  }, useMaster);
24051
24055
  if (!result) throw new Error("No response from account creation");
24052
24056
  return [
@@ -24055,8 +24059,9 @@ ${r.messages.map((m) => ` UID ${m.uid} (${m.folder})`).join("\n")}`;
24055
24059
  ` Email: ${result.email}`,
24056
24060
  ` Role: ${result.role}`,
24057
24061
  ` API Key: ${result.apiKey}`,
24058
- ` ID: ${result.id}`
24059
- ].join("\n");
24062
+ ` ID: ${result.id}`,
24063
+ hostTag ? ` Host: ${hostTag} (this account is owned by the ${hostTag} dispatcher)` : ""
24064
+ ].filter(Boolean).join("\n");
24060
24065
  }
24061
24066
  case "setup_email_relay": {
24062
24067
  const result = await apiRequest("POST", "/gateway/relay", {
@@ -24704,7 +24709,7 @@ ${r.tail.join("\n")}`;
24704
24709
  case "check_tasks": {
24705
24710
  let endpoint = args2.direction === "outgoing" ? "/tasks/assigned" : "/tasks/pending";
24706
24711
  if (args2.direction !== "outgoing" && args2.assignee) {
24707
- endpoint += `?assignee=${encodeURIComponent(args2.assignee)}`;
24712
+ endpoint += `?assignee=${encodeURIComponent(String(args2.assignee))}`;
24708
24713
  }
24709
24714
  const r = await apiRequest("GET", endpoint);
24710
24715
  if (!r?.tasks?.length) return args2.direction === "outgoing" ? "No tasks assigned by you." : "No pending tasks.";
@@ -24775,7 +24780,7 @@ ${lines.join("\n")}`;
24775
24780
  const uid = Number(args2.uid);
24776
24781
  if (!uid || uid < 1) throw new Error("uid is required");
24777
24782
  const folder = args2.folder || "INBOX";
24778
- const result = await apiRequest("GET", `/mail/messages/${uid}/spam-score?folder=${encodeURIComponent(folder)}`);
24783
+ const result = await apiRequest("GET", `/mail/messages/${uid}/spam-score?folder=${encodeURIComponent(String(folder))}`);
24779
24784
  const lines = [
24780
24785
  `Spam Score: ${result.score}/100 (${result.isSpam ? "SPAM" : result.isWarning ? "WARNING" : "CLEAN"})`,
24781
24786
  result.topCategory ? `Top Category: ${result.topCategory}` : null
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/mcp",
3
- "version": "0.9.2",
3
+ "version": "0.9.5",
4
4
  "mcpName": "io.github.agenticmail/mcp",
5
5
  "description": "MCP server for AgenticMail — give any AI client real email and SMS capabilities",
6
6
  "type": "module",
@@ -30,7 +30,7 @@
30
30
  "dependencies": {
31
31
  "@modelcontextprotocol/sdk": "^1.12.0",
32
32
  "zod": "^3.24.0",
33
- "@agenticmail/core": "^0.9.2"
33
+ "@agenticmail/core": "^0.9.5"
34
34
  },
35
35
  "devDependencies": {
36
36
  "tsup": "^8.4.0",