Contentful Agent Integration
Overview
Contentful is a modern headless content management system (CMS) that provides flexible content infrastructure for digital products. The AnswerAgentAI integration with Contentful enables you to seamlessly incorporate your CMS content into AI-powered workflows, allowing you to build intelligent applications that leverage your existing content infrastructure.
With this integration, you can:
- Load content from your Contentful spaces into AI workflows using the Document Loader
- Manage content programmatically through the MCP (Model Context Protocol) server
- Query and search across your content using natural language
- Create and update entries, assets, and content types through AI agents
- Publish and unpublish content as part of automated workflows
- Leverage rich content models including references, assets, and localization
Contentful's API-first architecture makes it ideal for AI integrations, providing structured, queryable content that can power everything from chatbots and virtual assistants to content generation and automated publishing workflows.
Quick Start
Obtaining Credentials
Contentful provides two different API credentials depending on your use case:
Contentful Delivery API (Read-Only Access)
Use this for loading and querying content in published or preview states.
Required Credentials:
- Delivery Token: For accessing published content
- Preview Token: For accessing draft/unpublished content
- Space ID: Your Contentful space identifier
How to obtain:
-
Access API Keys Settings:
- Log in to your Contentful account at https://app.contentful.com/
- Navigate to Settings � API keys
-
Create or Select API Key:
- Click Add API key to create a new key, or select an existing key
- Give it a descriptive name (e.g., "AnswerAgentAI Integration")
-
Copy Credentials:
- Space ID: Found at the top of the API key page or in your space URL:
https://app.contentful.com/spaces/{SPACE_ID}/... - Content Delivery API - access token: This is your Delivery Token
- Content Preview API - access token: This is your Preview Token
- Space ID: Found at the top of the API key page or in your space URL:
- Use Delivery Token to access only published content (production use cases)
- Use Preview Token to access draft and unpublished content (testing, staging environments)
Documentation Reference: Contentful Delivery API
Contentful Management API (Full Access)
Use this for creating, updating, deleting, and managing content, assets, and content types.
Required Credentials:
- Management Token: Personal access token with write permissions
- Space ID: Your Contentful space identifier
How to obtain:
-
Access Personal Access Tokens:
- Log in to your Contentful account
- Go to Settings � API Keys � Content management tokens
-
Create Personal Access Token:
- Click Generate personal token
- Give it a descriptive name (e.g., "AnswerAgentAI Management")
- Important: Copy the token immediately - it will only be shown once!
-
Get Space ID:
- Found in your space URL:
https://app.contentful.com/spaces/{SPACE_ID}/... - Or in Settings � General Settings
- Found in your space URL:
The Management Token has full access to create, modify, and delete content. Consider:
- Creating a dedicated token for AnswerAgentAI
- Using environment-specific tokens
- Regularly rotating tokens for security
- Never committing tokens to version control
Documentation Reference: Contentful Management API
Environment ID (Optional)
Both APIs support multiple environments within a space:
- Default:
master(used if not specified) - Custom: Create environments in Settings � Environments for staging, development, etc.
Available Components
This section is automatically generated from component metadata in scripts/integration-mapping.json.
Last updated: December 3, 2025
This integration provides components across multiple categories:
Document Loaders
Load structured content from your Contentful space into your AI workflows.
Contentful Document Loader (v1.1)
Description: Load data from a Contentful Space with advanced filtering, content type configuration, and citation support.
Key Features:
- Choose between Delivery API (published) or Preview API (draft content)
- Configure which content types and fields to load
- Support for rich text parsing and embedded content
- Pagination support for large content sets
- Automatic citation generation with custom URL prefixes
- Include levels for nested references
Configuration Options:
- API Type: Delivery or Preview
- Content Type Config: JSON configuration for content types and fields
- Search Query: Filter content by fields, content type, or custom queries
- Environment ID: Target specific environment (default: 'master')
- Include Levels: Depth of reference resolution (default: 1)
- Limit: Maximum entries per request
- Include Field Names: Include field names in output for better context
Use Cases:
- Building knowledge bases from CMS content
- Creating chatbots with product/documentation content
- Generating embeddings from blog posts or articles
- Syncing content to vector stores for semantic search
Learn More: Contentful Document Loader Documentation
MCP Servers
Interact with Contentful's Management API through natural language using the Model Context Protocol.
Contentful MCP Server (v1)
Description: MCP Server for the Contentful API enabling full content management capabilities through AI agents.
Available Tools:
Entry Management:
search_entries- Search for entries using query parameterscreate_entry- Create new content entriesget_entry- Retrieve specific entry detailsupdate_entry- Update existing entriesdelete_entry- Delete entriespublish_entry- Publish entries to make them liveunpublish_entry- Unpublish entries
Asset Management:
list_assets- List assets with paginationupload_asset- Upload new media filesget_asset- Retrieve asset detailsupdate_asset- Update asset metadatadelete_asset- Delete assetspublish_asset- Publish assetsunpublish_asset- Unpublish assets
Content Type Management:
list_content_types- List all content typesget_content_type- Get content type schemacreate_content_type- Create new content typesupdate_content_type- Modify content type definitionsdelete_content_type- Remove content typespublish_content_type- Activate content type changesget_editor_interface- Get editor UI configurationupdate_editor_interface- Customize editor interface
Space & Environment Management:
list_spaces- List available spacesget_space- Get space detailslist_environments- List environments in spacecreate_environment- Create new environmentsdelete_environment- Remove environments
Use Cases:
- Automated content creation from AI-generated text
- Batch content updates and translations
- Content workflow automation
- Asset management and organization
- Dynamic content model evolution
Learn More: Contentful MCP Documentation
Use Cases
Common Scenarios
1. AI-Powered Customer Support
Load your documentation, help articles, and FAQs from Contentful to power an intelligent customer support chatbot.
Workflow:
- Use Contentful Document Loader to import help articles
- Split text and generate embeddings
- Store in a vector database
- Query with customer questions for relevant answers
- Use citations to link back to original Contentful entries
Benefits:
- Always up-to-date with CMS content
- Automatic URL generation for "learn more" links
- Support for rich text and multimedia content
2. Content Creation Pipeline
Automate content creation and publishing using AI-generated text with human oversight.
Workflow:
- Use AI agent to generate article content
- Create draft entry via Contentful MCP
create_entry - Upload associated images using
upload_asset - Link assets to entry with
update_entry - Notify editors for review
- Publish approved content with
publish_entry
Benefits:
- Streamlined content workflow
- Maintains editorial control
- Leverages existing Contentful UI for review
3. Multi-Channel Content Syndication
Query and adapt content from Contentful for different channels and formats.
Workflow:
- Search for blog posts using
search_entries - Retrieve full content with
get_entry - Use AI to adapt content for Twitter, LinkedIn, etc.
- Track which entries have been syndicated using custom fields
Benefits:
- Single source of truth in Contentful
- Automated multi-channel distribution
- Consistent brand voice across channels
4. Intelligent Content Recommendations
Build a recommendation engine based on semantic similarity of your content.
Workflow:
- Load all blog posts/products via Document Loader
- Generate embeddings for each entry
- When user views content, find similar entries by vector search
- Display "Related Content" powered by AI understanding
Benefits:
- Goes beyond simple keyword matching
- Understands content relationships semantically
- Improves user engagement
5. Automated Content Localization
Translate and localize content across multiple markets.
Workflow:
- Detect entries with missing locale fields using
search_entries - Retrieve source content with
get_entry - Use AI to translate to target languages
- Update entry with localized fields via
update_entry - Maintain reference to source locale for audit
Benefits:
- Scale content across markets faster
- Maintain consistency in translation
- Reduce manual localization effort
Example Workflows
Example 1: Loading Blog Posts for RAG
Goal: Create a Q&A chatbot that answers questions about your blog content.
Chatflow Configuration:
1. Contentful Document Loader
- Credential: Contentful Delivery API
- Config Utility:
{
"mainContentType": {
"contentType": "blogPost",
"fieldsToParse": ["title", "body", "author", "tags"]
},
"fieldsForCitation": {
"titleField": "fields.title",
"slugField": "fields.slug",
"urlPrefix": "https://myblog.com/posts/"
}
}
- Search Query: {"content_type": "blogPost", "order": "-sys.createdAt"}
- Limit: 100
2. Recursive Character Text Splitter
- Chunk Size: 1000
- Chunk Overlap: 200
3. OpenAI Embeddings
- Model: text-embedding-3-small
4. Pinecone Vector Store
- Store documents with embeddings
5. Conversational Retrieval QA Chain
- Retriever: Pinecone
- LLM: GPT-4
- Return Source Documents: true
Result: Users can ask questions about blog topics, and the chatbot responds with accurate answers including source links back to Contentful content.
Example 2: Automated Product Updates
Goal: Update product descriptions using AI while maintaining data in Contentful.
Chatflow Configuration:
1. Conversational Agent (OpenAI Functions)
- LLM: GPT-4
- Tools: Contentful MCP
2. System Prompt:
"You are a product content manager. When asked to update a product:
1. Search for the product by name using search_entries
2. Get the current product details with get_entry
3. Generate an improved description based on features
4. Update the entry with the new description using update_entry
5. Ask if the user wants to publish the changes"
3. Memory: Buffer Memory (to track conversation)
Example Interaction:
User: "Update the description for our Premium Headphones to be more engaging"
Agent:
1. Searches entries: {"content_type": "product", "fields.name": "Premium Headphones"}
2. Gets current entry and analyzes existing description
3. Generates improved copy highlighting features
4. Updates entry in Contentful
5. Responds: "I've updated the description for Premium Headphones. The new version
emphasizes the noise cancellation and 30-hour battery life. Would you like me
to publish it now?"
User: "Yes, publish it"
Agent:
1. Publishes entry using publish_entry
2. Responds: "Done! The updated Premium Headphones description is now live."
Example 3: Content Audit and SEO Optimization
Goal: Analyze content for SEO issues and fix them automatically.
Chatflow Configuration:
1. Conversational Agent
- LLM: GPT-4-Turbo
- Tools: [Contentful MCP, Custom SEO Analysis Tool]
2. Workflow:
- List all published blog posts using search_entries
- For each post:
* Check meta description length
* Analyze keyword density
* Verify heading structure
* Check for missing alt text on images
- Generate recommendations
- Apply fixes with user approval using update_entry
Benefits:
- Automated SEO audits
- Batch content improvements
- Maintains content in Contentful CMS
Advanced Configuration
Document Loader Configuration
Content Type Configuration
The Config Utility parameter accepts a JSON object that defines how content should be extracted:
{
"mainContentType": {
"contentType": "blogPost",
"fieldsToParse": ["title", "body", "author", "publishDate"]
},
"embeddedContentTypes": [
{
"contentType": "author",
"fieldsToParse": ["name", "bio", "avatar"]
},
{
"contentType": "category",
"fieldsToParse": ["name", "description"]
}
],
"richTextParsingRules": {
"embedded-asset-block": true,
"embedded-entry-block": true,
"embedded-entry-inline": true,
"hyperlink": true
},
"fieldsForCitation": {
"titleField": "fields.title",
"slugField": "fields.slug",
"urlPrefix": "https://mywebsite.com/blog/"
}
}
Configuration Options:
-
mainContentType: The primary content type to load
contentType: Content type IDfieldsToParse: Array of field IDs to include
-
embeddedContentTypes: Related content types (referenced entries)
- Automatically resolved when referenced in main content
- Specify which fields to include from each type
-
richTextParsingRules: How to handle rich text fields
embedded-asset-block: Include embedded images/filesembedded-entry-block: Include embedded entry cardsembedded-entry-inline: Include inline entry referenceshyperlink: Preserve hyperlinks
-
fieldsForCitation: Generate source URLs
titleField: Path to title (for citation display)slugField: Path to slug (for URL generation)urlPrefix: Base URL to prepend to slug
Search Query Configuration
Filter which entries are loaded using Contentful's query syntax:
{
"content_type": "blogPost",
"fields.category.sys.id": "technology",
"fields.published": true,
"order": "-sys.createdAt",
"limit": 50
}
Common Query Parameters:
content_type: Filter by content type IDfields.{fieldName}: Filter by field valuesys.id: Filter by entry IDorder: Sort order (prefix with-for descending)limit: Maximum entries (default: 100)skip: Pagination offsetlocale: Specify locale (e.g., "en-US")
Query Operators:
fields.{field}[ne]: Not equalfields.{field}[in]: In arrayfields.{field}[nin]: Not in arrayfields.{field}[lt]: Less thanfields.{field}[lte]: Less than or equalfields.{field}[gt]: Greater thanfields.{field}[gte]: Greater than or equalfields.{field}[match]: Full-text search
Examples:
// Get recent tech blog posts
{
"content_type": "blogPost",
"fields.category": "technology",
"order": "-fields.publishDate",
"limit": 20
}
// Get products in price range
{
"content_type": "product",
"fields.price[gte]": 100,
"fields.price[lte]": 500,
"fields.inStock": true
}
// Full-text search
{
"content_type": "article",
"query": "artificial intelligence",
"order": "-sys.createdAt"
}
MCP Server Configuration
Environment Variables
For production deployments, configure credentials via environment variables:
CONTENTFUL_MANAGEMENT_ACCESS_TOKEN=your_management_token
CONTENTFUL_SPACE_ID=your_space_id
CONTENTFUL_ENVIRONMENT_ID=master # or custom environment
Pagination Best Practices
MCP tools limit results to prevent overwhelming responses:
search_entries: Max 3 results per calllist_assets: Max 3 results per calllist_content_types: Max 10 results per call
Use pagination for larger datasets:
// Get next page of results
{
"spaceId": "your_space_id",
"query": {
"content_type": "blogPost",
"limit": 3,
"skip": 3 // Skip first 3 for page 2
}
}
Multi-Locale Support
When working with localized content:
// Create entry with multiple locales
{
"contentTypeId": "blogPost",
"fields": {
"title": {
"en-US": "My English Title",
"es-ES": "Mi T�tulo en Espa�ol"
},
"body": {
"en-US": "English content...",
"es-ES": "Contenido en espa�ol..."
}
}
}
Frequently Asked Questions
Setup & Configuration
Q: What's the difference between Delivery API and Management API?
A:
- Delivery API is read-only and used to fetch published content (or preview draft content). Use this for loading data into AI workflows, vector stores, or displaying content.
- Management API has full read/write access for creating, updating, deleting, and publishing content. Use this for content automation, batch operations, and workflow integrations.
Q: Do I need both Delivery and Management API credentials?
A: It depends on your use case:
- Only reading content: Just Delivery API credentials (for Document Loader)
- Managing content: Just Management API credentials (for MCP Server)
- Both reading and managing: Both credential sets
Q: Can I use the same Space ID for multiple environments?
A: Yes! A Space ID identifies your Contentful space, which can contain multiple environments (master, staging, development, etc.). Specify the environment ID in your configuration to target different environments within the same space.
Q: What happens if I don't specify an Environment ID?
A: The integration defaults to master, which is Contentful's default environment. If you've created custom environments (e.g., "staging"), you must explicitly specify the environment ID.
Q: How do I handle Contentful rate limits?
A: Contentful has different rate limits based on your plan:
- Free tier: 78 requests per second
- Paid tiers: Higher limits
For bulk operations:
- Use pagination with reasonable limits
- Implement delays between batch operations
- Cache frequently accessed content
- Consider using webhooks for real-time updates instead of polling
Usage & Best Practices
Q: How do I load only specific fields from a content type?
A: Use the Config Utility in the Document Loader:
{
"mainContentType": {
"contentType": "yourContentType",
"fieldsToParse": ["field1", "field2", "field3"]
}
}
Only specified fields will be included in the loaded documents.
Q: Can I load content from multiple content types?
A: Yes, in two ways:
- Sequential loading: Create multiple Document Loader nodes, one per content type
- Referenced content: Configure
embeddedContentTypesto include related content types that are referenced by your main content type
Q: How do I handle rich text fields with embedded assets?
A: Configure richTextParsingRules in your Config Utility:
{
"richTextParsingRules": {
"embedded-asset-block": true,
"embedded-entry-block": true
}
}
This will resolve embedded assets and entries, including their content in the output.
Q: How can I generate clickable links back to my Contentful content?
A: Use fieldsForCitation in your Config Utility:
{
"fieldsForCitation": {
"titleField": "fields.title",
"slugField": "fields.slug",
"urlPrefix": "https://mysite.com/articles/"
}
}
This generates source URLs like https://mysite.com/articles/my-article-slug for each document.
Q: How do I filter content by publication date?
A: Use the Search Query parameter:
{
"content_type": "blogPost",
"fields.publishDate[gte]": "2024-01-01",
"order": "-fields.publishDate"
}
Q: Can the MCP server create content types dynamically?
A: Yes! Use the create_content_type tool:
{
"spaceId": "your_space_id",
"environmentId": "master",
"name": "New Content Type",
"fields": [
{
"id": "title",
"name": "Title",
"type": "Symbol",
"required": true
},
{
"id": "body",
"name": "Body",
"type": "Text",
"required": true
}
],
"displayField": "title"
}
Q: How do I publish content after creating it?
A: Content creation and publishing are separate operations:
- Create entry:
create_entryreturns an entry ID - Publish entry:
publish_entrywith that entry ID
This two-step process allows for review before publishing.
Troubleshooting
Q: I'm getting "Unauthorized" errors
Solutions:
- Verify token is correct and hasn't expired
- Check that token has necessary permissions (delivery vs management)
- Confirm Space ID matches the token's access
- For Management API, ensure token is a Personal Access Token, not a delivery token
Q: Document Loader returns no content
Possible causes:
- Wrong API type: Ensure you're using Preview API for unpublished content
- Search query too restrictive: Check your search query filters
- Content not published: Verify content exists and is published (for Delivery API)
- Wrong content type ID: Confirm content type ID matches exactly (case-sensitive)
- Environment mismatch: Check that Environment ID is correct
Q: MCP server can't find my entries
Solutions:
- Use
list_content_typesfirst to verify content type IDs - Use
search_entrieswithout filters to see what's available - Check that entries exist in the specified environment
- Verify Space ID and Environment ID are correct
Q: Images/assets aren't loading
Causes:
- Assets aren't published - use
publish_assetafter upload - Rich text parsing rules disabled - enable
embedded-asset-block - Include levels too low - increase to resolve asset references
- Asset URLs need authentication (should auto-resolve with credentials)
Q: Getting "Version mismatch" errors when updating
Solution: Contentful uses optimistic locking. When updating:
- Get the entry with
get_entryto retrieve current version - Use the
sys.versionfrom the response in your update call - If someone else updated it, you'll need to fetch the latest version again
Q: Rate limit errors
Solutions:
- Reduce
limitparameter in queries - Add delays between batch operations
- Use pagination instead of large single queries
- Cache content when possible to reduce API calls
- Upgrade Contentful plan for higher limits
Q: Locale/translation issues
Issues:
- Missing locale: Specify locale in search query:
{"locale": "en-US"} - Wrong locale returned: Set default locale in Contentful space settings
- Creating multi-locale content: Provide fields object with locale keys:
{
"fields": {
"title": {
"en-US": "English",
"es-ES": "Espa�ol"
}
}
}
Q: Performance issues with large content sets
Optimizations:
- Use pagination (limit + skip) instead of loading all at once
- Reduce
includeLevelto minimum needed (default: 1) - Limit
fieldsToParseto only necessary fields - Use specific search queries instead of loading all entries
- Consider incremental updates using
sys.updatedAtfilters - Cache results when content doesn't change frequently
Resources
Official Documentation
- Contentful Documentation - Complete Contentful developer documentation
- Content Delivery API Reference - REST API for fetching content
- Content Management API Reference - REST API for managing content
- GraphQL API - Alternative GraphQL API
- Content Preview API - API for preview/draft content
Guides & Tutorials
- Getting Started with Contentful - Beginner-friendly introduction
- Content Modeling Guide - Design effective content structures
- Localization Guide - Multi-language content management
- Webhooks - Real-time event notifications
- Rich Text - Working with rich text fields
AnswerAgentAI Documentation
- Contentful Document Loader - Detailed loader configuration
- Contentful MCP Server - Complete MCP tool reference
- Document Loaders Overview - General document loader concepts
- MCP Servers Overview - Introduction to MCP integrations
Community & Support
- Contentful Community - Forums, events, and discussions
- Contentful GitHub - SDKs and open source tools
- Stack Overflow - Q&A for Contentful developers
- Contentful Changelog - API updates and new features
Tools & SDKs
- JavaScript SDK - Official client library
- Management SDK - Management API client
- CLI - Command-line interface
- Contentful Apps - Marketplace for extensions and apps