API-first CMS
## DatoCMS MCP Server: Headless CMS with GraphQL The **DatoCMS MCP Server** integrates DatoCMS into Google Antigravity, enabling content management with powerful GraphQL APIs, real-time updates, and built-in image optimization directly from your development environment. ### Why DatoCMS MCP? - **GraphQL Native**: Powerful GraphQL API with automatic schema generation - **Image API**: On-the-fly image transformations and optimization - **Real-Time**: Live content updates via webhooks and subscriptions - **Structured Text**: Rich text editor with embedded blocks and links - **Multi-Environment**: Sandbox environments for safe content testing ### Key Features #### 1. Content Queries ```python # Execute GraphQL query result = await mcp.query(""" query { allBlogPosts( filter: { category: { eq: "technology" } } orderBy: _createdAt_DESC first: 10 ) { id title excerpt author { name } coverImage { url(imgixParams: { w: 800, h: 400 }) } } } """) for post in result["allBlogPosts"]: print(f"Post: {post['title']}") ``` #### 2. Record Management ```python # Create record record = await mcp.create_record( item_type="blog_post", data={ "title": "New Article", "slug": "new-article", "content": {"type": "doc", "children": [...]}, "author": "author_123" } ) # Update record await mcp.update_record( record_id="record_123", data={"title": "Updated Title"} ) # Publish record await mcp.publish_record(record_id="record_123") ``` #### 3. Asset Operations ```python # Upload asset asset = await mcp.upload_asset( file_path="./images/hero.jpg", default_field_metadata={ "en": {"title": "Hero Image", "alt": "Homepage banner"} } ) # Get optimized image URL url = await mcp.get_image_url( asset_id="asset_123", params={"w": 800, "h": 400, "fit": "crop", "auto": "format"} ) ``` #### 4. Model Management ```python # List models models = await mcp.list_item_types() for model in models: print(f"Model: {model['name']} ({model['api_key']})") # Get model fields fields = await mcp.get_fields(item_type_id="model_123") for field in fields: print(f"Field: {field['label']} - {field['field_type']}") ``` ### Configuration ```json { "mcpServers": { "datocms": { "command": "npx", "args": ["-y", "@anthropic/mcp-datocms"], "env": { "DATOCMS_API_TOKEN": "your-api-token", "DATOCMS_ENVIRONMENT": "main", "DATOCMS_PREVIEW": "false" } } } } ``` ### Use Cases **JAMstack Sites**: Power static site generators with structured content and optimized images. **Real-Time Apps**: Build applications with live content updates using subscriptions. **Multi-Language Sites**: Manage localized content with built-in translation workflows. **Headless Commerce**: Complement commerce platforms with rich product content and media. The DatoCMS MCP enables GraphQL-powered content management within your development environment.
{
"mcpServers": {
"datocms": {
"mcpServers": {
"datocms": {
"env": {
"DATOCMS_API_TOKEN": "your-api-token"
},
"args": [
"-y",
"datocms-mcp-server"
],
"command": "npx"
}
}
}
}
}