A Model Context Protocol server for interacting with Strapi CMS. This server enables AI assistants to interact with your Strapi instance through a standardized interface, supporting content types and REST API operations.
- 🔍 Schema introspection
- 🔄 REST API support with validation
- 📸 Media upload handling
- 🔐 JWT authentication
- 📝 Content type management
- 🖼️ Image processing with format conversion
- 🌐 Multiple server support
- ✅ Automatic schema validation
You can use this server directly with npx in your Claude Desktop configuration:
{
"mcpServers": {
"strapi": {
"command": "npx",
"args": ["-y", "@bschauer/strapi-mcp-server"],
"env": {
"API_URL": "http://localhost:1337",
"JWT": "your-jwt-token"
}
}
}
}
Create a configuration file at ~/.mcp/strapi-mcp-server.config.json
:
{
"myserver": {
"api_url": "http://localhost:1337",
"api_key": "your-jwt-token-from-strapi-admin"
}
}
You can configure multiple Strapi instances by adding them to this file.
- Log in to your Strapi admin panel
- Create an API token with appropriate permissions
- Add the token to your config file under the appropriate server name
strapi_list_servers();
// Get all content types from a specific server
strapi_get_content_types({
server: "myserver",
});
// Get components
strapi_get_components({
server: "myserver",
});
The REST API provides comprehensive CRUD operations with built-in validation:
// Query content with filters
strapi_rest({
server: "myserver",
endpoint: "api/articles",
method: "GET",
params: {
filters: {
title: {
$contains: "search term",
},
},
populate: "*",
},
});
// Create new content
strapi_rest({
server: "myserver",
endpoint: "api/articles",
method: "POST",
body: {
data: {
title: "New Article",
content: "Article content",
category: "news",
},
},
});
// Update content
strapi_rest({
server: "myserver",
endpoint: "api/articles/123",
method: "PUT",
body: {
data: {
title: "Updated Title",
content: "Updated content",
},
},
});
// Delete content
strapi_rest({
server: "myserver",
endpoint: "api/articles/123",
method: "DELETE",
});
// Upload image with automatic optimization
strapi_upload_media({
server: "myserver",
url: "https://example.com/image.jpg",
format: "webp",
quality: 80,
metadata: {
name: "My Image",
caption: "Image Caption",
alternativeText: "Alt Text",
},
});
- Always check schema first with
strapi_get_content_types
- Use proper plural/singular forms for endpoints
- Include error handling in your queries
- Validate URLs before upload
- Use appropriate content population strategies
- Always include the complete data object when updating
- Use filters to optimize query performance
- Leverage built-in schema validation
// Filter by field value
params: {
filters: {
title: "Exact Match";
}
}
// Contains filter
params: {
filters: {
title: {
$contains: "partial";
}
}
}
// Multiple conditions
params: {
filters: {
$and: [{ category: "news" }, { published: true }];
}
}
params: {
sort: ["createdAt:desc"];
}
params: {
pagination: {
page: 1,
pageSize: 25
}
}
// Populate all relations
params: {
populate: "*"
}
// Populate specific fields
params: {
populate: {
category: true,
author: {
fields: ["name", "email"]
}
}
}
Common issues and solutions:
-
404 Errors
- Check endpoint plural/singular form
- Verify content type exists
- Ensure correct API URL
-
Authentication Issues
- Verify JWT token is valid
- Check token permissions
- Ensure server is properly configured in config file
-
Validation Errors
- Check required fields are provided
- Verify data types match schema
- Ensure related content exists
-
Configuration Issues
- Check if
~/.mcp/strapi-mcp-server.config.json
exists - Verify server name is correct
- Ensure API URL and key are valid
- Check if
MIT License - see LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.