mcpField
B
bulk-cms-update

bulk-cms-update

github.com/webflow数据与数据库132323 次安装6 天前更新
代码仓库

关于 bulk-cms-update

用于批量创建或更新 Webflow CMS 内容的操作技能,涵盖数据校验、逐项审批、分批处理和回滚数据保存。适合需要在执行前审查变更并跟踪结果的 CMS 工作流。

主要功能

  1. 01校验字段、必填项和数据约束
  2. 02检查重复 slug 与引用目标
  3. 03逐项预览并选择性批准
  4. 04最多每批处理 50 个项目
  5. 05保存更新前数据以支持回滚

适用场景

  1. 01批量导入并校验 CMS 内容
  2. 02只更新筛选出的现有项目
  3. 03审批后发布内容或先保存为草稿

MCP 相关

要求通过 Webflow MCP 工具读取站点、集合、架构和现有项目,并创建、更新或发布 CMS 项目。

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/webflow/webflow-skills --skill bulk-cms-update

安装后在 Claude Code 中输入/bulk-cms-update确认已加载。

详细介绍

批量更新 CMS

通过全面验证、细粒度审批和回滚功能,创建或更新多个 CMS 项目。

重要提示

所有操作始终使用 Webflow MCP 工具:

  • 使用 Webflow MCP 的 data_sites_tool 和操作 list_sites 列出可用站点
  • 使用 Webflow MCP 的 data_cms_tool 和操作 get_collection_list 列出 CMS 集合
  • 使用 Webflow MCP 的 data_cms_tool 和操作 get_collection_details 获取集合架构
  • 使用 Webflow MCP 的 data_cms_tool 和操作 list_collection_items 检索现有项目
  • 使用 Webflow MCP 的 data_cms_tool 和操作 create_collection_items 创建项目(草稿或已发布)
  • 使用 Webflow MCP 的 data_cms_tool 和操作 update_collection_items 更新项目(草稿或已发布)
  • 使用 Webflow MCP 的 data_cms_tool 和操作 publish_collection_items 发布草稿项目
  • 开始前,使用 webflow_guide_tool 获取最佳实践
  • Webflow 操作不得使用任何其他工具或方法
  • 所有工具调用都必须包含必需的 context 参数(15-25 个词,采用第三人称视角)

说明

阶段 1:选择站点和集合
  1. 获取站点:确定目标站点。如果用户未提供站点 ID,请向其询问。
  2. 列出集合:使用 Webflow MCP 的 data_cms_tool 和操作 get_collection_list 显示可用集合
  3. 请用户选择集合:由用户指定要操作的集合
  4. 获取集合架构:使用 Webflow MCP 的 data_cms_tool 和操作 get_collection_details 获取:
    • 所有字段定义及其类型
    • 必填字段和可选字段
    • 字段验证规则(最大长度、模式等)
    • 引用字段的目标
阶段 2:收集和解析数据
  1. 询问操作类型:确认用户想要执行的操作:

    • 仅创建新项目
    • 仅更新现有项目
    • 同时创建和更新
  2. 接收用户数据:接受以下灵活格式的数据:

    • 结构化格式(类似 JSON)
    • 自然语言描述
    • CSV 格式数据
    • 项目符号列表
  3. 解析并规范化:将用户数据转换为结构化格式

  4. 获取现有项目(涉及更新时):使用 Webflow MCP 的 data_cms_tool 和操作 list_collection_items 获取当前数据

    重要——高效查找项目:

    • 按名称搜索特定项目时,始终使用 name 参数进行筛选(例如:name: "Pikachu")
    • 按 slug 搜索时,使用 slug 参数进行筛选
    • 绝不要先获取所有项目再搜索结果——这会浪费 API 调用和令牌
    • 只有在需要显示所有项目或不知道要操作哪些特定项目时,才获取完整列表
