Strapi CMS Integration
STDIOMCP server providing access to Strapi CMS content types and entries.
MCP server providing access to Strapi CMS content types and entries.
An MCP server for Strapi CMS, providing access to content types and entries through the Model Context Protocol.
This MCP server integrates with any Strapi CMS instance to provide:
It's recommended to use a .env
file in the project root to store your credentials.
STRAPI_URL
: The URL of your Strapi instance (default: http://localhost:1337
)STRAPI_ADMIN_EMAIL
: The email address for a Strapi admin user (Recommended for full functionality, especially schema access).STRAPI_ADMIN_PASSWORD
: The password for the Strapi admin user (Recommended).STRAPI_API_TOKEN
: (Optional Fallback) An API token. Can be used if admin credentials are not provided, but may have limited permissions.STRAPI_DEV_MODE
: Set to "true"
to enable development mode features (defaults to false
).Example .env
file:
STRAPI_URL=http://localhost:1337 [email protected] STRAPI_ADMIN_PASSWORD=your_admin_password # STRAPI_API_TOKEN=your_api_token_here # Optional
Important:
.env
to your .gitignore
file to avoid committing credentials"strapi_token"
- the server validates and rejects common placeholdersnpm install strapi-mcp
For the latest development features:
git clone https://github.com/l33tdawg/strapi-mcp.git cd strapi-mcp npm install npm run build
Recommended Method (using Cursor MCP Configuration):
For Cursor users, configure the strapi-mcp server in your ~/.cursor/mcp.json
file:
"strapi-mcp": { "command": "npx", "args": ["strapi-mcp"], "env": { "STRAPI_URL": "http://localhost:1337", "STRAPI_ADMIN_EMAIL": "[email protected]", "STRAPI_ADMIN_PASSWORD": "your_admin_password" } }
If you installed from source, use the direct path instead:
"strapi-mcp": { "command": "node", "args": ["/path/to/strapi-mcp/build/index.js"], "env": { "STRAPI_URL": "http://localhost:1337", "STRAPI_ADMIN_EMAIL": "[email protected]", "STRAPI_ADMIN_PASSWORD": "your_admin_password" } }
Cursor will manage the server lifecycle automatically when strapi-mcp tools are used.
Alternative Method (using .env
file):
Make sure you have built the project (npm run build
). Then run the server using Node.js v20.6.0+ with the --env-file
flag:
node --env-file=.env build/index.js
Alternative (using environment variables directly):
export STRAPI_URL=http://localhost:1337 export STRAPI_ADMIN_EMAIL=[email protected] export STRAPI_ADMIN_PASSWORD=your_admin_password # export STRAPI_API_TOKEN=your-api-token # Optional fallback export STRAPI_DEV_MODE=true # optional # Run the globally installed package (if installed via npm install -g) strapi-mcp # Or run the local build directly node build/index.js
publish_entry
and unpublish_entry
tools: Complete content lifecycle managementlist_components
, get_component_schema
, create_component
, update_component
delete_content_type
tool: Delete existing content types via the Content-Type Builder APIcreate_content_type
tool: Allows creating new content types via the Content-Type Builder API (requires admin credentials).ResourceNotFound
and AccessDenied
error codesMIT
An MCP server for your Strapi CMS
This is a TypeScript-based MCP server that integrates with Strapi CMS. It provides access to Strapi content types and entries through the MCP protocol, allowing you to:
strapi://content-type/
URIslist_content_types
- List all available content types in Strapiget_entries
- Get entries for a specific content type with optional filtering, pagination, sorting, and population of relationsget_entry
- Get a specific entry by IDcreate_entry
- Create a new entry for a content typeupdate_entry
- Update an existing entrydelete_entry
- Delete an entryupload_media
- Upload a media file to Strapiget_content_type_schema
- Get the schema (fields, types, relations) for a specific content type.connect_relation
- Connect related entries to an entry's relation field.disconnect_relation
- Disconnect related entries from an entry's relation field.create_content_type
- Create a new content type using the Content-Type Builder API (Requires Admin privileges).publish_entry
- Publish a specific entry.unpublish_entry
- Unpublish a specific entry.list_components
- List all available components in Strapi.get_component_schema
- Get the schema for a specific component.create_component
- Create a new component.update_component
- Update an existing component.The get_entries
tool supports advanced query options:
{ "contentType": "api::article.article", "filters": { "title": { "$contains": "hello" } }, "pagination": { "page": 1, "pageSize": 10 }, "sort": ["title:asc", "createdAt:desc"], "populate": ["author", "categories"] }
Resources can be accessed with various URI formats:
strapi://content-type/api::article.article
- Get all articlesstrapi://content-type/api::article.article/1
- Get article with ID 1strapi://content-type/api::article.article?filters={"title":{"$contains":"hello"}}
- Get filtered articlesThe publish_entry
and unpublish_entry
tools provide control over the content lifecycle:
{ "contentType": "api::article.article", "id": "1" }
These tools utilize the admin API paths for publishing/unpublishing actions, with a fallback to directly updating the publishedAt
field if admin permissions are not available.
Strapi components can be managed with the following tools:
list_components
: Get all available componentsget_component_schema
: View a specific component's structurecreate_component
: Create a new component with specified fieldsupdate_component
: Modify an existing componentExample of creating a component:
{ "componentData": { "displayName": "Security Settings", "category": "security", "icon": "shield", "attributes": { "enableTwoFactor": { "type": "boolean", "default": false }, "passwordExpiration": { "type": "integer", "min": 0 } } } }
Install dependencies:
npm install
Build the server:
npm run build
For development with auto-rebuild:
npm run watch
For detailed step-by-step instructions on how to deploy and test this MCP server, please see the DEPLOYMENT.md file.
Quick setup:
npm run build
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
{ "mcpServers": { "strapi-mcp": { "command": "npx", "args": ["strapi-mcp"], "env": { "STRAPI_URL": "http://localhost:1337", "STRAPI_ADMIN_EMAIL": "[email protected]", "STRAPI_ADMIN_PASSWORD": "your_admin_password" } } } }
If you installed from source, use the direct path:
{ "mcpServers": { "strapi-mcp": { "command": "/path/to/strapi-mcp/build/index.js", "env": { "STRAPI_URL": "http://localhost:1337", "STRAPI_ADMIN_EMAIL": "[email protected]", "STRAPI_ADMIN_PASSWORD": "your_admin_password" } } } }
STRAPI_URL
(optional): The URL of your Strapi instance (defaults to http://localhost:1337)STRAPI_ADMIN_EMAIL
& STRAPI_ADMIN_PASSWORD
(Recommended): Credentials for a Strapi admin user. Required for full functionality like fetching content type schemas.STRAPI_API_TOKEN
(Optional Fallback): Your Strapi API token. Can be used if admin credentials are not provided, but functionality might be limited based on token permissions.STRAPI_DEV_MODE
(optional): Set to "true" to enable development mode features (defaults to false)The server prioritizes authentication methods in this order:
STRAPI_ADMIN_EMAIL
, STRAPI_ADMIN_PASSWORD
)STRAPI_API_TOKEN
)It's strongly recommended to use Admin Credentials for the best results.
Common Issues and Solutions:
[Error] STRAPI_API_TOKEN appears to be a placeholder value...
Solution: Replace "strapi_token"
or "your-api-token-here"
with a real API token from your Strapi admin panel.
Cannot connect to Strapi instance: Connection refused. Is Strapi running at http://localhost:1337?
Solution:
npm run develop
or yarn develop
STRAPI_URL
is correctCannot connect to Strapi instance: Authentication failed. Check your API token or admin credentials.
Solution:
api::data.data
, api::error.error
)This issue has been fixed in v0.1.8. If you still see these, you may be using an older version.
As of v0.1.8, the server now clearly distinguishes between:
{"data": [], "meta": {...}}
Access forbidden. Your API token may lack necessary permissions.
Solution:
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
npm run inspector
The Inspector will provide a URL to access debugging tools in your browser.
Once the MCP server is configured and running, you can use it with Claude to interact with your Strapi CMS. Here are some examples:
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "list_content_types",
arguments: {}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "get_entries",
arguments: {
"contentType": "api::article.article",
"filters": {
"title": {
"$contains": "hello"
}
},
"pagination": {
"page": 1,
"pageSize": 10
},
"sort": ["title:asc"]
}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "create_entry",
arguments: {
"contentType": "api::article.article",
"data": {
"title": "My New Article",
"content": "This is the content of my article.",
"publishedAt": "2023-01-01T00:00:00.000Z"
}
}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "upload_media",
arguments: {
"fileData": "base64-encoded-data-here",
"fileName": "image.jpg",
"fileType": "image/jpeg"
}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "connect_relation",
arguments: {
"contentType": "api::article.article",
"id": "1",
"relationField": "authors",
"relatedIds": [2, 3]
}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "disconnect_relation",
arguments: {
"contentType": "api::article.article",
"id": "1",
"relationField": "authors",
"relatedIds": [3]
}
)
use_mcp_tool(
server_name: "strapi-mcp-local",
tool_name: "create_content_type",
arguments: {
"displayName": "My New Product",
"singularName": "product",
"pluralName": "products",
"kind": "collectionType",
"description": "Represents products in the store",
"draftAndPublish": true,
"attributes": {
"name": { "type": "string", "required": true },
"description": { "type": "text" },
"price": { "type": "decimal", "required": true },
"stock": { "type": "integer" }
}
}
)
use_mcp_tool(
server_name: "strapi-mcp-local",
tool_name: "update_content_type",
arguments: {
"contentType": "api::speaker.speaker",
"attributes": {
"isHighlightSpeaker": {
"type": "boolean",
"default": false
},
"newTextField": {
"type": "string"
}
}
}
)