strapi-mcp-connect

v1.1.1
strapi-mcp-connect Checked 7 hours ago Published 1 month ago

Model Context Protocol (MCP) server for Strapi CMS.

An enterprise-ready Model Context Protocol (MCP) server that connects AI assistants such as Claude Desktop, Cursor, VS Code, Windsurf, Claude Code, and Antigravity directly to your Strapi Headless CMS. Use natural-language requests to work with Strapi content through MCP tools for CRUD operations, Single Types, Collection Types, filtering, pagination, relations, media population, and draft/published content workflows. The executable exposed by the package is:

Summary extracted from the README.

strapi-mcp-connect

npm version npm downloads License: MIT Node Version Strapi Compatibility MCP Version

An enterprise-ready Model Context Protocol (MCP) server that connects AI assistants such as Claude Desktop, Cursor, VS Code, Windsurf, Claude Code, and Antigravity directly to your Strapi Headless CMS.

Use natural-language requests to work with Strapi content through MCP tools for CRUD operations, Single Types, Collection Types, filtering, pagination, relations, media population, and draft/published content workflows.


๐Ÿ›๏ธ Architecture & How It Works

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                  AI Client / Assistant                      โ”‚
โ”‚     Claude Desktop โ€ข Cursor โ€ข VS Code โ€ข Windsurf โ€ข etc.    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚  Standard I/O (stdio)
                               โ”‚  JSON-RPC MCP Protocol
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    strapi-mcp-connect                        โ”‚
โ”‚          Type-Safe Zod Schema & Validation Engine           โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                               โ”‚  Authenticated REST API
                               โ”‚  Bearer Token / API Token
                               โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                     Strapi CMS (v4 / v5)                    โ”‚
โ”‚                  http://localhost:1337                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Request Flow

Natural-language request
        โ†“
AI Client / Assistant
        โ†“
MCP Tool Selection
        โ†“
Schema Validation
        โ†“
Strapi REST API
        โ†“
Create / Read / Update / Delete / Publish
        โ†“
Result returned to the AI client

โœจ Key Highlights

  • โšก Zero-Clone Setup with npx: Run the MCP server directly without manually downloading or cloning the repository.
  • ๐Ÿง  Auto Schema Discovery: Automatically fetches content types and components schemas so the AI knows exactly how to map data (including Dynamic Zones).
  • ๐Ÿ–ผ๏ธ Media Uploads: Directly uploads images and local files to the Strapi Media Library and links them to entries.
  • ๐Ÿ“ฆ Full Collection CRUD: Complete create, read, update, and delete support across Collection Types.
  • ๐Ÿ“„ Native Single Types: First-class support for Single Types such as homepage, navigation, footer, and global.
  • ๐Ÿš€ Strapi v4 & v5 Ready: Supports Strapi v4 numeric IDs and Strapi v5 documentId-based content workflows.
  • ๐Ÿ”— Deep Population & Filters: Supports filtering, sorting, pagination, relations, and media population such as populate=*.
  • ๐Ÿ›ก๏ธ Type-Safe Validation: Built with the Model Context Protocol TypeScript SDK and Zod schemas.
  • ๐Ÿ” Token-Based Authentication: Uses a Strapi API Token for authenticated REST API access.

๐Ÿ“ฆ Installation

Install from npm

npm install strapi-mcp-connect

Run directly with npx

npx -y strapi-mcp-connect

CLI command

The executable exposed by the package is:

strapi-mcp-connect

โš™๏ธ Environment Variables

Variable Required Default Description
STRAPI_URL Yes http://localhost:1337 Base URL of your Strapi CMS.
STRAPI_API_TOKEN Yes โ€” Strapi API Token used to authenticate REST API requests.

Example:

STRAPI_URL=http://localhost:1337
STRAPI_API_TOKEN=YOUR_STRAPI_API_TOKEN

Security: Never commit real Strapi API tokens to GitHub or hard-code them in source code. Use environment variables or your AI client's secure environment configuration.


๐Ÿš€ Quick Setup Guide

1. Claude Desktop

Add this configuration to your Claude Desktop configuration file.

Windows

%APPDATA%\Claude\claude_desktop_config.json

macOS

~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "strapi": {
      "command": "npx",
      "args": [
        "-y",
        "strapi-mcp-connect"
      ],
      "env": {
        "STRAPI_URL": "http://localhost:1337",
        "STRAPI_API_TOKEN": "YOUR_STRAPI_API_TOKEN"
      }
    }
  }
}

