@agenticmail/mcp 0.7.3 → 0.7.4

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/README.md CHANGED
@@ -1,4 +1,8 @@
1
- # @agenticmail/mcp
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/agenticmail/agenticmail/main/docs/images/logo-200.png" alt="AgenticMail logo (pink bow)" width="180" />
3
+ </p>
4
+
5
+ <h1 align="center">@agenticmail/mcp</h1>
2
6
 
3
7
  The MCP (Model Context Protocol) server for [AgenticMail](https://github.com/agenticmail/agenticmail) — gives any MCP-compatible AI client full email and SMS capabilities.
4
8
 
package/dist/index.js CHANGED
@@ -24945,6 +24945,69 @@ ${lines.join("\n")}`;
24945
24945
  import { setTelemetryVersion } from "@agenticmail/core";
24946
24946
  import { createServer } from "http";
24947
24947
  import { randomUUID } from "crypto";
24948
+
24949
+ // src/coerce.ts
24950
+ function coerceToArray(value, itemKind) {
24951
+ if (Array.isArray(value)) return value;
24952
+ if (typeof value !== "string") return value;
24953
+ const trimmed = value.trim();
24954
+ if (trimmed.startsWith("[")) {
24955
+ try {
24956
+ const parsed = JSON.parse(trimmed);
24957
+ if (Array.isArray(parsed)) return parsed;
24958
+ } catch {
24959
+ return value;
24960
+ }
24961
+ }
24962
+ if (itemKind === "number" || itemKind === "integer" || itemKind === "string") {
24963
+ const parts = trimmed.split(",").map((s) => s.trim()).filter((s) => s.length > 0);
24964
+ if (itemKind === "number" || itemKind === "integer") {
24965
+ return parts.map((s) => {
24966
+ const n = Number(s);
24967
+ return Number.isNaN(n) ? s : n;
24968
+ });
24969
+ }
24970
+ return parts;
24971
+ }
24972
+ return value;
24973
+ }
24974
+ function coerceToObject(value) {
24975
+ if (value && typeof value === "object" && !Array.isArray(value)) return value;
24976
+ if (typeof value !== "string") return value;
24977
+ const trimmed = value.trim();
24978
+ if (!trimmed.startsWith("{")) return value;
24979
+ try {
24980
+ const parsed = JSON.parse(trimmed);
24981
+ if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) return parsed;
24982
+ } catch {
24983
+ }
24984
+ return value;
24985
+ }
24986
+ function coerceToNumber(value) {
24987
+ if (typeof value === "number") return value;
24988
+ if (typeof value === "string") {
24989
+ const trimmed = value.trim();
24990
+ if (trimmed === "") return value;
24991
+ const n = Number(trimmed);
24992
+ if (!Number.isNaN(n)) return n;
24993
+ }
24994
+ return value;
24995
+ }
24996
+ function coerceToBoolean(value) {
24997
+ if (typeof value === "boolean") return value;
24998
+ if (typeof value === "string") {
24999
+ const v = value.trim().toLowerCase();
25000
+ if (v === "true" || v === "yes" || v === "1") return true;
25001
+ if (v === "false" || v === "no" || v === "0") return false;
25002
+ }
25003
+ if (typeof value === "number") {
25004
+ if (value === 1) return true;
25005
+ if (value === 0) return false;
25006
+ }
25007
+ return value;
25008
+ }
25009
+
25010
+ // src/index.ts
24948
25011
  setTelemetryVersion("0.5.55");
24949
25012
  function jsonSchemaToZod(schema, topLevel = false) {
24950
25013
  if (!schema || typeof schema !== "object") return topLevel ? {} : external_exports.any();
@@ -24952,16 +25015,18 @@ function jsonSchemaToZod(schema, topLevel = false) {
24952
25015
  if (schema.type === "string") {
24953
25016
  result = schema.enum?.length ? external_exports.enum(schema.enum) : external_exports.string();
24954
25017
  } else if (schema.type === "number" || schema.type === "integer") {
24955
- result = external_exports.number();
25018
+ result = external_exports.preprocess(coerceToNumber, external_exports.number());
24956
25019
  } else if (schema.type === "boolean") {
24957
- result = external_exports.boolean();
25020
+ result = external_exports.preprocess(coerceToBoolean, external_exports.boolean());
24958
25021
  } else if (schema.type === "array") {
24959
25022
  const hasItems = !!schema.items && typeof schema.items === "object" && Object.keys(schema.items).length > 0;
24960
- result = external_exports.array(hasItems ? jsonSchemaToZod(schema.items, false) : external_exports.any());
25023
+ const inner = external_exports.array(hasItems ? jsonSchemaToZod(schema.items, false) : external_exports.any());
25024
+ const itemKind = schema.items?.type;
25025
+ result = external_exports.preprocess((v) => coerceToArray(v, itemKind), inner);
24961
25026
  } else if (schema.type === "object") {
24962
25027
  if (!schema.properties || Object.keys(schema.properties).length === 0) {
24963
25028
  if (topLevel) return {};
24964
- result = external_exports.record(external_exports.string(), external_exports.any());
25029
+ result = external_exports.preprocess(coerceToObject, external_exports.record(external_exports.string(), external_exports.any()));
24965
25030
  } else {
24966
25031
  const shape = {};
24967
25032
  const required2 = new Set(schema.required ?? []);
@@ -24971,7 +25036,7 @@ function jsonSchemaToZod(schema, topLevel = false) {
24971
25036
  shape[key] = child;
24972
25037
  }
24973
25038
  if (topLevel) return shape;
24974
- result = external_exports.object(shape);
25039
+ result = external_exports.preprocess(coerceToObject, external_exports.object(shape));
24975
25040
  }
24976
25041
  } else {
24977
25042
  result = external_exports.any();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/mcp",
3
- "version": "0.7.3",
3
+ "version": "0.7.4",
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",