阶段 3:验证和分析
  1. 验证所有数据:
    • 字段名称:检查架构中是否存在所有字段名称
    • 必填字段:确保已提供所有必填字段
    • 字段类型:验证数据类型是否与架构匹配
    • 约束:检查最大长度、模式和允许值
    • Slugs:确保 slug 唯一且有效
    • 引用字段:验证被引用的项目是否存在
  2. 检测冲突:
    • 重复的 slug(批次内或与现有项目重复)
    • 缺少必填字段
    • 无效的数据类型
    • 违反约束
  3. 分析影响:
    • 统计创建和更新的数量
    • 确定将发生变化的字段
    • 计算批次大小和处理时间
阶段 4:预览与精细审批
  1. 生成详细预览:
    • 显示每个项目及其验证状态
    • 显示任何问题的警告
    • 对于更新,显示差异(旧值 → 新值)
    • 对于新建,显示所有字段值
    • 为每个项目编号,以便选择性审批
  2. 提供精细审批选项:
    • 允许用户选择要处理的特定项目
    • 选项:“all”、“none”、特定编号、编号范围
    • 显示预计处理时间
  3. 提供发布选项:
    • 立即发布(使用 *_live 端点)
    • 创建为草稿(使用常规端点 + 手动发布)
阶段 5:执行与报告
  1. 存储回滚数据:进行任何更改前,保存:
    • 所有已更新项目的原始值
    • 时间戳
    • 操作详情
  2. 分批处理:
    • 每批最多 50 个项目
    • 显示进度指示器
    • 妥善处理速率限制
  3. 执行操作:根据用户选择使用相应的 Webflow MCP 工具
  4. 妥善处理错误:
    • 单个项目失败时继续处理
    • 分别跟踪成功和失败的项目
    • 提供详细的错误消息
  5. 生成全面报告:
    • 摘要(成功/失败数量)
    • 每个项目的详细结果
    • 已创建/更新项目的 ID
    • 失败项目的错误详情
  6. 提供回滚选项:允许用户在需要时撤销更改

示例

用户提示词:

Add 2 blog posts about Webflow MCP and update the first blog to say "Top" instead of "Best"

步骤 1:选择站点和集合

📋 Bulk CMS Update Setup

Available Sites:
1. MCP Demo#1
2. MCP Demo#2
3. MCP Demo#3

Please select a site (1-3):

用户选择:1

Available Collections in MCP Demo#1:
└── Blog Posts (9 items)
    Fields: name, slug, post-body, post-summary, main-image, thumbnail-image, featured, color

Proceed with Blog Posts collection? (yes/no)

用户确认:yes

步骤 2:收集数据

🔍 Collection Schema: Blog Posts

Required Fields:
- name (PlainText, max 256 chars)
- slug (PlainText, max 256 chars, alphanumeric only)

Optional Fields:
- post-body (RichText)
- post-summary (PlainText)
- main-image (Image)
- thumbnail-image (Image)
- featured (Switch, true/false)
- color (Color, hex format)

I'll parse your request:
- Create 2 new posts about Webflow MCP
- Update first post: "Best" → "Top"

Generating items...

步骤 3:验证与预览

📋 Preview: Bulk CMS Update

Collection: Blog Posts
Operations: Create 2 items + Update 1 item

---

### 🆕 Items to Create (2)

[1] ✓ NEW POST
    name: "Webflow MCP: The Future of Web Development"
    slug: "webflow-mcp-future-web-development"
    post-summary: "Discover how Webflow MCP is revolutionizing..."
    post-body: "<h1>The Future is Here</h1><p>..."
    featured: true
    color: "#9B59B6"
    ✅ All validations passed

[2] ✓ NEW POST
    name: "Why Webflow MCP Will Transform Your Workflow in 2026"
    slug: "webflow-mcp-transform-workflow-2026"
    post-summary: "Learn how Webflow MCP's integration..."
    post-body: "<h1>Transform Your Workflow</h1><p>..."
    featured: true
    color: "#3498DB"
    ✅ All validations passed

---

### ✏️ Items to Update (1)

