Labsco
l33tdawg logo

Strapi MCP

โ˜… 25

from l33tdawg

An MCP server for Strapi CMS, providing access to content types and entries through the MCP protocol.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedAccount requiredNeeds API keys

Strapi MCP

An MCP server for Strapi CMS, providing access to content types and entries through the Model Context Protocol.

Overview

This MCP server integrates with any Strapi CMS instance to provide:

  • Access to Strapi content types as resources
  • Tools to create and update content types in Strapi
  • Tools to manage content entries (create, read, update, delete)
  • Support for Strapi in development mode
  • Robust error handling with clear diagnostics and troubleshooting guidance
  • Configuration validation to prevent common setup issues

Features

  • List and read content types
  • Get, create, update, and delete entries
  • Upload media files
  • Connect and disconnect relations
  • Get content type schemas

Changelog

0.2.3 - 2025-07-25

  • CRITICAL FIX: Fixed timeout issue in relation tools - connect_relation and disconnect_relation now properly handle validation errors instead of timing out
  • IMPROVED ERROR HANDLING: All validation errors now return proper error messages instead of causing tool timeouts

0.2.2 - 2025-07-25

  • ENHANCED RELATION TOOLS: Improved error handling for connect_relation and disconnect_relation with detailed validation and troubleshooting messages
  • FIXED CREATE_COMPONENT: Fixed parameter validation bug - now properly validates individual parameters instead of single object
  • BETTER ERROR DIAGNOSTICS: Added specific error messages for invalid relation fields, non-existent entries, and malformed IDs
  • All 20 tools now working at 100% with robust error handling and validation

0.2.0 - 2025-07-25

  • CRITICAL BUG FIX: Fixed validateStrapiConnection causing "undefined response status" error
  • RESOLVED MCP CONNECTION ISSUE: Fixed the "green light but doesn't work" problem with AI tools
  • IMPROVED ERROR HANDLING: Better connection validation logic with proper admin auth handling
  • Users should update to this version if experiencing MCP connection issues with AI tools

0.1.9 - 2025-07-02

  • CONTEXT WINDOW OVERFLOW FIX: Added size limits and response filtering to prevent base64 files from overwhelming context window
  • NEW TOOL: Added upload_media_from_path - Upload files from local file paths (max 10MB) to avoid base64 context issues
  • ENHANCED UPLOAD_MEDIA: Added 1MB base64 size limit (~750KB file) with clear error messages about context overflow
  • IMPROVED LOGGING: Truncated base64 data in logs to prevent log spam and context overflow
  • RESPONSE FILTERING: Automatically filters large base64 strings from API responses to prevent echo overflow

0.1.8 - 2025-06-12

  • MAJOR BUG FIX: Replaced silent failures with descriptive error messages when content types or entries cannot be fetched
  • Added Configuration Validation: Detects placeholder API tokens and exits with helpful error messages
  • Added Connection Validation: Tests Strapi connectivity before attempting operations with specific error diagnostics
  • Enhanced Error Handling: Comprehensive error diagnostics that distinguish between legitimate empty collections vs actual errors
  • Improved Troubleshooting: All error messages include specific steps to resolve common configuration issues

0.1.7 - 2025-05-17

  • Added publish_entry and unpublish_entry tools: Complete content lifecycle management
  • Added Component Management: list_components, get_component_schema, create_component, update_component
  • Added delete_content_type tool: Delete existing content types via the Content-Type Builder API
  • Enhanced Admin Authentication: Better error handling and token management for all API operations

0.1.6

  • Added create_content_type tool: Allows creating new content types via the Content-Type Builder API (requires admin credentials).
  • Prioritized Admin Credentials: Updated logic to prefer admin email/password for fetching content types and schemas, improving reliability.
  • Updated Documentation: Clarified authentication methods and recommended running procedures.

0.1.5

  • Improved content type discovery with multiple fallback methods
  • Added more robust error handling and logging
  • Enhanced schema inference for content types

0.1.4

  • Improved error handling with more specific error codes
  • Added ResourceNotFound and AccessDenied error codes
  • Better error messages for common API errors

0.1.3

  • Initial public release

Features

Resources

  • List and access content types via strapi://content-type/ URIs
  • Each content type exposes its entries as JSON
  • Application/JSON mime type for structured content access

Tools

  • list_content_types - List all available content types in Strapi
  • get_entries - Get entries for a specific content type with optional filtering, pagination, sorting, and population of relations
  • get_entry - Get a specific entry by ID
  • create_entry - Create a new entry for a content type
  • update_entry - Update an existing entry
  • delete_entry - Delete an entry
  • upload_media - Upload a media file to Strapi (max ~750KB file due to base64 context limits)
  • upload_media_from_path - Upload a media file from local file path (max 10MB, avoids context overflow)
  • get_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.

Advanced Features

Filtering, Pagination, and Sorting

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

Resource URIs

Resources can be accessed with various URI formats:

  • strapi://content-type/api::article.article - Get all articles
  • strapi://content-type/api::article.article/1 - Get article with ID 1
  • strapi://content-type/api::article.article?filters={"title":{"$contains":"hello"}} - Get filtered articles

Publishing and Unpublishing Content

The 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.

Component Management

Strapi components can be managed with the following tools:

  • list_components: Get all available components
  • get_component_schema: View a specific component's structure
  • create_component: Create a new component with specified fields
  • update_component: Modify an existing component

Example of creating a component:

{
  "componentData": {
    "displayName": "Security Settings",
    "category": "security",
    "icon": "shield",
    "attributes": {
      "enableTwoFactor": {
        "type": "boolean", 
        "default": false
      },
      "passwordExpiration": {
        "type": "integer",
        "min": 0
      }
    }
  }
}

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch