连接器指南阅读约 3 分钟11 个 MCP 工具7 种语言

如何通过 MCP 将 Sanity 连接到 Meta Muse

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

HC作者:HelpCode 团队更新于 3 分钟阅读 在 GitHub 开源

无需信用卡 · 7 天试用 · 提供自托管方案

Sanity

Sanity

Let your AI work with your Sanity content: run GROQ queries, read documents, their revisions and change history, list document types, datasets and projects, and create, change and publish drafts after you confirm. API token with Viewer or Editor rights.

个工具

11

区域

INTL

类别

CMS

身份验证

Bearer Token

所需环境变量

SANITY_PROJECT_IDSANITY_DATASETSANITY_API_TOKEN
在 Cloud 上一键安装

7 天免费试用 · 无需信用卡

  • 7 天免费试用
    无需信用卡
  • 符合 GDPR,SOC 2 就绪
    数据驻留欧盟,审计日志
  • 在 GitHub 开源
    开源 · AGPL-3.0
  • 支持 ChatGPT、Claude、Gemini
    任何兼容 MCP 的客户端

跳过安装。2 分钟内即可运行。

在 cloud.anythingmcp.com 开始免费试用,一键添加 Sanity,然后将你的 AI 客户端(Claude、ChatGPT、Copilot 或 Cursor)指向生成的 MCP 端点。无需 Docker,无需 git clone,无需任何工程经验。

开始免费试用

摘要

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

试试这样问

Sanity 的示例提示

点击任意提示即可复制,然后粘贴到 Claude、ChatGPT、Cursor、Gemini、Copilot 或 OpenClaw 中,在该连接器上运行。

Sanity · 通过 MCP 实时
分享
Opus 4.7

Claude 是 AI,可能会出错。请核对回答。

💡 无需安装? 直接使用 cloud.anythingmcp.com。 登录、点击 Connectors → Sanity、粘贴凭证、生成 MCP API key,即可完成。无 Docker、无 git clone、无本地服务器。

Sanity + Meta Muse

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

前提条件

完整的设置说明已内置在连接器中 (在 store 中选择连接器时可见)。所需环境变量:

SANITY_PROJECT_ID, SANITY_DATASET, SANITY_API_TOKEN

步骤 1 — 获取凭证

  1. 打开 https://www.sanity.io/manage,选择项目,把它的 Project ID(8 个字符,例如 abc12xyz)复制到 SANITY_PROJECT_ID。

  2. 在 Datasets 下找到要使用的数据集,通常是 production,填入 SANITY_DATASET。

  3. 在 API → Tokens 下点击 Add API token,起一个名字并选择权限:

    • Viewer:读取已发布的文档和草稿,包括历史。所有读取工具用它就够了;写入会被拒绝。
    • Editor:还可以写入。创建、修改和发布草稿时需要它。

    不要使用 Developer 和 Administrator 令牌:它们还能修改项目设置和数据集。

  4. 把令牌复制到 SANITY_API_TOKEN(Sanity 只显示一次),然后安装连接器。用 sanity_list_document_types 检查设置。

GROQ 查询:sanity_query 在你的数据集上运行 GROQ,因此 AI 一次调用就能回答“哪些文章没有 SEO 描述”或“有多少商品缺货”这类问题。它只取需要的字段,并限制结果数量,因为超过约 60 KB 的响应会被截断,同时用参数传值。还不了解你的数据结构时,它会先列出文档类型并查看几篇文档。使用 drafts 视角时,它会把所有草稿当作已发布来读取内容。

先存草稿,经你同意才上线:sanity_create_draft 和 sanity_patch_draft 只会写入草稿,也就是编辑在 Sanity Studio 中看到的版本。在 sanity_publish_draft 替换已发布文档之前,网站上不会有任何变化。每一步之前,AI 都会给你看文档、改动以及是否会上线,并等你明确同意。试运行(dry run)可以在不保存的情况下检查操作。sanity_delete_document 在安装时处于关闭状态。

历史:sanity_list_document_transactions 显示谁在什么时候修改了文档,sanity_get_document_revision 返回文档在某个修订版本或某个时间点的样子,例如用来比较两个版本或找回被覆盖的文字。

富文本:Portable Text 字段是由块组成的数组,每个块都需要唯一的 _key。连接器会告诉 AI 如何写普通段落。

常见错误:401 Session not found:令牌错误或已被删除。403 Insufficient permissions:Viewer 令牌尝试写入,或令牌属于另一个项目。404 Dataset not found:请检查 SANITY_DATASET。400 queryParseError:GROQ 查询有语法错误,消息会指出位置。

不包括:图片和文件上传、内容发布批次(content releases)和定时发布、取消发布、数据集和项目管理、Webhook、CORS、成员以及实时监听。

步骤 2 — 安装 adapter

curl -fsSL https://raw.githubusercontent.com/HelpCode-ai/anythingmcp/main/docker-compose.quickstart.yml -o docker-compose.yml
printf 'JWT_SECRET=%s\nENCRYPTION_KEY=%s\n' "$(openssl rand -hex 32)" "$(openssl rand -hex 32)" > .env
docker compose up -d

步骤 3 — 在 Muse 中添加连接器

你的服务器 URL: 在 AnythingMCP 中打开 MCP Servers → 此连接器所在的服务器,复制它的 URL(https://cloud.anythingmcp.com/mcp/…)。本指南中出现 YOUR_SERVER_ID 的地方都用它替换。

Muse 以自定义连接器的形式添加远程 MCP 服务器,并通过 OAuth 登录。

  1. 在 Muse 中打开 Settings → Connectors,选择 Add custom connector。
  2. 粘贴 MCP 服务器 URL https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID。
  3. Muse 会打开 AnythingMCP 的登录页面:登录并批准访问。
  4. 在聊天中,向 Muse 提出需要用到 Sanity 的工具的请求。

你也可以在聊天中完成设置,适用于网页版、iOS 和 Android 应用以及 WhatsApp。给 Muse 发送这条消息:

Create a Custom Connector for a new remote MCP server, then connect to it:
Name: AnythingMCP
Transport: remote streamable HTTP
URL: https://cloud.anythingmcp.com/mcp/YOUR_SERVER_ID
Auth: OAuth

自托管?请用你实例的公网 HTTPS 地址替换 https://cloud.anythingmcp.com。Muse 从 Meta 的云端连接,因此 localhost 无法使用。

可用工具

ToolWhat it does
sanity_queryRun a GROQ query against the dataset and return its result
sanity_list_document_typesList the document types that exist in the dataset (from _type), drafts included, e.g. post, author, sanity.imageAsset
sanity_get_documentRead documents by id, published (post-123) or draft (drafts.post-123), with all their fields; several ids separated by commas
sanity_get_document_revisionRead a document as it was in the past: at a revision id (_rev, from sanity_list_document_transactions), at a point in time, or its last…
sanity_list_document_transactionsList the changes (transactions) of a document: transaction id, time, author id and the kind of change (create, patch, publish, delete)…
sanity_create_draftCreate a new document as a draft (not published). document must contain _type and _id = "drafts." + document_id, plus its fields
sanity_patch_draftChange fields of a document's draft with a patch, e.g. {"set": {"title": "New"}}, {"unset": ["subtitle"]}, {"setIfMissing": {"tags": []}}…
sanity_publish_draftPublish a document's draft: the draft replaces the published version and goes live on every site that reads this dataset, and the draft is…
sanity_delete_documentDelete a published document and the drafts you list
sanity_list_datasetsList the datasets of the project: name and whether each is public or private
sanity_list_projectsList the Sanity projects the token can see: id, name, studio host and creation date

示例提示

  • “最近 30 天发布了哪些博客文章?显示标题、作者和 slug。”
  • “找出所有描述为空或少于 50 个字的商品。”
  • “定价页面最后是谁改的?改之前写的是什么?”
  • “把关于春季发布的那篇文章标题里的错别字‘发部’改成‘发布’。保存为草稿,保存前先给我看改动。”
  • “发布文章‘十月更新说明’的草稿。先准确告诉我哪些内容会上线。”

FAQ

Muse 在哪些地区可用? Meta 目前在美国和加拿大提供 Muse,可在网页版、iOS 和 Android 应用以及 WhatsApp 中使用。

Meta 会审核这个连接器吗? 不会。Meta 不审核自定义连接器。Muse 只能看到你在 AnythingMCP 中为此 MCP 服务器启用的工具,你也可以随时在 Settings → Connectors 中断开它。

下一步

这份指南对你有帮助吗?

你的 Sanity 智能体只差一次点击。

安装连接器,粘贴密钥,向 Meta Muse 提问。免费试用 7 天,无需信用卡。

相关指南

连接器

如何通过 MCP 将 Sanity 连接到 ChatGPT

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

连接器

如何通过 MCP 将 Sanity 连接到 Claude

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

连接器

如何通过 MCP 将 Sanity 连接到 Cursor

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

连接器

如何通过 MCP 将 Sanity 连接到 Gemini

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

连接器

Sanity 接入 MCP:在任意 AI 代理中运行 GROQ 查询和编辑草稿

让你的 AI 处理 Sanity 内容:运行 GROQ 查询,读取文档及其修订版本和变更历史,列出文档类型、数据集和项目,并在你确认后创建、修改和发布草稿。使用 Viewer 或 Editor 权限的 API 令牌。

连接器

如何通过 MCP 将 Avito 连接到 Meta Muse

让你的 AI 使用你的 Avito 企业账户:列出广告并修改价格,读取浏览、联系和来电统计,检查自动上传 (autoload) 的上传记录及其错误、Feed 格式和钱包,并读取 Avito Messenger 聊天。发送消息和修改自动上传设置为可选功能,默认关闭。