@mambasms/mcp-server 0.7.6 → 0.7.8

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/index.js CHANGED
@@ -123,7 +123,7 @@ function defineTool(name, description, shape, handler) {
123
123
  }
124
124
 
125
125
  const server = new McpServer(
126
- { name: "mambasms-mcp-server", version: "0.7.6" },
126
+ { name: "mambasms-mcp-server", version: "0.7.8" },
127
127
  {
128
128
  instructions: `MambaSMS 营销自动化(店铺级,鉴权用 MAMBA_ACCESS_TOKEN 店铺密钥)。共 66 个工具,分四组。
129
129
  不确定用什么/想先看总览 → mamba_guide;只知道关键词 → mamba_search;要参数细节 → mamba_tool_schema。
@@ -203,6 +203,20 @@ ${PLACEHOLDER_GUIDE}`,
203
203
  if (sections !== undefined) body.sections = sections;
204
204
  if (summary !== undefined) body.summary = summary;
205
205
  const data = await callApi("/api/v1/template/create", body);
206
+ // 邮件 HTML 规范自检:网页式 HTML(viewport/vw/固定宽度>640)在 600px 画布会溢出
207
+ const issues = [];
208
+ const h = String(html || "");
209
+ if (/<meta[^>]+name=["']viewport["']/i.test(h)) issues.push("含 <meta viewport>(网页 HTML,邮件客户端不认)");
210
+ if (/(?:width|height)\s*:\s*\d+(?:\.\d+)?v[wh]/i.test(h) || /position\s*:\s*absolute/i.test(h)) {
211
+ issues.push("使用了 vw/vh 或绝对定位,邮件客户端不支持");
212
+ }
213
+ const wide = [...h.matchAll(/width\s*[:=]\s*["']?(\d{3,4})/gi)].map((m) => Number(m[1])).filter((n) => n > 640);
214
+ if (wide.length) issues.push("存在宽度 >640px 的元素(" + Math.max(...wide) + "px),邮件画布只有 600px");
215
+ if (issues.length) {
216
+ issues.push("建议:改用 email_design,或用 600px 表格布局重写 HTML");
217
+ const merged = data && typeof data === "object" ? { ...data, mcpWarnings: issues } : data;
218
+ return { content: [{ type: "text", text: JSON.stringify(merged, null, 2) }] };
219
+ }
206
220
  return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
207
221
  }
208
222
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mambasms/mcp-server",
3
- "version": "0.7.6",
3
+ "version": "0.7.8",
4
4
  "description": "MCP server for MambaSMS email templates - create/manage templates from AI agents (Codex, Claude Desktop, Cursor)",
5
5
  "type": "module",
6
6
  "bin": {
@@ -45,6 +45,21 @@
45
45
  - 买家可见文案一律**英文**;`{{ }}` 与 `{ }` 不能混用
46
46
  - 活动正文质量闸门(≥4200 字符)不适用于模板,但模板短到只有一两行时客户体验差,建议至少 hero+正文+CTA+页脚
47
47
 
48
+ ## 3.4 邮件 HTML 规范(不遵守会溢出画布)
49
+
50
+ 邮件画布固定 **600px**,客户端能力有限。手写/迁移 HTML 必须:
51
+
52
+ | 必须 | 不要 |
53
+ |---|---|
54
+ | 宽度 ≤ **600px**,居中 | 横幅铺满、固定 px >600 |
55
+ | `<table>` 布局 + **内联样式** | `<style>`、flex/grid、绝对定位 |
56
+ | 背景色写在 `td` 上 | 写在 `body`/`html` 上 |
57
+ | 图片 `max-width:100%`、写 `alt` | 写死大图宽度 |
58
+ | 大标题允许换行 | `white-space:nowrap` 撑破容器 |
59
+
60
+ - **网站/落地页 HTML 不能直接用**(含 `<meta viewport>`、`vw`、媒体查询)——要么重排成 600px 表格,要么改用 `email_design`
61
+ - `template_create(html)` 会做基础探测,发现视口/超宽会返回 `mcpWarnings`,看到就应重排而不是交付
62
+
48
63
  ## 3.5 客户问"这是 HTML 模式吗"怎么答
49
64
 
50
65
  模板**没有**"整页 HTML / 富文本模式"之分,只有**组件树**;