Sanity MCP connector
OAuth 2.1/DCRDeveloper ToolsFiles & DocumentsProductivityConnect to Sanity. Manage structured content, documents, datasets, schemas, releases, and media assets for headless CMS workflows.
Sanity MCP connector
-
Install the SDK
Section titled “Install the SDK”Terminal window npm install @scalekit-sdk/nodeTerminal window pip install scalekit -
Set your credentials
Section titled “Set 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> -
Authorize and make your first call
Section titled “Authorize and make your first call”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.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)process.stdout.write('Press Enter after authorizing...')await new Promise(r => process.stdin.once('data', r))// Make your first callconst result = await actions.executeTool({connector,identifier,toolName: 'sanitymcp_list_organizations',toolInput: {},})console.log(result)quickstart.py import osfrom scalekit.client import ScalekitClientfrom dotenv import load_dotenvload_dotenv()scalekit_client = ScalekitClient(env_url=os.getenv("SCALEKIT_ENV_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_list_organizations",connection_name=connection_name,identifier=identifier,)print(result)
What you can do
Section titled “What you can do”Connect this agent connector to let your agent:
- Whoami records — Get the currently authenticated Sanity user profile
- Document version unpublish, version replace — Unpublish a versioned document from a release
- Discard version — Discard document versions associated with a release
- Update dataset — Update the access control mode or description of an existing Sanity dataset
- Documents unpublish, publish — Unpublish one or more documents to revert them to draft state
- Image transform, generate — Apply an AI transformation to an image field in a Sanity document
Tool list
Section titled “Tool list”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.
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.
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_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.
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_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.
documentsarrayrequiredArray of documents to create. Each document must have a type and content.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
documentsarrayrequiredArray of documents to create. Each document must have a type and Markdown content.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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.6 params
Create a new content release for scheduling or grouping document publications.
resourceobjectrequiredResource information indicating which project ID and dataset to targettitlestringrequiredTitle 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.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.
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 targetintentstringoptionalBrief 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.
resourceobjectrequiredResource information indicating which project ID and dataset to targetschemaDeclarationstringrequiredSanity 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.
appHoststringrequiredSubdomain hostname for the deployed Sanity Studio.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief description of what you are trying to accomplish.titlestringoptionalTitle of the release.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.
idsarrayrequiredDocument IDs to discard drafts forresourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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 targetintentstringoptionalBrief 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.
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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.
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.4 params
Retrieve the schema for a specific document type in a workspace.
resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief description of what you are trying to accomplish.typestringoptionalDocument schema type name.workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.sanitymcp_list_datasets#List all datasets in a Sanity project.2 params
List all datasets in a Sanity project.
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.
resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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.
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.
resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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.
resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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.
documentIdstringrequiredSanity document ID (e.g. drafts.abc123 for drafts, or bare ID for published).resourceobjectrequiredResource information indicating which project ID and dataset to targetappendarrayoptionalAppend 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.
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 targetintentstringoptionalBrief description of what you are trying to accomplish.releaseIdstringoptionalID of the release to target.workspaceNamestringoptionalSanity workspace name. Defaults to the default workspace.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.
idsarrayrequiredIDs of the documents to publishresourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
querystringrequiredGROQ query string to execute.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief description of what you are trying to accomplish.limitintegeroptionalMaximum number of items to return.paramsobjectoptionalOptional parameters for the GROQ queryperspectivestringoptionalQuery 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.
intentstringoptionalBrief description of what you are trying to accomplish.pathstringoptionalDocument field path to target.urlstringoptionalURL of the Sanity documentation page to read.sanitymcp_search_docs#Search Sanity documentation by keyword query.3 params
Search Sanity documentation by keyword query.
querystringrequiredGROQ query string to execute.intentstringoptionalBrief description of what you are trying to accomplish.limitintegeroptionalMaximum number of items to return.sanitymcp_semantic_search#Perform a semantic similarity search against a Sanity embeddings index.5 params
Perform a semantic similarity search against a Sanity embeddings index.
indexNamestringrequiredName of the embeddings index to search.querystringrequiredGROQ query string to execute.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
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 targetintentstringoptionalBrief 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.3 params
Unpublish one or more documents to revert them to draft state.
idsarrayrequiredIDs of the documents to unpublish (published document IDs only)resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief description of what you are trying to accomplish.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.
resourceobjectrequiredResource information indicating which project ID and dataset to targetaclModestringoptionalDataset 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.
idsarrayrequiredDocument IDs to discard from the releasereleaseIdstringrequiredID of the release to target.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
idstringrequiredSanity document ID.releaseIdstringrequiredID of the release to target.resourceobjectrequiredResource information indicating which project ID and dataset to targetsourceDocumentIdstringrequiredID 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.
idstringrequiredSanity document ID.releaseIdstringrequiredID of the release to target.resourceobjectrequiredResource information indicating which project ID and dataset to targetintentstringoptionalBrief 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.
intentstringoptionalBrief description of what you are trying to accomplish.