Skip to content
Scalekit Docs

Sanity MCP

Vendor MCP45 toolsOAuth 2.1/DCRDeveloper ToolsFiles & DocumentsProductivity

Connect to Sanity. Manage structured content, documents, datasets, schemas, releases, and media assets for headless CMS workflows.

Sanity MCP connector

  1. Terminal window
    npm install @scalekit-sdk/node

    Full SDK reference: Node.js | Python

  2. Add your Scalekit credentials to your .env file. 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>
  3. quickstart.ts
    import { ScalekitClient } from '@scalekit-sdk/node'
    import 'dotenv/config'
    const scalekit = new ScalekitClient(
    process.env.SCALEKIT_ENV_URL,
    process.env.SCALEKIT_CLIENT_ID,
    process.env.SCALEKIT_CLIENT_SECRET,
    )
    const actions = scalekit.actions
    const connector = 'sanitymcp'
    const identifier = 'user_123'
    // Generate an authorization link for the user
    const { link } = await actions.getAuthorizationLink({ connectionName: connector, identifier })
    console.log('Authorize Sanity MCP:', link)
    process.stdout.write('Press Enter after authorizing...')
    await new Promise(r => process.stdin.once('data', r))
    // Make your first call
    const result = await actions.executeTool({
    connector,
    identifier,
    toolName: 'sanitymcp_list_organizations',
    toolInput: {},
    })
    console.log(result)

Connect this agent connector to let your agent:

  • Run sanity cli — Run a limited subset of Sanity CLI commands and return their output
  • Documents patch, unpublish, publish — Update or edit one or more existing documents by applying precise modifications using @sanity/client patch() operations
  • Feedback give sanity — Submit feedback about Sanity when you encounter issues while working with a Sanity codebase or project
  • Upload dataset assets — Provide local Sanity CLI guidance for uploading an image or file asset to a Content Lake dataset
  • Create documents, version, release — Create one or more draft documents by directly providing structured content
  • List cors origins, workspace schemas, sanity rules — Lists all CORS origins configured for a Sanity project

Use the exact tool names from the Tool list below when you call execute_tool. If you’re not sure which name to use, list the tools available for the current user first.

sanitymcp__get_ui_context#Get the current UI context including the active document and workspace in Sanity Studio.5 params

Get the current UI context including the active document and workspace in Sanity Studio.

NameTypeRequiredDescription
resourceobjectrequiredNo description.
documentIdstringoptionalSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
documentTypestringoptionalSchema type name of the document.
maxRefDepthintegeroptionalMaximum reference depth to follow when resolving document references.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_add_cors_origin#Add a CORS origin to allow browser-based API access for a Sanity project.4 params

Add a CORS origin to allow browser-based API access for a Sanity project.

