
Contentful Delivery
STDIOMCP server for querying and retrieving Contentful content via natural language
MCP server for querying and retrieving Contentful content via natural language
A Model Context Protocol (MCP) server that provides seamless access to Contentful's Delivery API through AI assistants. Query and retrieve content entries, assets, and content types using natural language.
Install the package in your project:
npm install @mshaaban0/contentful-delivery-mcp-server
Or globally:
npm install -g @mshaaban0/contentful-delivery-mcp-server
Set up your Contentful credentials:
export CONTENTFUL_SPACE_ID="your_space_id" export CONTENTFUL_ACCESS_TOKEN="your_access_token" # Optional: Restrict content to specific content types export CONTENTFUL_CONTENT_TYPE_IDS="blogPost,article,product"
query_entries
- Natural language search across all contentget_entry
- Fetch specific entry by IDget_entries
- List entries with filteringget_assets
- Browse all assetsget_asset
- Get asset details by IDget_content_type
- View content type schemaget_content_types
- List available content typesMastra AI provides seamless integration with this MCP server. Here's how to set it up:
import { MastraMCPClient } from "@mastra/mcp"; import { Agent } from "@mastra/core/agent"; // Initialize the MCP client const contentfulClient = new MastraMCPClient({ name: "contentful-delivery", server: { command: "npx", args: ["-y", "@mshaaban0/contentful-delivery-mcp-server@latest"], env: { CONTENTFUL_ACCESS_TOKEN: "your_access_token", CONTENTFUL_SPACE_ID: "your_space_id", // Optional: Restrict content to specific content types CONTENTFUL_CONTENT_TYPE_IDS: "blogPost,article,product" } } }); // Create an AI agent with access to Contentful const assistant = new Agent({ name: "Content Assistant", instructions: ` You are a helpful assistant with access to our content database. Use the available tools to find and provide accurate information. `, model: "gpt-4", }); // Connect and register tools await contentfulClient.connect(); const tools = await contentfulClient.tools(); assistant.__setTools(tools); // Example usage const response = await assistant.chat("Find articles about machine learning");
# Clone the repo git clone https://github.com/mshaaban0/contentful-delivery-mcp-server.git # Install dependencies npm install # Build npm run build # Development with auto-rebuild npm run watch # Run the inspector npm run inspector
The MCP Inspector provides a web interface for debugging:
npm run inspector
Visit the provided URL to access the debugging tools.
MIT