LS

l33tdawg/strapi-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

25 stars 10 forks 质量 70 趋势 11MIT

Strapi CMS 的 MCP 服务器

概览

Strapi CMS 的 MCP 服务器,通过模型上下文协议提供内容类型和条目访问。 该MCP服务器可与任何Strapi CMS实例集成,提供:- 访问Strapi内容类型作为资源 - 创建和更新Strapi内容类型的工具 - 管理内容条目的工具(创建、读取、更新、删除) - 开发模式下支持 Strapi - 提供清晰的诊断和故障排除指导 - 防止常见的设置问题 建议在项目根节点使用.env文件存储凭证。- STRAPI_URL:您的Strapi实例URL(默认:http://localhost:1337))- STRAPI_ADMIN_EMAIL:Strapi 管理员用户的电子邮件地址(推荐以实现完整功能,尤其是模式访问)。- STRAPI_ADMIN_PASSWORD:Strapi 管理员用户的密码(推荐)。- STRAPI_API_TOKEN:可选备用)API 令牌。如果未提供管理员凭证,可以使用,但权限可能有限。

概述(AI 翻译)

Strapi CMS 的 MCP 服务器,通过模型上下文协议提供内容类型和条目访问。

概述

该MCP服务器可与任意Strapi CMS实例集成,提供:

  • 作为资源访问Strapi内容类型
  • 创建和更新 Strapi 内容类型的工具
  • 管理内容条目的工具(创建、阅读、更新、删除)
  • 开发模式下支持 Strapi
  • 强健的错误处理,配备清晰的诊断和故障排除指导
  • 配置验证以防止常见的设置问题

布置

环境变量

建议在项目根节点使用.env文件来存储你的凭证。

  • STRAPI_URL:你的Strapi实例的URL(默认:http://localhost:1337)
  • STRAPI_ADMIN_EMAIL:Strapi 管理员用户的电子邮件地址(推荐以实现完整功能,尤其是模式访问)。
  • STRAPI_ADMIN_PASSWORD:Strapi 管理员用户的密码(推荐)。
  • STRAPI_API_TOKEN:(可选备用)API令牌。如果不提供管理员凭证,可以使用,但权限可能有限。

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

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

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, 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:

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

Installation

npm install strapi-mcp

Install from source (Development)

For the latest development features:

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

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
在 GitHub 查看完整 README

安装

npx strapi-mcp
新手?先看 mcpskill.org 教程 →

配置

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