[3] ✓ UPDATE EXISTING
    Item ID: 69615f84fc6ce1aa444d24d5
    Slug: why-webflow-is-best-2026-ai

    Changes:
      name: "Why Webflow is the Best Choice for 2026" → "Why Webflow is the Top Choice for 2026"

    ✅ All validations passed

---

**Summary:**
- ✅ 2 items will be created
- ✅ 1 item will be updated
- ⚠️ 0 warnings
- ❌ 0 errors

**Publish Options:**
1. Publish immediately (recommended)
2. Save as drafts

Which items would you like to process?
- Type "all" to process all 3 items
- Type numbers to skip (e.g., "2" to skip item 2)
- Type "none" to cancel

Select publish option (1/2): _
Select items: _

用户选择:1, all

⚠️ You're about to:
- Create 2 new blog posts (published live)
- Update 1 existing blog post (changes published live)

Type "confirm" to proceed.

用户确认:confirm

步骤 4:执行与结果

🔄 Processing bulk update...

Creating items: ██████████ 100% (2/2)
Updating items: ██████████ 100% (1/1)

✅ Bulk CMS Update Complete!

---

### 🆕 Created Items (2)

✓ [1] "Webflow MCP: The Future of Web Development"
      ID: 6961640c66de07bed9aacf3e
      Slug: webflow-mcp-future-web-development
      Published: Jan 9, 2026, 8:24 PM

✓ [2] "Why Webflow MCP Will Transform Your Workflow in 2026"
      ID: 6961640c66de07bed9aacf41
      Slug: webflow-mcp-transform-workflow-2026
      Published: Jan 9, 2026, 8:24 PM

---

### ✏️ Updated Items (1)

✓ [3] "Why Webflow is the Top Choice for 2026"
      ID: 69615f84fc6ce1aa444d24d5
      Changed: title updated
      Published: Jan 9, 2026, 8:24 PM

---

**Summary:**
- ✅ 2 items created successfully
- ✅ 1 item updated successfully
- ❌ 0 failures
- ⏱️ Completed in 3.2 seconds

**Total Items:** 11 (was 9)

📋 Rollback Available:
Last update: 3 items modified just now
Type "undo" within 5 minutes to revert all changes

替代方案:带验证警告

📋 Preview: Bulk CMS Update

[1] ⚠️ NEW POST
    name: "Test Post"
    slug: "test"
    post-summary: "Hi"
    ⚠️ Warning: post-summary too short (< 20 chars) - may affect SEO
    ⚠️ Warning: slug too generic - consider more descriptive slug
    ⚠️ Warning: missing post-body - content will be empty
    ✅ Required fields present (can proceed)

[2] ❌ NEW POST
    name: "Another Post!!!"
    slug: "another post"
    ❌ Error: slug contains spaces (must be alphanumeric with hyphens only)
    ❌ Error: name contains special characters not allowed
    🔴 Cannot proceed - fix errors first

---

**Summary:**
- ✅ 1 item can be created (with warnings)
- ❌ 1 item has errors (cannot create)

Fix item 2 or skip it? (fix/skip)

指南

阶段 1:关键要求

选择站点和集合:

  • 始终使用 data_sites_tool 和操作 list_sites 获取实际站点列表
  • 切勿假设站点 ID
  • 显示集合名称和项目数量
  • 接收数据前显示字段架构
  • 与用户确认集合选择
阶段 2:解析数据

灵活的输入格式: 接受多种格式的数据:

  1. 结构化(类似 JSON):
CREATE:
- name: "Post Title"
  slug: "post-slug"
  featured: true
  1. 自然语言:
"Add a blog post called 'Getting Started' with slug 'getting-started'"
  1. CSV 风格:
name,slug,featured
"Post 1","post-1",true
"Post 2","post-2",false
  1. 项目符号列表:
- Post 1: "Title" (slug: title-slug)
- Post 2: "Another" (slug: another-slug)

解析规则:

  • 灵活处理格式差异
  • 推断缺失的可选字段
  • 如有歧义,请求澄清
  • 切勿假设必填字段的值

