Strapi CMS MCP server

Integrates with Strapi CMS to enable creating, reading, updating, and deleting content entries with support for filtering, pagination, sorting, and media uploads through URI-based resource patterns.
Back to servers
Provider
l33tdawg
Release date
Mar 08, 2025
Language
TypeScript
Package
Stats
406 downloads
12 stars

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.

Setup

Environment Variables

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 provided
  • 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:

  • Add .env to your .gitignore file to avoid committing credentials
  • Avoid placeholder values like "strapi_token" - the server validates and rejects common placeholders

Installation

Install from npm (Recommended)

npm install strapi-mcp

Install from source (Development)

git clone https://github.com/l33tdawg/strapi-mcp.git
cd strapi-mcp
npm install
npm run build

Running

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

Usage Examples

Listing Content Types

use_mcp_tool(
  server_name: "strapi-mcp",
  tool_name: "list_content_types",
  arguments: {}
)

Getting Entries

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"]
  }
)

Creating an Entry

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"
    }
  }
)

Uploading Media

use_mcp_tool(
  server_name: "strapi-mcp",
  tool_name: "upload_media",
  arguments: {
    "fileData": "base64-encoded-data-here",
    "fileName": "image.jpg",
    "fileType": "image/jpeg"
  }
)

Connecting Relations

use_mcp_tool(
  server_name: "strapi-mcp",
  tool_name: "connect_relation",
  arguments: {
    "contentType": "api::article.article",
    "id": "1",
    "relationField": "authors",
    "relatedIds": [2, 3]
  }
)

Creating a Content Type

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" }
    }
  }
)

Publishing and Unpublishing Content

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"
  }
)

Troubleshooting

Common Issues and Solutions

1. Placeholder API Token Error

[Error] STRAPI_API_TOKEN appears to be a placeholder value...

Solution: Replace placeholder values with a real API token from your Strapi admin panel.

2. Connection Refused Error

Cannot connect to Strapi instance: Connection refused. Is Strapi running at http://localhost:1337?

Solution:

  • Ensure Strapi is running: npm run develop or yarn develop
  • Check if the URL in STRAPI_URL is correct
  • Verify your database is running

3. Authentication Failed

Cannot connect to Strapi instance: Authentication failed. Check your API token or admin credentials.

Solution:

  • Verify your API token has proper permissions (preferably "Full access")
  • Check admin email/password are correct
  • Ensure the admin user exists and is active

4. Permission Errors

Access forbidden. Your API token may lack necessary permissions.

Solution:

  • Use admin credentials instead of API token for full functionality
  • If using API token, ensure it has "Full access" permissions
  • Check that the content type allows public access if using limited API token

How to add this MCP server to Cursor

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.

Adding an MCP server to Cursor globally

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"
            ]
        }
    }
}

Adding an MCP server to a project

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.

How to use the MCP server

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.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later