mcpField
🚀
🚀 Payload CMS 3.0 MCP Server

🚀 Payload CMS 3.0 MCP Server

ローカル
payloadcmsmcp.info開発ツール12485 週間前に更新

🚀 Payload CMS 3.0 MCP Server について

Payload CMS 3.0 MCP サーバーは、Payload CMS アプリケーションの開発に特化した MCP サーバーです。コードのバリデーション、テンプレート生成、プロジェクトのスキャフォールディングを提供します。Payload CMS で開発する開発者が対象で、READMEに記載されたベストプラクティスに沿った出力を目指しています。

主な機能

  1. 01collection、field、global、config コードのバリデーション
  2. 02collection、field、hook などのテンプレート生成
  3. 03検証済みオプションによるプロジェクトのスキャフォールディング
  4. 04バリデーションルールとベストプラクティスの照会

活用シーン

  1. 01ブログや商品カタログ用の collection 定義を生成する
  2. 02コミット前に Payload CMS の設定コードを検証する
  3. 03複数の collection を含む新規プロジェクトを作成する

MCP 対応

MCP サーバーとして、validate、generate_collection、scaffold_project などのツールと照会用ツールを MCP クライアントに公開します。

設定

ローカルサーバーの設定はどのクライアントでも共通です。コピーしてクライアントの MCP 設定ファイルに貼り付けてください。

インストール方法は未掲載です

このサーバーのパッケージやリモートエンドポイントはまだ取得できていません。プロジェクトの README の手順に従ってください。

リポジトリ

ツール

ツール一覧はまだ取得されていません

ローカルサーバーのツールはマシン上で起動して初めて取得できます。メンテナーはまだツール一覧を提供していません。

詳細

🚀 Payload CMS 3.0 MCP サーバー

Payload CMS ロゴ

MCP 対応 Payload CMS ライセンス Railway へのデプロイ

Payload CMS 3.0 専用の MCP サーバー

ベストプラクティスに沿って、コードの検証、テンプレートの生成、プロジェクトのスキャフォールディングを行います


📋 概要

Payload CMS 3.0 MCP サーバーは、Payload CMS の開発体験を向上させるために設計された専用の Model Context Protocol サーバーです。ベストプラクティスに沿ったコード検証、テンプレート生成、プロジェクトのスキャフォールディング機能を提供し、より優れた Payload CMS アプリケーションの構築を支援します。


✨ 機能

📚
コード検証

コレクション、フィールド、グローバル、設定ファイルの Payload CMS コードを検証し、構文エラーやベストプラクティスについて詳しいフィードバックを提供します。

🔍
コード生成

コレクション、フィールド、グローバル、アクセス制御、フック、エンドポイント、プラグイン、ブロック、マイグレーション用のコードテンプレートを生成します。

🚀
プロジェクトのスキャフォールディング

検証済みのオプションを使って Payload CMS プロジェクト全体をスキャフォールディングし、一貫性を保ち、ベストプラクティスに準拠します。


🔧 Payload CMS 3.0 の機能

検証ツール
  • validate - コレクション、フィールド、グローバル、設定のコードを検証します
  • query - 検証ルールとベストプラクティスを照会します
  • mcp_query - Payload CMS の構造に対して SQL に似たクエリを実行します
コード生成
  • generate_template - さまざまなコンポーネントのコードテンプレートを生成します
  • generate_collection - コレクション定義一式を作成します
  • generate_field - 適切な型付けでフィールド定義を生成します
プロジェクトのセットアップ
  • scaffold_project - Payload CMS プロジェクトの構造全体を作成します
  • validate_scaffold_options - スキャフォールディングのオプションがベストプラクティスに沿っていることを確認します(scaffold_project 内部で使用)

📝 ツールの詳細リファレンス

検証ツール
validate

Payload CMS のコードについて、構文とベストプラクティスを検証します。

パラメーター:

  • code (string):検証するコード
  • fileType (enum):ファイルの種類。「collection」、「field」、「global」、または「config」

プロンプトの例:

Can you validate this Payload CMS collection code?

