SANITY MCP SERVER
Connect Sanity to Andromity with the Sanity MCP server
Connect Sanity's official MCP server to Andromity: let your AI coding agent run GROQ queries, patch documents, manage releases and deploy schemas without leaving your editor.
- Server
- https://mcp.sanity.io
- Connects with
- Browser sign-in (OAuth)
- Category
- Design & content
Sanity hosts an official MCP server at https://mcp.sanity.io. With it, Andromity can read your schema, query content with GROQ, create and patch documents, manage releases and upload assets while it works on your Studio code.
Sanity uses OAuth by default, so connecting is a browser sign-in with your Sanity account. Sanity also supports a bearer API token for setups that cannot sign in.
What the agent can do with Sanity
- Query and read documents with GROQ (query_documents, get_document).
- Create, patch, publish and unpublish documents, and discard drafts (create_documents, patch_documents, publish_documents, unpublish_documents, discard_drafts).
- Read schemas and deploy a schema or Studio (get_schema, list_workspace_schemas, deploy_schema, deploy_studio).
- Create releases and versions (create_release, create_version, list_releases).
- Upload assets and work with Media Libraries (dataset_assets_upload_from_url, media_library_list).
- Manage projects, datasets and CORS origins (list_projects, create_dataset, add_cors_origin).
- Search content semantically and search Sanity's docs (semantic_search, search_docs, read_docs).
Example prompts
Ask for the work in plain language. Naming the server helps, for example “use the Sanity MCP server”.
- Read the schema for the post type with get_schema, then fix the GROQ query in src/lib/queries.ts that returns null for author.
- Add a seoDescription field to the article schema in this Studio, deploy the schema, and list any existing articles missing it.
- Create a release called Spring launch and put drafts of the three pricing page documents into it.
- Add http://localhost:3000 as a CORS origin on the production dataset so the preview works.
Connect Sanity
- You need a Sanity account with access to the project you want the agent to use.
- In VS Code, open Andromity Hub → MCP Servers → Discover. In the terminal app, open /settings → MCP → + Connect an app. Find Sanity and select Connect.
- Sign in to Sanity in your browser and approve the connection. If you cancel, nothing is saved.
- Andromity saves Sanity to ~/.andromity/mcp.json and connects it.
See Connect an app for how Andromity stores connectors and tokens.
Access and safety
- Available tools depend on your account's permissions for the project and dataset. If a tool is missing or fails, check those permissions.
- Sanity says edits are saved to the draft or release version, never directly to published content. Publishing is a separate step.
- Sanity does not describe a read-only mode. You can disable the AI image tools (generate_image, transform_image) in your client.
- To use an API token instead of OAuth, add the server by hand in mcp.json with an Authorization: Bearer header. A token acts within its own role and scoped permissions.
In an untrusted folder, MCP servers don’t start at all. Read workspace trust and permission modes for the full model.
Limits to know
- patch_documents accepts at most 25 documents per call.
- Uploads from a local or private file are limited to 50 MiB.
- OAuth sessions typically expire after 7 days.
- The AI image tools use AI credits.
- When a request is rate limited, Sanity asks clients to honor the Retry-After header.
Questions
- Does Sanity have an official MCP server?
- Yes. Sanity hosts a remote MCP server at https://mcp.sanity.io. The older local @sanity/mcp-server is deprecated in favor of it.
- Can the agent publish content directly?
- Only through a separate publish step. Sanity says edits go to the draft or release version, not directly to published content.
- Can I use an API token instead of OAuth?
- Yes. Sanity supports an Authorization: Bearer header in the MCP config, in which case the server does not use OAuth.
Sources
This guide is based on Sanity’s own documentation. The app controls its server, so tools can change; check the source for the current list.
Sanity is a trademark of its owner. Andromity is not affiliated with or endorsed by Sanity.