Restart Claude Desktop after changing the configuration.


2. Cursor IDE

Open Cursor Settings โ†’ Features โ†’ MCP, or configure MCP in your project using .cursor/mcp.json.

{
  "mcpServers": {
    "strapi": {
      "command": "npx",
      "args": [
        "-y",
        "strapi-mcp-connect"
      ],
      "env": {
        "STRAPI_URL": "http://localhost:1337",
        "STRAPI_API_TOKEN": "YOUR_STRAPI_API_TOKEN"
      }
    }
  }
}

3. Windsurf IDE

Add the server to:

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "strapi": {
      "command": "npx",
      "args": [
        "-y",
        "strapi-mcp-connect"
      ],
      "env": {
        "STRAPI_URL": "http://localhost:1337",
        "STRAPI_API_TOKEN": "YOUR_STRAPI_API_TOKEN"
      }
    }
  }
}

4. VS Code

For MCP-compatible VS Code clients or extensions, configure the server in .vscode/mcp.json when supported:

{
  "servers": {
    "strapi": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "strapi-mcp-connect"
      ],
      "env": {
        "STRAPI_URL": "http://localhost:1337",
        "STRAPI_API_TOKEN": "YOUR_STRAPI_API_TOKEN"
      }
    }
  }
}

5. Antigravity IDE

Add to your global or workspace MCP configuration:

~/.gemini/config/mcp_config.json
{
  "mcpServers": {
    "strapi": {
      "command": "npx",
      "args": [
        "-y",
        "strapi-mcp-connect"
      ],
      "env": {
        "STRAPI_URL": "http://localhost:1337",
        "STRAPI_API_TOKEN": "YOUR_STRAPI_API_TOKEN"
      }
    }
  }
}

6. Claude Code CLI

Add the MCP server with:

claude mcp add strapi -- npx -y strapi-mcp-connect

๐Ÿ› ๏ธ Available MCP Tools & Parameters

Tool Purpose Parameters
test_connection Verifies Strapi availability and token authentication. None
get_content_types_schema Fetches the schema of all Collections and Single Types. None
get_components_schema Fetches the schema of all components (Dynamic Zones). None
upload_media Uploads a local file to the Strapi Media Library. filePath
get_entries Fetches Collection Type entries with pagination, sorting, filters, population, and status. pluralApiId, page, pageSize, filters, populate, sort, status
get_entry Fetches a Collection Type entry by id or documentId. pluralApiId, id, populate, status
get_single_type Fetches Single Type content such as homepage or footer. singularApiId, populate, status
update_single_type Updates Single Type content. singularApiId, data
create_entry Creates a new Collection Type entry. pluralApiId, data, status
update_entry Updates an existing Collection Type entry. pluralApiId, id, data
delete_entry Deletes a Collection Type entry. pluralApiId, id
raw_query Sends a direct request to a custom Strapi endpoint. endpoint, method, body

๐Ÿ’ก Practical Examples

1. Fetch entries with relations

Tool: get_entries

{
  "pluralApiId": "articles",
  "populate": "*",
  "sort": "createdAt:desc",
  "pageSize": 10
}

2. Create a published entry

Tool: create_entry

{
  "pluralApiId": "pages",
  "data": {
    "title": "Pricing Plans",
    "slug": "pricing",
    "description": "Explore our subscription plans"
  },
  "status": "published"
}

3. Fetch a Single Type

Tool: get_single_type

{
  "singularApiId": "homepage",
  "populate": "*"
}

๐Ÿ”‘ Generating Your Strapi API Token

  1. Open your Strapi Admin Panel:
    http://localhost:1337/admin
    
  2. Go to Settings โ†’ API Tokens.
  3. Click Create new API Token.
  4. Use a name such as:
    MCP Connector
    
  5. Choose the permissions required for your content operations.
  6. Save the token and copy it securely.

Then configure:

STRAPI_API_TOKEN=YOUR_STRAPI_API_TOKEN

For production environments, use the minimum permissions required for the workflow instead of granting unnecessary access.


๐Ÿ’ฌ Natural Language Prompt Examples

After configuration, you can ask your AI assistant:

List all entries from my articles collection in Strapi.
Fetch the homepage single type content and summarize it.
Create a new product in Strapi with title "Wireless Headphones" and price 149.
Update the about-page entry and change the contact email.
Find all draft pages in Strapi.
Create a 2BHK property in Ahmedabad with a price of 45 lakh.