```typescript
export const Posts = {
  slug: 'posts',
  fields: [
    {
      name: 'title',
      type: 'text',
      required: true,
    },
    {
      name: 'content',
      type: 'richText',
    }
  ],
  admin: {
    useAsTitle: 'title',
  }
}
query

Payload CMS の検証ルールとベストプラクティスを照会します。

パラメーター:

  • query (string):クエリー文字列
  • fileType (optional enum):ファイルの種類。「collection」、「field」、「global」、または「config」

プロンプトの例:

What are the best practices for implementing access control in Payload CMS collections?
mcp_query

Payload CMS の構造に対して、SQL に似たクエリーを実行します。

パラメーター:

  • sql (string):SQL に似たクエリー文字列

プロンプトの例:

Can you execute this query to find all valid field types in Payload CMS?
SELECT field_types FROM payload_schema WHERE version = '3.0'
コード生成
generate_template

さまざまな Payload CMS コンポーネントのコードテンプレートを生成します。

パラメーター:

  • templateType (enum):テンプレートの種類。「collection」、「field」、「global」、「config」、「access-control」、「hook」、「endpoint」、「plugin」、「block」、「migration」
  • options (record):テンプレートの設定オプション

プロンプトの例:

Generate a template for a Payload CMS hook that logs when a document is created.
generate_collection

完全な Payload CMS コレクション定義を生成します。

パラメーター:

  • slug(string):コレクションのスラッグ
  • fields(任意の array):フィールドオブジェクトの配列
  • auth(任意の boolean):認証コレクションかどうか
  • timestamps(任意の boolean):タイムスタンプを含めるかどうか
  • admin(任意の object):管理パネルの設定
  • hooks(任意の boolean):フックを含めるかどうか
  • access(任意の boolean):アクセス制御を含めるかどうか
  • versions(任意の boolean):バージョン管理を有効にするかどうか

プロンプトの例:

Generate a Payload CMS collection for a blog with title, content, author, and published date fields. Include timestamps and versioning.
generate_field

Payload CMS のフィールド定義を生成します。

パラメーター:

  • name(string):フィールド名
  • type(string):フィールドの種類
  • required(任意の boolean):フィールドが必須かどうか
  • unique(任意の boolean):フィールドを一意にするかどうか
  • localized(任意の boolean):フィールドをローカライズするかどうか
  • access(任意の boolean):アクセス制御を含めるかどうか
  • admin(任意の object):管理パネルの設定
  • validation(任意の boolean):バリデーションを含めるかどうか
  • defaultValue(任意の any):フィールドのデフォルト値

プロンプトの例:

Generate a Payload CMS image field with validation that requires alt text and has a description in the admin panel.
プロジェクトのセットアップ
scaffold_project

Payload CMS プロジェクトの構成一式を生成します。

パラメーター:

  • projectName(string):プロジェクト名
  • description(任意の string):プロジェクトの説明
  • serverUrl(任意の string):サーバー URL
  • database(任意の enum):データベースの種類。「mongodb」または「postgres」
  • auth(任意の boolean):認証を含めるかどうか
  • admin(任意の object):管理パネルの設定
  • collections(任意の array):コレクションオブジェクトの配列
  • globals(任意の array):グローバルオブジェクトの配列
  • blocks(任意の array):ブロックオブジェクトの配列
  • plugins(任意の array):プラグイン文字列の配列
  • typescript(任意の boolean):TypeScript を使用するかどうか

プロンプトの例:

Scaffold a Payload CMS project called "blog-platform" with MongoDB, authentication, and collections for posts, categories, and users. Include a global for site settings.

🚀 はじめに

1. 前提条件

始める前に、以下を用意してください。

  • Node.js 18+(Payload CMS 3.0 に必要)
  • 有効な Railway アカウント
  • Railway API トークン(railway.app/account/tokens で作成してください)
  • Payload CMS 3.0 の基本的な概念に関する知識
2. Cursor の設定

Cursor IDE で使用するには、次の手順を実行します。

  1. Cursor の設定を開きます
  2. MCP Servers セクションに移動します
  3. 新しい MCP サーバーを追加します
  4. 名前を「Payload CMS 3.0 MCP」に設定します
  5. Transport Type を「Command」に設定します
  6. Command に railway run --service=YOUR_SERVICE_ID を設定します
  7. 設定を保存します
3. MCP サーバーの使用

設定が完了すると、AI のプロンプトで以下のツールを使用できます。

  • コードの検証: 「この Payload CMS コレクションのコードを検証してください」
  • テンプレートの生成: 「メディアコレクションのテンプレートを生成してください」
  • クエリルール: 「アクセス制御のバリデーションルールを照会してください」
  • SQL のようなクエリ: 「コレクションのフィールド型を見つけるクエリを実行してください」
4. ワークフローの例

Payload CMS MCP サーバーでの一般的なワークフローは次のとおりです。

  1. 特定のフィールドを含むコレクションテンプレートを生成します
  2. 生成されたコードをベストプラクティスに照らして検証します
  3. コードを改善するために、特定のバリデーションルールを照会します
  4. フックやエンドポイントなどのコンポーネントを追加で生成します
  5. 準備ができたら、プロジェクトの構成一式を生成します
5. 完全なワークフローの例

会話の中で MCP サーバーを使用する方法の完全な例を紹介します。

User: I need to create a Payload CMS collection for a product catalog.

AI: I'll help you create a product catalog collection. Let me generate a template for you.

[Uses generate_collection tool]

Here's a collection template for your product catalog:

```typescript
import { CollectionConfig } from 'payload/types';

