Sanity
平台与服务by sanity-io
可直接访问你的 Sanity 项目,包括 content、datasets、releases、schemas 及 agent rules。
需要统一管理 Sanity 项目的内容、数据集、schema 和发布流程时,它能直连核心资源,协作更新比东拼西凑更省心。
什么是 Sanity?
可直接访问你的 Sanity 项目,包括 content、datasets、releases、schemas 及 agent rules。
README
Collection of resources to help AI agents build better with Sanity. Supports Cursor, Claude Code, Codex, VS Code, Lovable, v0, Replit, OpenCode, and any other editor/agent compatible with MCP or Agent Skills.
Features
- MCP server: Direct access to your Sanity projects (content, datasets, releases, schemas) and agent rules.
- Agent skills: Comprehensive best practices skills for Sanity development, content modeling, SEO/AEO, and experimentation. Includes 21 integration/topic guides and 26 focused best-practice rules.
- Agent Plugin:
plugin.json,skills/, andmcp.jsoncomponents for any Agent Plugins-compatible client. - Claude Code plugin: MCP server, agent skills, and slash commands for Claude Code users. Available on the official Anthropic plugin marketplace.
- Cursor plugin: MCP server, agent skills, and commands on the Cursor Marketplace.
- Codex plugin: MCP server and agent skills for OpenAI Codex users.
Get started
Choose your path based on how you want agents to work with Sanity:
- MCP server — Give your agent always up-to-date rules and full access to your Sanity projects. No local files to maintain. Works with Cursor, VS Code, Claude Code, Lovable, v0, Replit, OpenCode, and other MCP-compatible clients.
- Agent skills — Install best practices skills for Sanity, content modeling, SEO/AEO, and experimentation. Works with Cursor, Claude Code, and any Agent Skills-compatible agent.
- Plugin — Install the Sanity plugin for Cursor, Claude Code, or any Agent Plugins-compatible client. Bundles MCP server, agent skills, and commands.
- Manual installation — Copy the skill references locally for offline use. You'll need to update them yourself.
Option 1: Install MCP server (recommended)
Give agents direct access to Sanity projects and always up-to-date agent rules via the MCP server.
Quick install via Sanity CLI
Run in terminal to detect and configure MCP for Cursor, Claude Code and VS Code automatically:
npx sanity@latest mcp configure
Uses your logged-in CLI user for authentication — no manual tokens or OAuth needed.
Client-specific instructions
<details> <summary><strong>Cursor</strong></summary>Or manually: Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) → View: Open MCP Settings → + New MCP Server → add to mcp.json:
{
"mcpServers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
Run in terminal. Authenticate with OAuth on next launch:
claude mcp add Sanity -t http https://mcp.sanity.io --scope user
Run in terminal. Authenticate with OAuth on next launch:
codex mcp add Sanity --url https://mcp.sanity.io
Or manually add to ~/.codex/config.toml:
[mcp_servers.Sanity]
url = "https://mcp.sanity.io"
Open Command Palette (Cmd+Shift+P / Ctrl+Shift+P) → MCP: Open User Configuration → add:
{
"servers": {
"Sanity": {
"type": "http",
"url": "https://mcp.sanity.io"
}
}
}
Sanity is available as a prebuilt chat connector in Lovable:
- Open Connectors → Chat connectors
- Select Sanity
- Click Connect and sign in to authorize your Sanity account
In your next prompt, reference your Sanity project or ask the agent to read your schema.
See the Lovable MCP documentation or Sanity + Lovable guide for more details.
</details> <details> <summary><strong>v0</strong></summary>In the prompt input field, click Prompt Tools → MCPs → Add New → Select Sanity → Authorize → Authenticate with OAuth.
</details> <details> <summary><strong>Replit</strong></summary>Go to Integrations Page → scroll to MCP Servers for Replit Agent → Add MCP server → Enter Sanity as name and https://mcp.sanity.io as Server URL → Test & Save → Authenticate with OAuth.
Add to your opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"sanity": {
"type": "remote",
"url": "https://mcp.sanity.io",
"oauth": {}
}
}
}
Then run: opencode mcp auth sanity
For any MCP-compatible client, add https://mcp.sanity.io as the server URL.
If your client doesn't support remote MCP servers, use a proxy like mcp-remote:
{
"mcpServers": {
"Sanity": {
"command": "npx",
"args": ["mcp-remote", "https://mcp.sanity.io", "--transport", "http-only"]
}
}
}
Authorization and troubleshooting
Manual MCP configuration uses OAuth by default. You can use token auth instead by setting an Authorization: Bearer <token> header in the MCP config. If authentication fails after CLI setup, rerun npx sanity@latest mcp configure and restart your MCP client. For OAuth reset issues, Cursor provides Cursor: Clear All MCP Tokens and VS Code provides Authentication: Remove Dynamic Authentication Providers.
See the Sanity MCP docs for authorization options and troubleshooting.
Option 2: Install Agent Skills
Install best practices skills that work with any Agent Skills-compatible agent.
npx skills add sanity-io/agent-toolkit
See Option 3 for plugin installation.
Option 3: Install plugin
Install the Sanity plugin to get MCP server, agent skills, and commands. Available on the Claude Code marketplace, Cursor Marketplace, or from this repo as an Agent Plugin.
Claude Code
The Sanity plugin is listed on the official Anthropic plugin marketplace. The official marketplace (claude-plugins-official) is pre-registered when you start Claude Code — you do not need to add a custom marketplace.
Install from Claude Code:
/plugin install sanity@claude-plugins-official
If the plugin is not found, refresh the marketplace catalog and retry:
/plugin marketplace update claude-plugins-official
Then run /reload-plugins to activate without restarting.
Alternative: interactive install
- Run
/pluginand open the Discover tab - Search for Sanity
- Review what the plugin will install — commands, skills, hooks, and MCP servers — before confirming (Anthropic recommends reviewing plugin permissions and source before installing)
- Choose an installation scope:
- User (default): all projects on this machine
- Project: shared with collaborators via
.claude/settings.json - Local: this repository only
- Run
/reload-pluginsto activate without restarting
Verify installation: Ask Claude Code: "which skills do you have access to?"
You should see the Sanity skills listed.
Start using: Use natural language and skills activate automatically:
Help me create a blog post schema in Sanity
Review my GROQ query and Next.js Visual Editing setup
Or run /sanity to explore all capabilities.
Cursor
Install from the Cursor Marketplace by running this in Cursor chat:
/add-plugin sanity
Verify installation: Ask Cursor: "which skills do you have access to?"
You should see the Sanity skills listed.
Start using: Use natural language and skills activate automatically:
Help me create a blog post schema in Sanity
Review my GROQ query and Next.js Visual Editing setup
Codex
- Add the Sanity marketplace:
codex plugin marketplace add sanity-io/agent-toolkit
-
Install the plugin from Codex's plugin directory (select the Sanity Agent Toolkit marketplace, then install Sanity).
-
Restart Codex. Verify by asking: "which skills do you have access to?" — you should see the Sanity skills listed.
Option 4: Manual installation
Install the skill references locally to teach your editor Sanity best practices:
- Copy
skills/sanity-best-practices/to your project. - (Recommended) Copy
AGENTS.mdto your project root to act as a knowledge router.
Capabilities
MCP tools
With MCP connected, your AI can use tools like:
query_documents— run GROQ queries directlycreate_documents— create draft documents from structured content, or version documents when a release ID is providedpatch_documents— surgical edits to existing documents; published documents are edited by creating or updating draftspublish_documents/unpublish_documents— manage document lifecycledeploy_schema/get_schema— deploy MCP-managed schemas and inspect deployed schemasdeploy_studio— deploy a hosted Studio bound to an MCP-managed schemacreate_release/list_releases— create and inspect Content Releasescreate_version— create version documents for releasesgenerate_image/transform_image— AI image generation and editingwhoami— verify the authenticated Sanity userget_project_studios— list Studio applications linked to a projectsearch_docs/read_docs— search and read Sanity documentationlist_sanity_rules/get_sanity_rules— load agent rules on demandgive_feedback— report MCP tool errors, missing capabilities, confusing output, or documentation issues
MCP-managed schemas are resolved before Studio-deployed and legacy schemas. If you deploy schema changes with deploy_schema, redeploy any matching MCP-managed Studio with deploy_studio so it picks up the latest schema. generate_image, transform_image, and create_version with an instruction consume Sanity AI credits.
See the full list of available tools.
Agent skills
Best practices skills that agents like Claude Code, Cursor, GitHub Copilot, etc. can discover and use automatically. Skills follow the Agent Skills format. See Option 2 for installation.
| Skill | Description |
|---|---|
| sanity-best-practices | GROQ performance, schema design, Visual Editing, images, Portable Text, Studio, TypeGen, localization, migrations, and framework integration guides |
| content-modeling-best-practices | Structured content principles: separation of concerns, references vs embedding, content reuse |
| seo-aeo-best-practices | SEO/AEO with EEAT principles, structured data (JSON-LD), technical SEO patterns |
| content-experimentation-best-practices | A/B testing methodology, statistical foundations, experiment design |
Getting started flow
The onboarding guide follows three phases:
- Studio & Schema — Set up Sanity Studio and define your content model
- Content — Import existing content or generate placeholder content via MCP
- Frontend — Integrate with your application (framework-specific)
Just say: "Get started with Sanity" to begin.
Slash commands (Claude Code)
| Command | What it does |
|---|---|
/sanity | List available skills and help topics |
/sanity-review | Review code for Sanity best practices |
/typegen | Run TypeGen and troubleshoot issues |
/deploy-schema | Deploy schema with verification |
Repository structure
Note: The reference files in
skills/sanity-best-practices/references/are the canonical content for the Sanity MCP server'slist_sanity_rules/get_sanity_rulestools. Each file must have validnameanddescriptionfrontmatter — rule names are derived from filenames (e.g.,nextjs.md→nextjs).
sanity-io/agent-toolkit/
├── AGENTS.md # Knowledge router & agent behavior
├── README.md # This file
├── plugin.json # Portable Agent Plugins v1 manifest
├── mcp.json # Portable Agent Plugins v1 MCP configuration
├── .agents/plugins/ # Codex marketplace
│ └── marketplace.json # Codex marketplace metadata
├── .claude-plugin/ # Claude Code plugin configuration (distributed via claude-plugins-official)
│ ├── plugin.json # Plugin manifest (name: sanity)
│ └── marketplace.json # Marketplace manifest for repo-based discovery
├── .codex-plugin/ # Codex plugin configuration
│ └── plugin.json # Codex plugin manifest
├── .cursor-plugin/ # Cursor plugin configuration (distributed via cursor.com/marketplace)
│ ├── marketplace.json # Cursor marketplace metadata
│ └── plugin.json # Per-plugin manifest
├── .mcp.json # Legacy client MCP compatibility configuration
├── assets/ # Plugin branding
│ └── logo.svg # Sanity logo for marketplace display
├── commands/ # Agent commands
│ ├── sanity.md # /sanity help
│ ├── sanity-review.md # /sanity-review
│ ├── typegen.md # /typegen
│ └── deploy-schema.md # /deploy-schema
├── scripts/ # Validation and CI scripts
│ ├── validate-agent-plugin.mjs # Validate manifests against the v1 JSON Schemas
│ └── validate-cursor-plugin.mjs # Cursor plugin validator
└── skills/ # Agent skills (agentskills.io format)
├── sanity-best-practices/ # Comprehensive Sanity skill
│ ├── SKILL.md # Skill definition and quick reference
│ └── references/ # Canonical content (22 guides)
│ ├── get-started.md # Onboarding guide
│ ├── nextjs.md # Next.js integration
│ ├── groq.md # GROQ patterns & performance
│ ├── schema.md # Schema design & validation
│ └── ... # See SKILL.md for full index
├── content-modeling-best-practices/ # Modeling guidance + topic references
├── seo-aeo-best-practices/ # SEO/AEO guidance + topic references
└── content-experimentation-best-practices/ # Experiment design + stats references
All skills use references/ for detailed content loaded on demand. The sanity-best-practices references are also the canonical source for the MCP server's Sanity rules.
Resources
- Create Sanity account
- Sanity documentation
- GROQ language reference
- Visual Editing guide
- Sanity TypeGen
- MCP server docs
- Agent Plugins specification
- Blueprints Infrastructure as Code
Contributing
Found a better pattern? Missing a framework or best practice? Read the contributing guide for how skills work and what makes a good contribution, then:
- Fork the repo.
- Install dependencies with
npm install. - Make your changes in
skills/<skill-name>/. - Run
npm run validate:allto check skill and plugin validity. - Submit a PR.
Support
License: MIT
常见问题
Sanity 是什么?
可直接访问你的 Sanity 项目,包括 content、datasets、releases、schemas 及 agent rules。
相关 Skills
MCP构建
by anthropics
聚焦高质量 MCP Server 开发,覆盖协议研究、工具设计、错误处理与传输选型,适合用 FastMCP 或 MCP SDK 对接外部 API、封装服务能力。
✎ 想让 LLM 稳定调用外部 API,就用 MCP构建:从 Python 到 Node 都有成熟指引,帮你更快做出高质量 MCP 服务器。
Slack动图
by anthropics
面向Slack的动图制作Skill,内置emoji/消息GIF的尺寸、帧率和色彩约束、校验与优化流程,适合把创意或上传图片快速做成可直接发送的Slack动画。
✎ 帮你快速做出适配 Slack 的动图,内置约束规则和校验工具,少踩上传与播放坑,做表情包和演示都更省心。
接口测试套件
by alirezarezvani
扫描 Next.js、Express、FastAPI、Django REST 的 API 路由,自动生成覆盖鉴权、参数校验、错误码、分页、上传与限流场景的 Vitest 或 Pytest 测试套件。
✎ 帮你把API与集成测试自动化跑顺,减少回归漏测;能力全面,尤其适合复杂接口场景的QA团队。
相关 MCP Server
Slack 消息
编辑精选by Anthropic
Slack 是让 AI 助手直接读写你的 Slack 频道和消息的 MCP 服务器。
✎ 这个服务器解决了团队协作中需要 AI 实时获取 Slack 信息的痛点,特别适合开发团队让 Claude 帮忙汇总频道讨论或发送通知。不过,它目前只是参考实现,文档有限,不建议在生产环境直接使用——更适合开发者学习 MCP 如何集成第三方服务。
by netdata
io.github.netdata/mcp-server 是让 AI 助手实时监控服务器指标和日志的 MCP 服务器。
✎ 这个工具解决了运维人员需要手动检查系统状态的痛点,最适合 DevOps 团队让 Claude 自动分析性能数据。不过,它依赖 NetData 的现有部署,如果你没用过这个监控平台,得先花时间配置。
by d4vinci
Scrapling MCP Server 是专为现代网页设计的智能爬虫工具,支持绕过 Cloudflare 等反爬机制。
✎ 这个工具解决了爬取动态网页和反爬网站时的头疼问题,特别适合需要批量采集电商价格或新闻数据的开发者。不过,它依赖外部浏览器引擎,资源消耗较大,不适合轻量级任务。