👉 Visit the DatoCMS homepage or see What is DatoCMS?
A local Model Context Protocol (MCP) server that provides AI assistants with tools to interact with the DatoCMS Content Management API. Unlike typical MCPs that expose 100+ raw API endpoints, this server uses a layered approach with just 10 carefully designed tools that guide LLMs through discovery, planning, and execution stages.
- Layered tool design: 10 tools instead of 150+ API endpoints. Guides LLMs through discovery → planning → execution stages, reducing malformed calls and improving success rates.
- Script-based approach: Write and execute complete TypeScript scripts that batch multiple operations together. Validated before execution with incremental editing support for faster iteration.
- Documentation-aware: Retrieves detailed method documentation and concrete examples (yes, this consumes tokens, but it's necessary for the LLM to succeed).
- Schema introspection: Access detailed information about your project's content models, fields, and relationships.
- Safe execution environment: Built-in validation and guardrails prevent API misuse and malicious code execution.
- Optional project access: Use with or without API token for documentation vs. execution capabilities.
- Node.js 18 or newer
- VS Code, Cursor, Windsurf, Claude Desktop, Goose or any other MCP client
First, install the DatoCMS MCP server with your client.
Standard config works in most of the tools:
{
"mcpServers": {
"datocms": {
"command": "npx",
"args": [
"-y",
"@datocms/mcp@latest"
],
"env": {
"DATOCMS_API_TOKEN": "your-project-api-token-here"
}
}
}
}Claude Code
Use the Claude Code CLI to add the DatoCMS MCP server:
claude mcp add datocms npx @datocms/mcp@latest -e DATOCMS_API_TOKEN=your-project-api-token-hereChatGPT Codex
Use the ChatGPT Codex CLI to add the DatoCMS MCP server:
codex mcp add --env DATOCMS_API_TOKEN=your-project-api-token-here datocms -- npx @datocms/mcp@latest Claude Desktop
Follow the MCP install guide, use the standard config above.
Cursor
Go to Cursor Settings -> Tools & Integrations -> New MCP Server, then paste the following:
{
"mcpServers": {
"DatoCMS": {
"command": "npx -y @datocms/mcp@latest",
"env": {
"DATOCMS_API_TOKEN": ""
},
"args": []
}
}
}Gemini CLI
Follow the MCP install guide, use the standard config above.
VS Code
Follow the MCP install guide, use the standard config above. You can also install the DatoCMS MCP server using the VS Code CLI:
# For VS Code
code --add-mcp '{"name":"datocms","command":"npx","args":["-y", "@datocms/mcp@latest"], "env": {"DATOCMS_API_TOKEN": ""}}'After installation, the DatoCMS MCP server will be available for use with your GitHub Copilot agent in VS Code.
Windsurf
Follow Windsurf MCP documentation. Use the standard config above.
The DatoCMS MCP server supports the following environment variables:
DATOCMS_API_TOKEN: Your DatoCMS API token for a specific project. When provided, enables full access including schema introspection, API execution, and script execution. Without this token, only API documentation and exploration tools are available, along with the ability to create and validate scripts (but not execute them).DATOCMS_ENVIRONMENT: Specifies which DatoCMS environment the MCP server should interact with. If not set, the server automatically uses the project’s primary environment.EXECUTION_TIMEOUT_SECONDS(optional): Script execution timeout in seconds. Defaults to 60 seconds.MAX_OUTPUT_BYTES(optional): Maximum output size in bytes for all executions. Defaults to 2048 bytes (2 KB).
With API token (full project access):
{
"mcpServers": {
"datocms": {
"command": "npx",
"args": ["-y", "@datocms/mcp@latest"],
"env": {
"DATOCMS_API_TOKEN": ""
}
}
}
}Without API token (documentation only):
{
"mcpServers": {
"datocms": {
"command": "npx",
"args": ["-y", "@datocms/mcp@latest"]
}
}
}Most MCPs take the easy path: wrap every API endpoint in a thin layer and hope the LLM figures it out. This rarely works well. DatoCMS has 40+ resources and 150+ API endpoints — exposing all of them would overwhelm any LLM.
Instead, we use a layered approach inspired by how Block built their MCP tools:
- Discovery layer: Tools to explore what resources, actions, and methods are available
- Planning layer: Tools to understand how to use specific methods (with documentation and examples)
- Execution layer: Tools to actually perform operations (read-only or destructive)
This structure guides the LLM through a workflow that matches how humans would approach an unfamiliar API. It reduces the chance of malformed calls and makes debugging much easier.
Additionally, our script-based approach lets LLMs write complete TypeScript programs instead of making one API call at a time. This:
- Reduces round-trips and token overhead
- Gives the LLM full context to reason about entire operations
- Enables incremental editing when errors occur (fixing specific issues without rewriting everything)
- Allows complex multi-step operations that would fail with individual API calls
The DatoCMS MCP server provides the following tools:
- resources: List all available DatoCMS API resources
- resource: Get details about a specific resource (e.g., items, assets)
- resource_action: Show available actions for a resource
- resource_action_method: Get detailed method documentation with examples
- schema_info: Get detailed information about DatoCMS models and modular blocks, including fields, fieldsets, nested blocks, and relationships
- resource_action_readonly_method_execute: Execute read-only operations (e.g., list, find, raw queries)
- resource_action_destructive_method_execute: Execute write operations (e.g., create, update, destroy)
- create_script: Create and store TypeScript scripts that can interact with the DatoCMS API
- view_script: View the content of a previously created script
- update_script: Update an existing script
- execute_script: Run a script against your DatoCMS project (requires an API token)
This MCP is more reliable than most alternatives, but let's be honest about what to expect:
-
Speed: Complex operations are slow. Generating a landing page can take 5-10 minutes. Simple tasks that would take seconds via direct API calls may take a minute or more through the MCP due to the discovery and planning stages.
-
Token consumption: The documentation-aware approach is expensive. Each operation can burn through thousands of tokens because we retrieve full method documentation and examples. This is necessary for success, but it comes at a cost.
-
Unpredictability: LLMs sometimes take inefficient paths, forget context, or make mistakes even with complete information. Success rates improve significantly when you:
- Provide clear, precise prompts
- Anticipate sources of uncertainty and address them upfront
- Allow the LLM to learn your content model through initial operations
-
Scale limitations: Very large records or particularly complex batch operations may hit timeout or output limits. The server can handle most real-world scenarios, but edge cases exist.
Why release it? Because despite these limitations, it successfully handles complex multi-step operations that break other MCPs. It can generate landing pages, translate content, modify schemas, and perform batch updates — tasks that require genuine understanding of your content model. When it works, it works well. And it works often enough to be genuinely useful.
The DatoCMS MCP server implements multiple layers of security to prevent prompt injection and malicious code execution:
All scripts created through the create_script and update_script tools undergo strict structural validation before being stored or executed:
-
Package Whitelist: Scripts can only import from explicitly allowed packages:
@datocms/*- DatoCMS official packagesdatocms-*- DatoCMS-prefixed packages./schema- Local schema definitions
Any attempt to import from other packages (e.g.,
fs,child_process,net) will be rejected. -
Enforced Function Signature: Scripts must export a default async function with exactly one parameter of type
Client:export default async function(client: Client): Promise<void> { // Script code here }
This ensures scripts can only interact with the DatoCMS API through the provided client, with no access to Node.js system APIs.
-
Type Safety: Scripts cannot use
anyorunknowntypes. This prevents type-unsafe operations and encourages developers to use proper type definitions from the schema. -
AST-Level Validation: The server uses TypeScript's compiler API to parse and validate the script's Abstract Syntax Tree (AST), ensuring structural requirements are met before any code execution.
These validations are performed at script creation/update time, preventing malicious code from ever being stored or executed. For implementation details, see src/lib/scripts/validation.ts.
This MCP is functional but far from perfect. We're releasing it in beta because:
- It solves real problems despite its limitations
- More users means better feedback and faster improvements
- The MCP ecosystem needs more honest, working implementations
We'd love to hear about your experience:
- What works well?
- What breaks or frustrates you?
- What use cases succeed or fail?
- How does it compare to other MCPs you've tried?
Open an issue on GitHub or reach out to us at [email protected].
The package is available as open source under the terms of the MIT License.
DatoCMS is the REST & GraphQL Headless CMS for the modern web.
Trusted by over 25,000 enterprise businesses, agencies, and individuals across the world, DatoCMS users create online content at scale from a central hub and distribute it via API. We ❤️ our developers, content editors and marketers!
Why DatoCMS?
- API-First Architecture: Built for both REST and GraphQL, enabling flexible content delivery
- Just Enough Features: We believe in keeping things simple, and giving you the right feature-set tools to get the job done
- Developer Experience: First-class TypeScript support with powerful developer tools
Getting Started:
- ⚡️ Create Free Account - Get started with DatoCMS in minutes
- 🔖 Documentation - Comprehensive guides and API references
- ⚙️ Community Support - Get help from our team and community
- 🆕 Changelog - Latest features and improvements
Official Libraries:
- Content Delivery Client - TypeScript GraphQL client for content fetching
- REST API Clients - Node.js/Browser clients for content management
- CLI Tools - Command-line utilities for schema migrations (includes Contentful and WordPress importers)
Official Framework Integrations
Helpers to manage SEO, images, video and Structured Text coming from your DatoCMS projects:
Additional Resources:
- Plugin Examples - Example plugins we've made that extend the editor/admin dashboard
- Starter Projects - Example website implementations for popular frameworks
- All Public Repositories