export const Products: CollectionConfig = {
  slug: 'products',
  admin: {
    useAsTitle: 'name',
    defaultColumns: ['name', 'price', 'category', 'inStock'],
    group: 'Shop',
  },
  access: {
    read: () => true,
  },
  fields: [
    {
      name: 'name',
      type: 'text',
      required: true,
    },
    {
      name: 'description',
      type: 'richText',
    },
    {
      name: 'price',
      type: 'number',
      required: true,
    },
    {
      name: 'category',
      type: 'relationship',
      relationTo: 'categories',
      required: true,
    },
    {
      name: 'images',
      type: 'array',
      fields: [
        {
          name: 'image',
          type: 'upload',
          relationTo: 'media',
          required: true,
        },
        {
          name: 'altText',
          type: 'text',
          required: true,
        }
      ]
    },
    {
      name: 'inStock',
      type: 'checkbox',
      defaultValue: true,
    },
  ],
  timestamps: true,
}

ユーザー:ベストプラクティスに従っているか確認するため、このコードを検証してもらえますか?

AI:コードを検証します。

[validate ツールを使用]

検証結果によると、コードは有効で、ベストプラクティスにも従っています。いくつか提案があります。

  1. 深いクエリを防ぐため、カテゴリのリレーションシップフィールドに maxDepth を追加することを検討してください
  2. 作成、更新、削除の操作にアクセス制御を追加することを検討してください
  3. 商品の更新時に在庫を管理するフックを追加することを検討してください

ユーザー:Payload CMS におけるアクセス制御のベストプラクティスを教えてください。

AI:アクセス制御の検証ルールを照会します。

[query ツールを使用]

Payload CMS におけるアクセス制御のベストプラクティスは次のとおりです。

  1. 作成、読み取り、更新、削除の各操作に、必ず明示的なアクセス制御関数を定義する
  2. 管理者ユーザーにはロールベースのアクセス制御を使用する
  3. 機密データにはフィールドレベルのアクセス制御を実装する
  4. 広範な権限にはコレクションレベルのアクセス制御を使用する
  5. 複雑なロジックには、アクセス制御と併せてフックを使用することを検討する

ユーザー:次に、この商品コレクションとカテゴリコレクションを含む完全なプロジェクトをスキャフォールドする必要があります。

AI:完全なプロジェクトをスキャフォールドします。

[scaffold_project ツールを使用]

次の内容を含む、完全な Payload CMS プロジェクト構成を生成しました。

  • 指定された商品コレクション
  • 名前と説明フィールドを含むカテゴリコレクション
  • 商品画像用のメディアコレクション
  • 管理者ユーザーの認証
  • TypeScript の設定
  • MongoDB データベースのセットアップ
  • 必要なすべてのファイルと設定

プロジェクトは npm install と npm run dev で初期化できます。


📋 スキャフォールディングの例と詳細なプロンプト

プロジェクトのスキャフォールディング例

MCP サーバーを使用してプロジェクトをスキャフォールドすると、完全なプロジェクト構成が得られます。スキャフォールドされた EC サイトのプロジェクト例を紹介します。