NameTypeRequiredDescription
originstringrequiredCORS origin URL to allow (e.g. https://myapp.com).
resourceobjectrequiredNo description.
allowCredentialsbooleanoptionalWhether to allow credentials (cookies) from this CORS origin.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_cors_origins_delete#Deletes a CORS origin from a Sanity project.3 params

Deletes a CORS origin from a Sanity project.

NameTypeRequiredDescription
originstringrequiredCORS origin to delete, in format protocol://hostname[:port]. Must be an exact match.
resourceobjectrequiredResource information indicating which project ID to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_cors_origins_list#Lists all CORS origins configured for a Sanity project.2 params

Lists all CORS origins configured for a Sanity project.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_create_dataset#Create a new dataset in a Sanity project with the specified access control mode.5 params

Create a new dataset in a Sanity project with the specified access control mode.

NameTypeRequiredDescription
datasetNamestringrequiredName of the Sanity dataset.
resourceobjectrequiredNo description.
aclModestringoptionalDataset access control mode: public or private.
descriptionstringoptionalHuman-readable description.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_create_documents#Create one or more draft documents by directly providing structured content. Creates drafts (drafts.* prefix) unless releaseId is specified for version creation.5 params

Create one or more draft documents by directly providing structured content. Creates drafts (drafts.* prefix) unless releaseId is specified for version creation.

NameTypeRequiredDescription
documentsarrayrequiredArray 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.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalOptional release ID for creating versioned documents. If provided, documents will be created under the specified release version instead of as drafts.
workspaceNamestringoptionalWorkspace name as returned by `list_workspace_schemas`. Not a document type. Defaults to "default".
sanitymcp_create_documents_from_json#Create one or more Sanity documents from a JSON array of document objects.5 params

Create one or more Sanity documents from a JSON array of document objects.

NameTypeRequiredDescription
documentsarrayrequiredArray of documents to create. Each document must have a type and content.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalID of the release to target.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_create_documents_from_markdown#Create one or more Sanity documents from Markdown content.5 params

Create one or more Sanity documents from Markdown content.

NameTypeRequiredDescription
documentsarrayrequiredArray of documents to create. Each document must have a type and Markdown content.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalID of the release to target.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_create_project#Create a new Sanity project with optional CORS origin and organization.5 params

Create a new Sanity project with optional CORS origin and organization.

NameTypeRequiredDescription
displayNamestringrequiredDisplay name for the Sanity project.
organizationIdstringrequiredSanity organization ID to create the project under.
allowCredentialsbooleanoptionalWhether to allow credentials (cookies) from this CORS origin.
corsOriginstringoptionalCORS origin URL for the new project.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_create_release#Create a new content release for scheduling or grouping document publications.7 params

Create a new content release for scheduling or grouping document publications.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
titlestringrequiredTitle of the release.
descriptionstringoptionalHuman-readable description.
intendedPublishAtstringoptionalISO 8601 datetime when the release is scheduled to publish.
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalOptional release ID, if omitted one is generated.
releaseTypestringoptionalType of release: scheduled, immediate, or undecided.
sanitymcp_create_version#Create versioned copies of documents and associate them with a release.4 params

Create versioned copies of documents and associate them with a release.

NameTypeRequiredDescription
documentIdsarrayrequiredArray of document IDs to create versions for (min 1, max 10)
releaseIdstringrequiredID of the release to target.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_dataset_assets_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.1 param

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.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_deploy_schema#Deploy a schema declaration to a Sanity project workspace.4 params

Deploy a schema declaration to a Sanity project workspace.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
schemaDeclarationstringrequiredSanity schema configuration declaration string.
intentstringoptionalBrief description of what you are trying to accomplish.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_deploy_studio#Deploy a Sanity Studio to a hosted app subdomain.5 params

Deploy a Sanity Studio to a hosted app subdomain.

NameTypeRequiredDescription
appHoststringrequiredSubdomain hostname for the deployed Sanity Studio.
resourceobjectrequiredResource information indicating which project ID and dataset to target
titlestringrequiredHuman-facing title shown in Studio navigation.
intentstringoptionalBrief description of what you are trying to accomplish.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_discard_drafts#Discard draft versions of one or more documents.3 params

Discard draft versions of one or more documents.

NameTypeRequiredDescription
idsarrayrequiredDocument IDs to discard drafts for
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_generate_image#Generate an image for a document field using an AI instruction.6 params

Generate an image for a document field using an AI instruction.

NameTypeRequiredDescription
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
imagePathstringrequiredPath to the image field within the document.
instructionstringrequiredNatural language instruction for the image transformation.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_get_document#Retrieve a single Sanity document by its ID.3 params

Retrieve a single Sanity document by its ID.

NameTypeRequiredDescription
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_get_project_studios#List all Sanity Studios deployed for a project.2 params

List all Sanity Studios deployed for a project.

NameTypeRequiredDescription
resourceobjectrequiredNo description.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_get_sanity_rules#Load one or more Sanity content rules by name.2 params

Load one or more Sanity content rules by name.

NameTypeRequiredDescription
rulesarrayrequiredOne or more rule names to load. Use list_sanity_rules to see available rules.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_get_schema#Retrieve the schema for a specific document type in a workspace.5 params

Retrieve the schema for a specific document type in a workspace.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
schemaIdstringoptionalOptional exact schema ID returned by list_workspace_schemas. Use this to inspect a specific source when multiple deployments share a workspace name.
typestringoptionalDocument schema type name.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_give_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.6 params

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.

NameTypeRequiredDescription
messagestringrequiredDescribe 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.
categorystringoptionalCategory of feedback to help with triage.
intentstringoptionalBrief description of what you are trying to accomplish.
projectIdstringoptionalThe Sanity project ID this feedback relates to, if any. Leave unset for general feedback not tied to a specific project.
severitystringoptionalHow much this blocked progress. high = completely blocked, medium = workaround needed, low = minor.
toolNamestringoptionalThe MCP tool this feedback is about, if any (e.g. "query_documents"). Leave unset for general Sanity feedback.
sanitymcp_list_datasets#List all datasets in a Sanity project.2 params

List all datasets in a Sanity project.

NameTypeRequiredDescription
resourceobjectrequiredNo description.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_list_embeddings_indices#List all embeddings indices available in a Sanity project.2 params

List all embeddings indices available in a Sanity project.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_list_organizations#List all Sanity organizations the authenticated user belongs to.1 param

List all Sanity organizations the authenticated user belongs to.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_list_projects#List all Sanity projects the authenticated user has access to.1 param

List all Sanity projects the authenticated user has access to.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_list_releases#List content releases for a project with optional state filtering and pagination.5 params

List content releases for a project with optional state filtering and pagination.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
limitintegeroptionalMaximum number of items to return.
offsetintegeroptionalNumber of items to skip for pagination.
statestringoptionalFilter releases by state: active, archived, or published.
sanitymcp_list_sanity_rules#List all available Sanity content rule names.1 param

List all available Sanity content rule names.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_list_workspace_schemas#List all schema types defined in a Sanity workspace.2 params

List all schema types defined in a Sanity workspace.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_migration_guide#Retrieve a Sanity migration guide by name.2 params

Retrieve a Sanity migration guide by name.

NameTypeRequiredDescription
guidestringrequiredName of the migration guide to retrieve.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_patch_document_from_json#Apply set, unset, or append patch operations to a document using JSON.8 params

Apply set, unset, or append patch operations to a document using JSON.

NameTypeRequiredDescription
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
resourceobjectrequiredResource information indicating which project ID and dataset to target
appendarrayoptionalAppend patch operations: adds items to the end of existing array fields.
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalID of the release to target.
setarrayoptionalSet patch operations: replaces field values at the specified document paths.
unsetarrayoptionalUnset patch operations: removes fields or array items at the specified paths.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_patch_document_from_markdown#Patch a document field with Markdown content converted to Sanity portable text.7 params

Patch a document field with Markdown content converted to Sanity portable text.

NameTypeRequiredDescription
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
markdownstringrequiredMarkdown content to patch into the document.
pathstringrequiredDocument field path to target.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalID of the release to target.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_patch_documents#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.5 params

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.

NameTypeRequiredDescription
documentsobjectrequiredMap 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.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalOptional release ID for patching documents in an existing release.
workspaceNamestringoptionalWorkspace name as returned by `list_workspace_schemas`. Not a document type. Defaults to "default".
sanitymcp_publish_documents#Publish one or more draft documents to make them publicly visible.3 params

Publish one or more draft documents to make them publicly visible.

NameTypeRequiredDescription
idsarrayrequiredIDs of the documents to publish
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_query_documents#Execute a GROQ query against the Sanity dataset and return matching documents.7 params

Execute a GROQ query against the Sanity dataset and return matching documents.

NameTypeRequiredDescription
querystringrequiredGROQ query string to execute.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
limitintegeroptionalMaximum number of items to return.
paramsobjectoptionalOptional parameters for the GROQ query
perspectivestringoptionalQuery perspective: published, previewDrafts, or raw.
singlebooleanoptionalReturn a single result instead of an array.
sanitymcp_read_docs#Read a Sanity documentation page by URL or path.3 params

Read a Sanity documentation page by URL or path.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.
pathstringoptionalDocument field path to target.
urlstringoptionalURL of the Sanity documentation page to read.
sanitymcp_run_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.2 params

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.

NameTypeRequiredDescription
argsstringrequiredArguments passed to the Sanity CLI after `sanity`, as a single string. Examples: `--help`, `datasets list`.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_search_docs#Search Sanity documentation by keyword query.3 params

Search Sanity documentation by keyword query.

NameTypeRequiredDescription
querystringrequiredGROQ query string to execute.
intentstringoptionalBrief description of what you are trying to accomplish.
limitintegeroptionalMaximum number of items to return.
sanitymcp_transform_image#Apply an AI transformation to an image field in a Sanity document.6 params

Apply an AI transformation to an image field in a Sanity document.

NameTypeRequiredDescription
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).
imagePathstringrequiredPath to the image field within the document.
instructionstringrequiredNatural language instruction for the image transformation.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.
sanitymcp_unpublish_documents#Unpublish one or more documents to revert them to draft state.4 params