高效查找项目: 获取现有项目以进行更新时,使用筛选参数尽量减少 API 调用:

# Good - Filter by name when you know the item name
data_cms_tool(action: "list_collection_items", collection_id, name: "Pikachu")

# Good - Filter by slug when you know the slug
data_cms_tool(action: "list_collection_items", collection_id, slug: "pikachu")

# Bad - Fetching all items then searching through results
data_cms_tool(action: "list_collection_items", collection_id)  # Returns 100 items
# Then manually searching for "Pikachu" in results...
  • 搜索特定项目时,始终使用 name 或 slug 参数
  • 这样可以减少 API 调用、响应大小和令牌用量
  • 仅在显示所有项目或目标未知时,才获取未筛选的列表
阶段 3:验证规则

字段名称验证:

  • 检查架构中是否存在所有字段名称
  • 区分大小写匹配
  • 针对拼写错误建议修正
  • 示例:"autor" → 你是想输入 "author" 吗?

必填字段:

  • 对于 Webflow CMS,name 和 slug 始终为必填项
  • 根据架构检查集合特有的必填字段
  • 清楚列出所有缺失的必填字段
  • 缺少必填字段时无法继续

字段类型验证:

PlainText:

  • 检查最大长度限制
  • 如果指定了模式,则进行验证
  • 不允许使用 HTML

RichText:

  • 必须是有效的 HTML
  • 检查是否有未闭合的标签
  • 允许使用常见的 HTML 元素

Image/File:

  • 接受文件 ID 或 URL
  • 验证文件是否存在(如果可行)
  • 可选的替代文本

Switch(布尔值):

  • 接受:true/false、yes/no、1/0
  • 规范化为布尔值

