The Sanity MCP connector routes your AI agent's tool calls to Sanity's own MCP server through Scalekit. Each user signs in to Sanity once, and Scalekit stores and refreshes their tokens, so your agent never handles credentials. It comes with 45 tools.
- Tools
- 45
- What they doRead · write · destructive
- 20 · 18 · 720 read18 write7 destructive
- Users sign in with
- OAuth
- OAuth app
- Scalekit's or your own
What you can do
- Query content: run GROQ queries and semantic searches to find documents in a dataset
- Create and edit documents: create drafts from structured content, JSON, or Markdown, patch documents, and generate images with AI
- Publish content: publish, unpublish, and discard drafts, and group changes into content releases
- Manage schemas and datasets: read and deploy schemas, and create, list, and update datasets
- Work with projects and Studios: list organizations and projects, create projects, and deploy Sanity Studio
- Search Sanity docs: search and read Sanity documentation and migration guides
Setup
Install the SDK
Terminal window npm install @scalekit-sdk/node dotenvTerminal window pip install scalekit-sdk-python python-dotenvSet your credentials
Add your Scalekit credentials to your
.envfile. Find values in app.scalekit.com > Developers > API Credentials..env SCALEKIT_ENVIRONMENT_URL=<your-environment-url>SCALEKIT_CLIENT_ID=<your-client-id>SCALEKIT_CLIENT_SECRET=<your-client-secret>Create the Sanity MCP connection
In AgentKit > Connections, create a Sanity MCP connection. The name you give it is the
connection_nameyour code passes. See Configure connections.Scalekit credentials are available for Sanity MCP server, so you don't need to register an OAuth app.
Authorize a user and make your first call
quickstart.mts import { ScalekitClient } from '@scalekit-sdk/node'import 'dotenv/config'import { createInterface } from 'node:readline/promises'const scalekit = new ScalekitClient(process.env.SCALEKIT_ENVIRONMENT_URL,process.env.SCALEKIT_CLIENT_ID,process.env.SCALEKIT_CLIENT_SECRET,)const actions = scalekit.actionsconst connector = 'sanitymcp'const identifier = 'user_123'// Generate an authorization link for the userconst { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })console.log('Authorize Sanity MCP:', link)const rl = createInterface({ input: process.stdin, output: process.stdout })await rl.question('Press Enter after authorizing...')rl.close()// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'sanitymcp_whoami',toolInput: {},})console.log(result)Terminal window npx tsx quickstart.mtsquickstart.py import osfrom scalekit import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENVIRONMENT_URL"),client_id=os.getenv("SCALEKIT_CLIENT_ID"),client_secret=os.getenv("SCALEKIT_CLIENT_SECRET"),)actions = scalekit_client.actionsconnection_name = "sanitymcp"identifier = "user_123"# Generate an authorization link for the userlink_response = actions.get_authorization_link(connection_name=connection_name,identifier=identifier,)print("Authorize Sanity MCP:", link_response.link)input("Press Enter after authorizing...")# Make your first callresult = actions.execute_tool(tool_input={},tool_name="sanitymcp_whoami",connection_name=connection_name,identifier=identifier,)print(result)Terminal window python quickstart.pyEach user signs in once. See Authorize a user for the full flow and statuses.
Tools
Pass the exact name toexecute_toolsanitymcp__get_ui_contextGet the current UI context including the active document and workspace in Sanity Studio.Read-onlyGet Ui Context
Get the current UI context including the active document and workspace in Sanity Studio.
Inputs
resourceobjectrequired- No description.
documentIdstring- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
documentTypestring- Schema type name of the document.
maxRefDepthinteger- Maximum reference depth to follow when resolving document references.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_cors_origins_listLists all CORS origins configured for a Sanity project.Read-onlyList CORS Origins
Lists all CORS origins configured for a Sanity project.
Inputs
resourceobjectrequired- Resource information indicating which project ID to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_dataset_assets_uploadProvide local Sanity CLI guidance for uploading an image or file asset to a Content Lake dataset.Read-onlyPrepare Dataset Asset Upload
Provide local Sanity CLI guidance for uploading an image or file asset to a Content Lake dataset. This tool does not read or upload the file.
Inputs
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_get_documentRetrieve a single Sanity document by its ID.Read-onlyGet Document
Retrieve a single Sanity document by its ID.
Inputs
documentIdstringrequired- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_get_project_studiosList all Sanity Studios deployed for a project.Read-onlyGet Project Studios
List all Sanity Studios deployed for a project.
Inputs
resourceobjectrequired- No description.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_get_sanity_rulesLoad one or more Sanity content rules by name.Read-onlyGet Sanity Rules
Load one or more Sanity content rules by name.
Inputs
rulesarrayrequired- One or more rule names to load. Use list_sanity_rules to see available rules.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_get_schemaRetrieve the schema for a specific document type in a workspace.Read-onlyGet Schema
Retrieve the schema for a specific document type in a workspace.
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
schemaIdstring- Optional exact schema ID returned by list_workspace_schemas. Use this to inspect a specific source when multiple deployments share a workspace name.
typestring- Document schema type name.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_list_datasetsList all datasets in a Sanity project.Read-onlyList Datasets
List all datasets in a Sanity project.
Inputs
resourceobjectrequired- No description.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_list_embeddings_indicesList all embeddings indices available in a Sanity project.Read-onlyList Embeddings Indices
List all embeddings indices available in a Sanity project.
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_list_organizationsList all Sanity organizations the authenticated user belongs to.Read-onlyList Organizations
List all Sanity organizations the authenticated user belongs to.
Inputs
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_list_projectsList all Sanity projects the authenticated user has access to.Read-onlyList Projects
List all Sanity projects the authenticated user has access to.
Inputs
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_list_releasesList content releases for a project with optional state filtering and pagination.Read-onlyList Releases
List content releases for a project with optional state filtering and pagination.
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
limitinteger- Maximum number of items to return.default
10 offsetinteger- Number of items to skip for pagination.default
0 statestring- Filter releases by state: active, archived, or published.one of
activescheduledpublishedarchived
sanitymcp_list_sanity_rulesList all available Sanity content rule names.Read-onlyList Sanity Rules
List all available Sanity content rule names.
Inputs
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_list_workspace_schemasList all schema types defined in a Sanity workspace.Read-onlyList Workspace Schemas
List all schema types defined in a Sanity workspace.
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_migration_guideRetrieve a Sanity migration guide by name.Read-onlyMigration Guide
Retrieve a Sanity migration guide by name.
Inputs
guidestringrequired- Name of the migration guide to retrieve.one of
generalschema.genericschema.contentfulschema.wordpressschema.strapischema.drupalcontent.genericcontent.contentfulcontent.wordpresscontent.strapi intentstring- Brief description of what you are trying to accomplish.
sanitymcp_query_documentsExecute a GROQ query against the Sanity dataset and return matching documents.Read-onlyQuery Documents
Execute a GROQ query against the Sanity dataset and return matching documents.
Inputs
querystringrequired- GROQ query string to execute.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
limitinteger- Maximum number of items to return.default
10 paramsobject- Optional parameters for the GROQ query
perspectivestring- Query perspective: published, previewDrafts, or raw.default
raw singleboolean- Return a single result instead of an array.default
false
sanitymcp_read_docsRead a Sanity documentation page by URL or path.Read-onlyRead Docs
Read a Sanity documentation page by URL or path.
Inputs
intentstring- Brief description of what you are trying to accomplish.
pathstring- Document field path to target.
urlstring- URL of the Sanity documentation page to read.
sanitymcp_search_docsSearch Sanity documentation by keyword query.Read-onlySearch Docs
Search Sanity documentation by keyword query.
Inputs
querystringrequired- GROQ query string to execute.
intentstring- Brief description of what you are trying to accomplish.
limitinteger- Maximum number of items to return.default
10
sanitymcp_semantic_searchPerform a semantic similarity search against a Sanity embeddings index.Read-onlySemantic Search
Perform a semantic similarity search against a Sanity embeddings index.
Inputs
indexNamestringrequired- Name of the embeddings index to search.
querystringrequired- GROQ query string to execute.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
limitinteger- Maximum number of items to return.default
10
sanitymcp_whoamiGet the currently authenticated Sanity user profile.Read-onlyWhoami
Get the currently authenticated Sanity user profile.
Inputs
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_add_cors_originAdd a CORS origin to allow browser-based API access for a Sanity project.WriteAdd Cors Origin
Add a CORS origin to allow browser-based API access for a Sanity project.
Inputs
originstringrequired- CORS origin URL to allow (e.g. https://myapp.com).
resourceobjectrequired- No description.
allowCredentialsboolean- Whether to allow credentials (cookies) from this CORS origin.default
true intentstring- Brief description of what you are trying to accomplish.
sanitymcp_create_datasetCreate a new dataset in a Sanity project with the specified access control mode.WriteCreate Dataset
Create a new dataset in a Sanity project with the specified access control mode.
Inputs
datasetNamestringrequired- Name of the Sanity dataset.
resourceobjectrequired- No description.
aclModestring- Dataset access control mode: public or private.one of
privatepublic descriptionstring- Human-readable description.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_create_documentsCreate one or more draft documents by directly providing structured content.WriteCreate Document(s)
Create one or more draft documents by directly providing structured content. Creates drafts (drafts.* prefix) unless releaseId is specified for version creation.
Inputs
documentsarrayrequired- Array of documents to create. Each document must have a type and content, with every document field inside content. Prefer Sanity-generated _id values by omitting _id from content unless a stable custom document ID is required.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- Optional release ID for creating versioned documents. If provided, documents will be created under the specified release version instead of as drafts.
workspaceNamestring- Workspace name as returned by `list_workspace_schemas`. Not a document type. Defaults to "default".default
default
sanitymcp_create_documents_from_jsonCreate one or more Sanity documents from a JSON array of document objects.WriteCreate Documents From Json
Create one or more Sanity documents from a JSON array of document objects.
Inputs
documentsarrayrequired- Array of documents to create. Each document must have a type and content.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- ID of the release to target.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_create_documents_from_markdownCreate one or more Sanity documents from Markdown content.WriteCreate Documents From Markdown
Create one or more Sanity documents from Markdown content.
Inputs
documentsarrayrequired- Array of documents to create. Each document must have a type and Markdown content.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- ID of the release to target.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_create_projectCreate a new Sanity project with optional CORS origin and organization.WriteCreate Project
Create a new Sanity project with optional CORS origin and organization.
Inputs
displayNamestringrequired- Display name for the Sanity project.
organizationIdstringrequired- Sanity organization ID to create the project under.
allowCredentialsboolean- Whether to allow credentials (cookies) from this CORS origin.default
true corsOriginstring- CORS origin URL for the new project.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_create_releaseCreate a new content release for scheduling or grouping document publications.WriteCreate Release
Create a new content release for scheduling or grouping document publications.
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
titlestringrequired- Title of the release.
descriptionstring- Human-readable description.
intendedPublishAtstring- ISO 8601 datetime when the release is scheduled to publish.
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- Optional release ID, if omitted one is generated.
releaseTypestring- Type of release: scheduled, immediate, or undecided.one of
asapundecidedscheduleddefaultundecided
sanitymcp_create_versionCreate versioned copies of documents and associate them with a release.WriteCreate Version
Create versioned copies of documents and associate them with a release.
Inputs
documentIdsarrayrequired- Array of document IDs to create versions for (min 1, max 10)
releaseIdstringrequired- ID of the release to target.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_deploy_schemaDeploy a schema declaration to a Sanity project workspace.WriteDeploy Schema
Deploy a schema declaration to a Sanity project workspace.
- Idempotent
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
schemaDeclarationstringrequired- Sanity schema configuration declaration string.
intentstring- Brief description of what you are trying to accomplish.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_deploy_studioDeploy a Sanity Studio to a hosted app subdomain.WriteDeploy Studio
Deploy a Sanity Studio to a hosted app subdomain.
- Idempotent
Inputs
appHoststringrequired- Subdomain hostname for the deployed Sanity Studio.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
titlestringrequired- Human-facing title shown in Studio navigation.
intentstring- Brief description of what you are trying to accomplish.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_generate_imageGenerate an image for a document field using an AI instruction.WriteGenerate Image
Generate an image for a document field using an AI instruction.
Inputs
documentIdstringrequired- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
imagePathstringrequired- Path to the image field within the document.
instructionstringrequired- Natural language instruction for the image transformation.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_give_sanity_feedbackSubmit feedback about Sanity when you encounter issues while working with a Sanity codebase or project.WriteGive Sanity Feedback
Submit feedback about Sanity when you encounter issues while working with a Sanity codebase or project. Use this when: - A Sanity MCP tool returned an unexpected error or confusing result - You needed a Sanity capability that doesn't exist or is hard to use - Sanity docs, MCP tool descriptions, or examples were unclear or incorrect - Common Sanity surfaces such as @sanity/client, the HTTP API, schemas, Studio, or deployment were confusing or blocked progress - You had to use a workaround for something in Sanity that should be simpler Provide a specific, detailed message about what you were trying to do, what happened, and what you expected instead.
Inputs
messagestringrequired- Describe the Sanity issue. Include: what you were trying to do, what you tried, and where you got stuck. Be specific — include MCP tool names, Sanity surface names such as @sanity/client, HTTP API, docs, Studio, or schemas, error messages, and parameter values when relevant.
categorystring- Category of feedback to help with triage.one of
tool_errormissing_capabilityconfusing_outputdocumentationsanity_apiother intentstring- Brief description of what you are trying to accomplish.
projectIdstring- The Sanity project ID this feedback relates to, if any. Leave unset for general feedback not tied to a specific project.
severitystring- How much this blocked progress. high = completely blocked, medium = workaround needed, low = minor.one of
lowmediumhighdefaultmedium toolNamestring- The MCP tool this feedback is about, if any (e.g. "query_documents"). Leave unset for general Sanity feedback.
sanitymcp_patch_document_from_jsonApply set, unset, or append patch operations to a document using JSON.WritePatch Document From Json
Apply set, unset, or append patch operations to a document using JSON.
Inputs
documentIdstringrequired- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
resourceobjectrequired- Resource information indicating which project ID and dataset to target
appendarray- Append patch operations: adds items to the end of existing array fields.
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- ID of the release to target.
setarray- Set patch operations: replaces field values at the specified document paths.
unsetarray- Unset patch operations: removes fields or array items at the specified paths.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_patch_document_from_markdownPatch a document field with Markdown content converted to Sanity portable text.WritePatch Document From Markdown
Patch a document field with Markdown content converted to Sanity portable text.
Inputs
documentIdstringrequired- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
markdownstringrequired- Markdown content to patch into the document.
pathstringrequired- Document field path to target.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- ID of the release to target.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_patch_documentsUpdate or edit one or more existing documents by applying precise modifications using @sanity/client patch() operations.WritePatch Document(s)
Update or edit one or more existing documents by applying precise modifications using @sanity/client patch() operations. Patches for each document are applied as a single transaction (all succeed or all fail). Edits are saved to the draft or release version; published content is never modified directly.
Inputs
documentsobjectrequired- Map of document IDs to patch operations, up to 25 documents. Accepts published, draft (`drafts.<id>`), and version (`versions.<releaseId>.<id>`) IDs. Published and draft IDs edit the draft; version IDs edit that release version.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- Optional release ID for patching documents in an existing release.
workspaceNamestring- Workspace name as returned by `list_workspace_schemas`. Not a document type. Defaults to "default".default
default
sanitymcp_publish_documentsPublish one or more draft documents to make them publicly visible.WritePublish Documents
Publish one or more draft documents to make them publicly visible.
- Idempotent
Inputs
idsarrayrequired- IDs of the documents to publish
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_transform_imageApply an AI transformation to an image field in a Sanity document.WriteTransform Image
Apply an AI transformation to an image field in a Sanity document.
Inputs
documentIdstringrequired- Sanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
imagePathstringrequired- Path to the image field within the document.
instructionstringrequired- Natural language instruction for the image transformation.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
workspaceNamestring- Sanity workspace name. Defaults to the default workspace.default
default
sanitymcp_update_datasetUpdate the access control mode or description of an existing Sanity dataset.WriteUpdate Dataset
Update the access control mode or description of an existing Sanity dataset.
- Idempotent
Inputs
resourceobjectrequired- Resource information indicating which project ID and dataset to target
aclModestring- Dataset access control mode: public or private.one of
privatepublic descriptionstring- Human-readable description.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_cors_origins_deleteDeletes a CORS origin from a Sanity project.DestructiveDelete CORS Origin
Deletes a CORS origin from a Sanity project.
Inputs
originstringrequired- CORS origin to delete, in format protocol://hostname[:port]. Must be an exact match.
resourceobjectrequired- Resource information indicating which project ID to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_discard_draftsDiscard draft versions of one or more documents.DestructiveDiscard Drafts
Discard draft versions of one or more documents.
- Idempotent
Inputs
idsarrayrequired- Document IDs to discard drafts for
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_run_sanity_cliRun a limited subset of Sanity CLI commands and return their output.DestructiveRun Sanity CLI
Run a limited subset of Sanity CLI commands and return their output. Use `--help` to list available commands or `<command> --help` for command details. Commands run without a shell and cannot access the filesystem, prompt for input, run in the background, or change authentication. Dedicated Sanity MCP tools may provide more structured responses, but equivalent CLI commands are also available.
Inputs
argsstringrequired- Arguments passed to the Sanity CLI after `sanity`, as a single string. Examples: `--help`, `datasets list`.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_unpublish_documentsUnpublish one or more documents to revert them to draft state.DestructiveUnpublish Documents
Unpublish one or more documents to revert them to draft state.
- Idempotent
Inputs
idsarrayrequired- IDs of the documents to unpublish (published document IDs only)
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
releaseIdstring- Optional release ID for scheduling documents to be unpublished when the release runs.
sanitymcp_version_discardDiscard document versions associated with a release.DestructiveVersion Discard
Discard document versions associated with a release.
- Idempotent
Inputs
idsarrayrequired- Document IDs to discard from the release
releaseIdstringrequired- ID of the release to target.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_version_replace_documentReplace a versioned document with the content of a source document.DestructiveVersion Replace Document
Replace a versioned document with the content of a source document.
- Idempotent
Inputs
idstringrequired- Sanity document ID.
releaseIdstringrequired- ID of the release to target.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
sourceDocumentIdstringrequired- ID of the source document to replace from.
typestringrequired- Must be version.replace for this operation.
intentstring- Brief description of what you are trying to accomplish.
sanitymcp_version_unpublish_documentUnpublish a versioned document from a release.DestructiveVersion Unpublish Document
Unpublish a versioned document from a release.
- Idempotent
Inputs
idstringrequired- Sanity document ID.
releaseIdstringrequired- ID of the release to target.
resourceobjectrequired- Resource information indicating which project ID and dataset to target
intentstring- Brief description of what you are trying to accomplish.
No tools match.