Unpublish one or more documents to revert them to draft state.

NameTypeRequiredDescription
idsarrayrequiredIDs of the documents to unpublish (published document IDs only)
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
releaseIdstringoptionalOptional release ID for scheduling documents to be unpublished when the release runs.
sanitymcp_update_dataset#Update the access control mode or description of an existing Sanity dataset.4 params

Update the access control mode or description of an existing Sanity dataset.

NameTypeRequiredDescription
resourceobjectrequiredResource information indicating which project ID and dataset to target
aclModestringoptionalDataset access control mode: public or private.
descriptionstringoptionalHuman-readable description.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_version_discard#Discard document versions associated with a release.4 params

Discard document versions associated with a release.

NameTypeRequiredDescription
idsarrayrequiredDocument IDs to discard from the release
releaseIdstringrequiredID of the release to target.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_version_replace_document#Replace a versioned document with the content of a source document.6 params

Replace a versioned document with the content of a source document.

NameTypeRequiredDescription
idstringrequiredSanity document ID.
releaseIdstringrequiredID of the release to target.
resourceobjectrequiredResource information indicating which project ID and dataset to target
sourceDocumentIdstringrequiredID of the source document to replace from.
typestringrequiredMust be version.replace for this operation.
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_version_unpublish_document#Unpublish a versioned document from a release.4 params

Unpublish a versioned document from a release.

NameTypeRequiredDescription
idstringrequiredSanity document ID.
releaseIdstringrequiredID of the release to target.
resourceobjectrequiredResource information indicating which project ID and dataset to target
intentstringoptionalBrief description of what you are trying to accomplish.
sanitymcp_whoami#Get the currently authenticated Sanity user profile.1 param

Get the currently authenticated Sanity user profile.

NameTypeRequiredDescription
intentstringoptionalBrief description of what you are trying to accomplish.