e-commerce-platform/
├── .env
├── .eslintrc.js
├── .gitignore
├── README.md
├── package.json
├── tsconfig.json
├── src/
│   ├── payload.config.ts
│   ├── server.ts
│   ├── collections/
│   │   ├── Products.ts
│   │   ├── Categories.ts
│   │   ├── Orders.ts
│   │   ├── Customers.ts
│   │   ├── Media.ts
│   │   └── Users.ts
│   ├── globals/
│   │   ├── Settings.ts
│   │   └── Footer.ts
│   ├── blocks/
│   │   ├── Hero.ts
│   │   ├── ProductGrid.ts
│   │   └── CallToAction.ts
│   ├── fields/
│   │   ├── richText/
│   │   ├── metaImage.ts
│   │   └── slug.ts
│   ├── hooks/
│   │   ├── beforeChange.ts
│   │   └── afterChange.ts
│   ├── access/
│   │   ├── isAdmin.ts
│   │   └── isAdminOrSelf.ts
│   └── utilities/
│       ├── formatSlug.ts
│       └── sendEmail.ts
スキャフォールドプロジェクトのプロンプト例(基本)
Scaffold a Payload CMS project for a blog platform with the following:
- Project name: blog-platform
- Database: MongoDB
- Authentication: Yes
- Collections: Posts, Categories, Authors, Media
- Globals: SiteSettings
- TypeScript: Yes
スキャフォールドプロジェクトのプロンプト例(詳細)
Scaffold a comprehensive Payload CMS project for an e-commerce platform with the following specifications:

Project details:
- Name: luxury-watches-store
- Description: "An e-commerce platform for luxury watches"
- Database: PostgreSQL
- TypeScript: Yes

Collections needed:
1. Products collection with:
   - Name (text, required)
   - Description (rich text)
   - Price (number, required)
   - SKU (text, unique)
   - Brand (relationship to Brands collection)
   - Categories (relationship to Categories, multiple)
   - Features (array of text fields)
   - Specifications (array of key-value pairs)
   - Images (array of media uploads with alt text)
   - Stock quantity (number)
   - Status (select: available, out of stock, discontinued)

2. Categories collection with:
   - Name (text, required)
   - Description (rich text)
   - Parent category (self-relationship)
   - Image (media upload)

3. Brands collection with:
   - Name (text, required)
   - Logo (media upload)
   - Description (rich text)
   - Founded year (number)
   - Country of origin (text)

4. Orders collection with:
   - Order number (text, generated)
   - Customer (relationship to Users)
   - Products (array of relationships to Products with quantity)
   - Status (select: pending, processing, shipped, delivered, cancelled)
   - Shipping address (group of fields)
   - Billing address (group of fields)
   - Payment method (select)
   - Total amount (number, calculated)
   - Notes (text)

5. Users collection (auth enabled) with:
   - Email (email, required)
   - Name (text, required)
   - Shipping addresses (array of address groups)
   - Order history (relationship to Orders)
   - Wishlist (relationship to Products)
   - Role (select: customer, admin)

Globals:
1. SiteSettings with:
   - Site name
   - Logo
   - Contact information
   - Social media links
   - SEO defaults

2. ShippingMethods with:
   - Array of shipping options with prices

Include access control for:
- Admin-only access to manage products, categories, brands
- Customer access to their own orders and profile
- Public read access to products and categories

Add hooks for:
- Updating stock when orders are placed
- Generating order numbers
- Sending email notifications on order status changes
コレクション作成のプロンプト例(基本)
Generate a Payload CMS collection for blog posts with title, content, author, and published date fields.
コレクション作成のプロンプト例(詳細)
Generate a Payload CMS collection for a real estate property listing with the following specifications:

Collection name: Properties
Admin configuration:
- Use "title" as the display field
- Group under "Listings" in the admin panel
- Default columns: title, price, location, status, createdAt

Fields:
1. Title (text, required)
2. Slug (text, unique, generated from title)
3. Description (rich text with basic formatting options)
4. Price (number, required)
5. Location (group) with:
   - Address (text)
   - City (text, required)
   - State/Province (text, required)
   - Postal code (text)
   - Country (select from predefined list)
   - Coordinates (point) for map display
6. Property details (group) with:
   - Property type (select: house, apartment, condo, land, commercial)
   - Bedrooms (number)
   - Bathrooms (number)
   - Square footage (number)
   - Lot size (number)
   - Year built (number)
   - Parking spaces (number)
7. Features (array of checkboxes) including:
   - Air conditioning
   - Swimming pool
   - Garden
   - Garage
   - Fireplace
   - Security system
   - Elevator
   - Furnished
8. Images (array of media uploads with alt text and caption)
9. Documents (array of file uploads for floor plans, certificates, etc.)
10. Status (select: available, under contract, sold, off market)
11. Featured (checkbox to highlight on homepage)
12. Agent (relationship to Users collection, required)
13. Related properties (relationship to self, multiple)

