stimmt/craft-mcp
Composer 安装命令:
composer require stimmt/craft-mcp
包简介
MCP (Model Context Protocol) server for Craft CMS
README 文档
README
Introduction
Craft MCP is an MCP (Model Context Protocol) server for Craft CMS. It gives AI assistants direct access to your installation's content, schema, and configuration: rather than describing your field layouts or Matrix setups by hand, the assistant queries them, writes reviewable draft content in a natural-key format, and inspects the system it is working in.
It ships more than 50 specialized tools, 10 analysis prompts, and 13 data resources, served over stdio for local development and over HTTP with scoped bearer tokens for remote users.
Quick Start
composer require stimmt/craft-mcp php craft plugin/install mcp
Enable the server in config/mcp.php (it is disabled in production by default):
<?php return [ 'enabled' => true, ];
Then run the interactive wizard to configure your MCP clients:
php craft mcp/install
That is the whole happy path. For manual client configuration (Claude Code, Cursor, Claude Desktop, SSH), see the Client Setup guide; for all options including tool disabling, IP allowlists, and environment defaults, see the Configuration guide.
Remote Access over HTTP
Content editors and office users can point Claude Desktop straight at a remote install: the plugin serves the MCP protocol from a Craft endpoint, authenticated with per-user bearer tokens scoped to readonly, content, or full access. Off by default; enabling it, minting tokens (php craft mcp/tokens/create), and troubleshooting are covered in the HTTP Transport guide.
Content Writing for Agents
Entry reads and writes share one payload format: relations as natural keys ({"section": "pages", "slug": "about"}), Matrix blocks by type handle, and per-field input shapes from describe_entry_schema that tell an agent exactly what every field accepts, third-party fields included. Writes land as reviewable drafts with a control panel deep link, and publish_entry makes them live. The full format, workflow, and schema discovery are covered in the Content Writing guide.
The Toolbox
| Category | Highlights |
|---|---|
| Content | Entries (payload-format read/write, draft workflow with a pending-drafts review queue, publish/duplicate/copy to site), schema discovery via describe_entry_schema, assets, categories, users, globals |
| System | System info, config, logs, caches, routes, console commands |
| Database | Schema inspection, table counts, read-only queries |
| Debugging | Queue jobs, project config diff, deprecations, EXPLAIN, event handlers, and a Tinker tool for executing PHP in the Craft context |
| Multi-Site | Sites, site groups, per-site details |
| GraphQL | Schemas, SDL, query execution, tokens |
| Backup | Create and list database backups |
| Self-Awareness | Plugin info, tool listing with risk annotations, hot reload |
| Commerce | Products, orders, and statuses (when Craft Commerce is installed) |
Tools that modify data or execute code are flagged dangerous: they sit behind the enableDangerousTools setting, carry a destructiveHint annotation in tools/list, and are excluded from readonly and (except entry workflow) content HTTP scopes. See the Tools Overview for the complete reference.
Extending
Other plugins and modules can register their own tools, prompts, resources, and field translators through events (EVENT_REGISTER_TOOLS, EVENT_REGISTER_FIELD_TRANSLATORS, and friends). See the Extending guide for implementation details and examples.
Documentation
The documentation index links everything; the direct routes:
- Installation - Requirements, Composer setup, detailed installation steps
- Client Setup - Wizard and manual configs for Claude Code, Cursor, Claude Desktop
- Configuration - All configuration options and security settings
- HTTP Transport - Remote access with per-user scoped bearer tokens
- Content Writing - The payload format, draft workflow, and schema discovery for agents
- Tools Reference - Complete documentation for every tool
- Prompts - Pre-built analysis prompts
- Resources - Read-only URI-based access to schema, config, and content data
- Extending - Register custom tools, prompts, resources, and field translators
Contributing
Thank you for considering contributing to Craft MCP! Please see GitHub Issues for bug reports, feature requests, and discussion.
Credits
- Created and maintained by Max van Essen
- Inspired by Laravel Boost
- Plugin icon from Lucide (MIT)
License
Craft MCP is open-sourced software licensed under the MIT license.
统计信息
- 总下载量: 2.03k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 27
- 点击次数: 8
- 依赖项目数: 1
- 推荐数: 1
其他信息
- 授权协议: MIT
- 更新时间: 2026-01-03