This MCP server integrates with Strapi CMS to provide access to content types and entries through the Model Context Protocol. It allows you to manage your Strapi content through MCP tools, including creating, reading, updating, and deleting content entries, as well as managing content types and components.
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)STRAPI_ADMIN_PASSWORD
: The password for the Strapi admin user (Recommended)STRAPI_API_TOKEN
: (Optional Fallback) An API token if admin credentials are not providedSTRAPI_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
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"
}
}
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 [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
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: "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",
tool_name: "publish_entry",
arguments: {
"contentType": "api::article.article",
"id": "1"
}
)
use_mcp_tool(
server_name: "strapi-mcp",
tool_name: "unpublish_entry",
arguments: {
"contentType": "api::article.article",
"id": "1"
}
)
[Error] STRAPI_API_TOKEN appears to be a placeholder value...
Solution: Replace placeholder values 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:
Access forbidden. Your API token may lack necessary permissions.
Solution:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.