Color:

  • 必须采用十六进制格式(#RRGGBB)
  • 验证十六进制字符
  • 示例:#FF5733 ✓,red ✗

引用字段:

  • 必须引用现有项 ID
  • 验证被引用的项是否存在
  • 显示被引用项的名称以便识别

Slug 验证:

  • 重要:只能包含字母数字字符和连字符
  • 不允许有空格、下划线或特殊字符
  • 最多 256 个字符
  • 必须唯一(与现有项和批次中的项进行比对)
  • 如果缺少 slug,则根据标题自动建议
  • 示例:
    • ❌ "My Post!" → ⚠️ 包含特殊字符
    • ✅ "my-post" → 有效

约束验证:

  • 最大长度:接近限制时发出警告,超过限制时出错
  • 模式:测试架构中的正则表达式模式
  • 允许值:与枚举选项进行比对
阶段 4:预览与批准

预览格式:

对于创建操作:

[1] ✓ NEW POST
    field1: "value1"
    field2: "value2"
    field3: "value3"
    ✅ All validations passed

对于更新操作:

[2] ✓ UPDATE EXISTING
    Item ID: xxx
    Slug: existing-slug

    Changes:
      field1: "old value" → "new value"
      field2: (no change)
      field3: "old" → "new"

    ✅ All validations passed

对于带警告的项:

[3] ⚠️ NEW POST
    name: "Title"
    ⚠️ Warning: Missing optional field 'post-body'
    ⚠️ Warning: Slug may be too generic
    ✅ Can proceed (warnings only)

对于有错误的项:

[4] ❌ NEW POST
    name: "Title!!!"
    slug: "bad slug"
    ❌ Error: slug contains spaces
    ❌ Error: name has special characters
    🔴 Cannot proceed - must fix errors

逐项批准:

  • 为每个项编号:[1]、[2]、[3]……
  • 允许选择性处理
  • 接受以下格式:
    • "all" - 处理所有项
    • "none" - 取消操作
    • "1,3,5" - 处理第 1、3 和 5 项
    • "1-5" - 处理第 1 至 5 项
    • "2" - 仅跳过第 2 项,处理其余项

发布选项:

  • 立即发布:使用 *_live 端点(推荐)
  • 草稿模式:使用常规端点,稍后发布
  • 说明每种选择的影响
阶段 5:执行与报告

批量处理:

  • 每批最多 50 项
  • 显示进度条:
    Processing: ████████░░ 80% (40/50 items)
    
  • 预计剩余时间
  • 处理速率限制(暂停/重试)

错误处理:

单项失败时:

Processing item 3/10...
❌ Failed: "Post Title"
   Error: Slug already exists
   → Skipping to next item

继续处理:

  • 不要因一个错误导致整个批次失败
  • 跟踪所有成功和失败的项
  • 分别报告成功项和失败项

发生严重故障时:

❌ Critical Error: API connection lost

Items processed before error: 7/50
- 5 created successfully
- 2 updated successfully
- 43 not processed

Retry failed items? (yes/no)

成功报告格式:

✅ Operation Complete

Created: 25 items
- Show first 5 with IDs
- "[+20 more]" if > 5

Updated: 10 items
- Show first 5 with IDs
- "[+5 more]" if > 5

Failed: 2 items
- "Item Name": Error reason
- "Item Name": Error reason

Total time: 12.5 seconds
Items per second: 2.8

回滚功能:

更改前存储:

{
  "timestamp": "2026-01-09T20:24:44Z",
  "operations": [
    {
      "type": "update",
      "itemId": "xxx",
      "originalValues": {
        "name": "Old Title",
        "featured": false
      },
      "newValues": {
        "name": "New Title",
        "featured": true
      }
    }
  ]
}

提供回滚选项:

📋 Rollback Available:
Last update: 15 items modified 2 minutes ago

Rollback will:
- Restore 10 updated items to previous values
- Delete 5 newly created items

⚠️ Type "undo" to rollback all changes
⚠️ Rollback expires in 3 minutes
性能优化

批次大小:

  • 默认值:每批 50 项
  • 根据字段复杂度进行调整
  • 大型图片:每批 20 项
  • 简单文本字段:每批 100 项

进度指示器:

Creating items...
Batch 1/3: ████████████████████ 100% (50/50)
Batch 2/3: ████████████████████ 100% (50/50)
Batch 3/3: ██████░░░░░░░░░░░░░░ 30% (15/50)

速率限制:

  • 遵守 Webflow API 的速率限制
  • 如有需要,在批次之间暂停
  • 向用户说明等待原因
  • 自动重试失败的请求(最多 3 次)
错误消息

清晰且可执行:

❌ 不佳:

"Error: validation failed"

✅ 良好:

"Validation Error on item 3:
 - Slug 'my post' contains spaces
 - Change to: 'my-post' (alphanumeric with hyphens only)"

错误类别:

  • 🔴 严重:完全无法继续(API 不可用、身份验证无效)
  • ❌ 错误:无法处理此项(修复或跳过)
  • ⚠️ 警告:可以继续,但不建议这样做(缺少可选字段)
  • 💡 建议:最佳实践(slug 过于笼统、摘要过短)
最佳实践

始终:

  • ✅ 在进行任何更改前显示预览
  • ✅ 要求明确确认
  • ✅ 全面验证所有数据
  • ✅ 对大型操作分批处理
  • ✅ 分别报告成功和失败
  • ✅ 为近期更改提供回滚选项
  • ✅ 使用细粒度审批以提高灵活性

绝不:

  • ❌ 未经用户确认就应用更改
  • ❌ 因单个项目出错而导致整个批次失败
  • ❌ 臆测字段名称或值
  • ❌ 未经验证就进行处理
  • ❌ 向用户隐藏验证警告

边缘情况:

  • 重复的 slug:自动追加数字(post-title-2)
  • 缺少可选字段:留空(不要编造值)
  • 大型批次:提示处理所需时间
  • 引用字段:验证目标是否存在
  • 图片字段:接受 URL 或文件 ID

用户体验:

  • 提前显示集合架构
  • 为项目编号,便于引用
  • 使用视觉层级(├── └──)
  • 提供可操作的错误消息
  • 估算处理时间
  • 允许在处理中途取消

评论

支持 Markdown