Access control:
- Public read access
- Agent can create and edit their own listings
- Admin can manage all listings

Hooks:
- Before change: Format slug from title
- After change: Notify agent of status changes

Versioning: Enabled
Timestamps: Enabled
プロンプトの詳細度

MCP サーバーは、詳細度の異なるプロンプトに対応できます。

最小限の詳細度(AI が不足部分を補完)
Generate a collection for blog posts.
中程度の詳細度(具体的な要件)
Generate a collection for blog posts with title, content, featured image, categories, and author fields. Make title and content required.
高い詳細度(完全な仕様)
Generate a collection for blog posts with:
- Slug: posts
- Fields:
  - Title (text, required)
  - Content (rich text with custom formatting options)
  - Featured image (upload with alt text)
  - Categories (relationship to categories collection, multiple)
  - Author (relationship to users collection)
  - Status (select: draft, published, archived)
  - Published date (date)
  - SEO (group with title, description, and keywords)
- Admin configuration:
  - Use title as display field
  - Group under "Content"
  - Default columns: title, author, status, publishedDate
- Access control for different user roles
- Hooks for slug generation and notification
- Enable versioning and timestamps
効果的なプロンプトのヒント
  1. 要件を具体的にする:詳細を多く伝えるほど、出力はより要件に合ったものになります。

  2. リレーションシップを指定する:コレクション同士の関係を明確に示します。

  3. バリデーションの要件を含める:フィールドに適用するバリデーションルールや制約があれば、記載します。

  4. 管理画面の UI に関する希望を説明する:管理パネルでコレクションをどのように表示したいかを指定します。

  5. フックとアクセス制御について言及する:特定のビジネスロジックやセキュリティルールが必要な場合は、プロンプトに含めます。

  6. ドメイン固有の用語を使う:業界やユースケースに関連する用語を使ってプロジェクトを説明します。


📄 ライセンス

このプロジェクトは MIT License の下でライセンスされています。詳細については LICENSE ファイルをご覧ください。


🌍 MATMAX WORLDWIDE について

MATMAX WORLDWIDE

人間がより人間らしくいられるよう支援するテクノロジーを創造します。

私たちは、人間らしさを尊重しながら暮らしを豊かにするツールなど、より良い社会のためのテクノロジーを信じています。

テクノロジーがウェルネス、つながり、目的に役立つ未来を一緒に築きましょう。力を合わせれば、誰もが持つ最良のものを引き出すデジタル体験を創造できます。

人間を中心としたテクノロジーという私たちのビジョンについては、matmax.world をご覧ください。


## 🖥️ ローカルで実行する

npm を使って Payload CMS MCP サーバーをローカルで実行できます。

npm バージョン npm ダウンロード数

方法 1:npm からインストール
# Install globally
npm install -g payload-cms-mcp

# Run the server
payload-cms-mcp
方法 2:リポジトリをクローンする
  1. リポジトリをクローンします。
git clone https://github.com/Matmax-Worldwide/payloadcmsmcp.git
cd payloadcmsmcp
  1. 依存関係をインストールします。
npm install
  1. サーバーをローカルで実行します。
npm run dev

または、次の方法でも実行できます。

npm run local

これで MCP サーバーがローカルで実行され、Railway API トークンがなくても開発やテストに利用できるようになります。

🚀 デプロイ方法

Railway にデプロイする(推奨)

MCP サーバーをデプロイする最も簡単な方法は、Railway のワンクリックデプロイを利用することです。

Railway にデプロイ

ボタンをクリックした後:

  1. 「Deploy from GitHub repo」を選択します
  2. 「Matmax-Worldwide/payloadcmsmcp」を検索します
  3. 「Deploy Now」をクリックします
Cursor IDE のクイックセットアップ

デプロイ後:

  1. Railway CLI をインストールします:npm install -g @railway/cli
  2. Railway にログインします:railway login
  3. プロジェクトにリンクします:railway link
  4. Cursor Settings > MCP Servers で、Command に railway run を設定します

コメント

MCP は初めてですか?

プロトコルの概要から最初のサーバーの導入まで、よくある疑問にまとめて答えます。

AI アプリケーションが外部のツールやデータソースに統一的な方法で接続するためのオープンなプロトコルです。クライアントはモデルとの対話を担い、MCP サーバーはツール・リソース・プロンプトテンプレートを提供します。標準メッセージでやり取りするため、1 つのサーバーを複数のクライアントで再利用できます。