๐Ÿ” Security & Permissions

This MCP server communicates with Strapi through authenticated REST API requests.

Recommended practices:

  • Never hard-code Strapi API tokens in source code.
  • Never commit .env files containing real credentials.
  • Grant only the Strapi permissions required by your workflow.
  • Keep production credentials separate from local development credentials.
  • Review raw_query usage carefully because it can access custom endpoints supported by the configured token.

โ“ Troubleshooting & FAQs

Issue Root Cause Solution
401 Unauthorized Invalid, expired, or missing Strapi API Token. Generate a valid API token and update STRAPI_API_TOKEN.
403 Forbidden The token does not have sufficient permissions. Update the token permissions for the required content type/action.
404 Not Found Incorrect Collection Type name, Single Type name, or endpoint. Verify the exact API ID in Strapi.
Connection Refused Strapi is not running or STRAPI_URL is incorrect. Start Strapi and verify the configured URL.
Tools Not Showing MCP configuration is incorrect or the AI client has not reloaded the server. Check the JSON configuration and restart the AI client.
Invalid Data Request fields do not match the Strapi content-type schema. Check the content-type schema and provide the correct fields.

๐Ÿ—บ๏ธ Roadmap

  • Automated Schema & Content-Type Discovery
  • GraphQL query execution support
  • Advanced Strapi Media Library management
  • Batch entry creation & bulk updates
  • More granular permission-aware tool discovery

โš ๏ธ Known Limitations

  • REST API Dependency: This MCP server communicates with Strapi through the REST API.
  • Permissions: Available operations depend on the permissions assigned to the configured Strapi API Token.
  • Custom Plugins: Custom plugins with non-standard route structures can be accessed using raw_query when the token has sufficient permissions.
  • Schema Discovery & Uploads: The STRAPI_API_TOKEN must have specific permissions for the Content-Type Builder and Upload plugins to use the schema discovery and media upload tools.

๐Ÿค Contributing

Contributions, issues, and feature requests are welcome.

  1. Fork the repository.
  2. Create a feature branch.
  3. Make your changes.
  4. Run the build.
  5. Verify the MCP server locally.
  6. Open a pull request.

๐Ÿ”ฎ Future Vision & Enterprise Roadmap

As strapi-mcp-connect grows, we are planning a major Enterprise-Level architecture update. In the future, this project will be refactored into a scalable, modular structure (separating tools, schemas, and API logic) and will include the following highly advanced features:

1. AI-Driven Schema Generation (The Holy Grail)

The AI won't just read schemasโ€”it will write them. By hooking into Strapi's Content-Type Builder API, you can tell the AI: "I need a blog system with authors and categories." The MCP server will automatically generate the databases, build the relations, and restart your Strapi server autonomously.

2. Semantic Search & RAG (Retrieval-Augmented Generation)

Integration with Vector Databases (like Pinecone) or deep search plugins. You will be able to ask the AI, "Find any articles in Strapi that talk about the feeling of sadness," and it will search the underlying meaning of your Strapi content to return results.

3. Bi-Directional Real-Time Sync (Webhooks + SSE)

Strapi Webhooks will ping the MCP server whenever human editors update data in the Strapi Admin Panel. The MCP server will push notifications back into your AI chat: "Warning: The marketing team just updated the Homepage schema. Do you want me to fetch the new schema?"

4. Automated i18n (Internationalization) Engine

For multi-language projects, the AI can scan an English article in Strapi, automatically translate it into Spanish, French, and German, and push all new localized entries into Strapi simultaneously, perfectly linking the locales.

5. Advanced Asset Processing Pipeline

The upload_media tool will intercept local images, automatically compress them, resize them for responsive web, convert them to .webp format for lightning-fast loading, and then upload them to Strapi.

6. High-Performance Enterprise Features

  • Caching Layer: Redis or in-memory caching for schema discovery to save Strapi server resources.
  • Batch Operations: Bulk CSV uploads and multi-entry payloads to prevent rate-limiting on massive jobs.
  • GraphQL Support: Full GraphQL support for deeply nested relational data.
  • Advanced Telemetry: Winston/Pino logging connected to Datadog, Sentry, or AWS CloudWatch.

๐Ÿ“„ License

Distributed under the MIT License.

Authored with โค๏ธ by Kevin Patel