craft-mcp
Skill90 starsChanged 4 months agoMITView on GitHub
Craft CMS 5.12+ MCP servers, OAuth server and personal access tokens: authenticated, public and stdio (mcp/serve) servers, mcp:read/write/admin levels, Settings → MCP, config/mcp.php and config/oauth.php, oauth/generate-keys and CRAFT_OAUTH_PRIVATE_KEY/PUBLIC_KEY on DDEV, production, Cloud, Servd and fortrabbit, connecting Claude Code or another client, the snake_case tool catalogue, and plugin MCP tools, field interfaces and OAuth resources.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- phntm7/skillstheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- phntm7/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository18 other files it gives its agents.
- docs/agents.mdAGENTS.md
- project-template/CLAUDE.mdCLAUDE.md
- reference/CLAUDE.mdCLAUDE.md
- craft-cloudSkill
- craftcmsSkill
- craft-content-modelingSkill
- craft-fortrabbitSkill
- craft-garnishSkill
- craft-gated-buildSkill
- craft-pestSkill
- craft-php-guidelinesSkill
- craft-plugin-releaseSkill
- craft-pluginsSkill
- craft-project-setupSkill
- craft-siteSkill
- craft-twig-guidelinesSkill
- ddevSkill
- servdSkill
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 28
craft-content-modeling: When an MCP client is used to author sections, fields or entry types (project config workflow still applies).
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Craft MCP, OAuth Server and Personal Access Tokens
Craft Version of This Project
!sh ${CLAUDE_SKILL_DIR}/scripts/craft-version.sh
If no Craft version line appears above, establish the version before any version-specific advice: craftcms/cms in composer.lock for a site, the lowest version the craftcms/cms constraint in composer.json allows for a plugin, or ask. Then check it against the version tags in this skill ([5.12+], [5.12.1+], [changed 5.12.1]).
MCP Needs Craft 5.12 [5.12+]
Everything in this skill is new in Craft 5.12 (2026-11-03). On 5.11 or older there is no MCP server, OAuth server or Tokens screen in core. Before 5.12: upgrade first (ddev composer require craftcms/cms:^5.12.4 -W, then ddev craft up, commit composer.lock and config/project/; checklist: the craftcms skill's upgrade-5.12.md). Target 5.12.4 or later, not 5.12.0: 5.12.1 renamed every tool to snake_case and 5.12.1 through 5.12.3 fixed several security issues (see references/security.md). [5.12+]
Source of truth: Craft's CHANGELOG and the 5.12.4 source (src/mcp/, src/services/Mcp.php, src/services/OAuth.php, src/controllers/McpController.php, src/controllers/OauthController.php). Craft's own docs pages still show the pre-5.12.1 dot-separated tool names; the source wins. [5.12+]
Companion Skills: Load When Needed
craftcms: Plugin or module PHP around an MCP capability (services, permissions, controllers), GraphQL OAuth details inreferences/graphql.md, config files inreferences/config-*.md.craft-php-guidelines: Whenever you write the PHP for an MCP tool, field interface or OAuth resource.ddev: Local environment; the stdio server runs throughddev craft.craft-cloud,servd,craft-fortrabbit: host-specific env var and filesystem handling for the signing keys.craft-content-modeling: When an MCP client is used to author sections, fields or entry types (project config workflow still applies).
Documentation
- MCP: https://craftcms.com/docs/5.x/system/mcp.html
- Extending MCP: https://craftcms.com/docs/5.x/extend/mcp.html
- OAuth and personal access tokens: https://craftcms.com/docs/5.x/system/oauth.html
- Source: https://github.com/craftcms/cms/tree/5.12.4/src/mcp
The Three Servers at a Glance [5.12+]
| Server | Transport | Who it acts as | Default endpoint | Default state |
| Authenticated | Streamable HTTP | The user who authorized the client via OAuth, capped by the access level they chose | /{cpTrigger}/mcp + /{cpTrigger}/mcp/auth; /mcp + /mcp/auth when public registration is on or cpTrigger is empty | Off |
| Public | Streamable HTTP | Nobody; only capabilities and content approved in Settings → MCP | /mcp | Off |
| stdio | craft mcp/serve --user=<id|username|email> | The named user, no access-level cap | n/a | Always available, ignores both switches |
Clients connect to the authorization endpoint (…/mcp/auth). Settings live in project config under mcp; saving Settings → MCP needs an admin and allowAdminChanges. Details: references/servers-and-access.md.
Quick Recipe: Claude Code on a Local DDEV Site [5.12+]
ddev craft oauth/generate-keys # once per checkout; writes storage/oauth-*.key
# CP → Settings → MCP → enable the authenticated server, save, commit config/project/
claude mcp add --transport http my-site https://my-site.ddev.site/admin/mcp/auth
# in Claude Code: /mcp → authenticate → browser: CP login, pick Read only / Read and write / Full accessddev share hosts are rejected (403 "Invalid Host header") unless they are also a site base URL. A personal access token cannot carry MCP scopes; use OAuth or stdio. Full recipes (stdio, TLS trust, production, Cloud/Servd/fortrabbit): references/client-setup.md.
Common Pitfalls (Cross-Cutting)
- Recommending MCP on a pre-5.12 site. There is nothing to enable. Give the upgrade path above.
- Dotted tool names. Since 5.12.1 core tools are snake_case (
elements_list, not the old dot-separated form) and plugin tools should be too, prefixed with the plugin handle:my_plugin_orders_list. Some clients reject dots. [changed 5.12.1] - Pointing a client at
/admin/mcpinstead of/admin/mcp/auth. Use the authorization endpoint; opening either in a browser shows copy-paste setup snippets. - Using a personal access token for MCP. The
mcpscope group offers no grantable scopes, socreate()throws "Invalid scopes" even for admins, and a GraphQL PAT sent to the MCP endpoint gets a 401. PATs are for GraphQL and plugin APIs. Seereferences/personal-access-tokens.md. - Keys in
storage/on an ephemeral or load-balanced host. SetCRAFT_OAUTH_PRIVATE_KEYandCRAFT_OAUTH_PUBLIC_KEYinstead (multiline PEM, or newlines replaced by spaces; never stripped whitespace or literal\n). Seereferences/oauth-server.md. - Rotating
securityKey. It derives the OAuth encryption key: refresh tokens and pending auth codes die, every client must authorize again. Regenerating the RSA keys kills access tokens only. - Expecting schema tools on production. Tools marked
RequiresAdminChanges(configuration writes, plugin install, project config apply/write, field layout updates, group permissions) disappear whenallowAdminChangesis off. Make schema changes in dev and deploy project config. - Treating stdio as scoped.
mcp/serveskips the enable switches and OAuth access levels and gets everything the named user can do. Run it as a least-privileged user. [5.12+] - Stopping at the first page of
tools/list. Over stdio as an admin, 5.12.4 returns 69 tools in two pages (50 + cursor);elements_*are on page 2. [5.12+] - A plugin tool without
readOnlyHint: true. It then requiresmcp:writeand is hidden from Read-only clients. A duplicate tool name throws aLogicExceptionthat breaks discovery for every user. Seereferences/plugin-extension.md. - Leaving
redirectDomainsat['*']on production. Restrict it to the clients you expect, keepinghttp://localhostfor local desktop clients. Seereferences/security.md.
Reference Files
Task examples:
- "Connect Claude Code to my Craft site over MCP" →
client-setup.md - "Expose our blog to any AI agent without login" →
servers-and-access.md+security.md - "Deploy MCP to Craft Cloud / Servd / fortrabbit" →
client-setup.md+oauth-server.md - "Why does MCP return 401 / 404 / 403?" →
client-setup.md(troubleshooting) - "Which tools can the client use, and why is X missing?" →
tool-catalogue.md - "Let a script call GraphQL as an editor" →
personal-access-tokens.md - "Register an MCP tool from my plugin" →
plugin-extension.md - "Make my custom field work with MCP" →
plugin-extension.md - "Protect my plugin's API with Craft's OAuth server" →
plugin-extension.md+oauth-server.md - "Rate-limit the MCP endpoint" →
servers-and-access.md(filters) +security.md
| Reference | Scope | ~Lines |
references/servers-and-access.md | The three servers, routing and endpoints, access levels and gating attributes, Settings → MCP and public approvals, config/mcp.php (instructions, filters), sessions, discovery | ~135 |
references/oauth-server.md | Signing keys and the generate command, env vars, config/oauth.php keys, endpoints and metadata, dynamic client registration, lifetimes, rotation, revocation, rate limits | ~130 |
references/personal-access-tokens.md | Tokens screen and its gating, elevated session, expirations, scopes, using a PAT with GraphQL, programmatic creation | ~75 |
references/client-setup.md | Claude Code over HTTP on DDEV, TLS trust, stdio via ddev craft mcp/serve, production checklist, Craft Cloud / Servd / fortrabbit keys, troubleshooting [5.12+] | ~100 |
references/tool-catalogue.md | Every tool, resource and prompt in 5.12.4 with its scope and gating, upload tools, permission tools, expectedRevision [5.12+] | ~170 |
references/plugin-extension.md | Registering capabilities, attribute signatures, naming, scopes, hiding per user, InputSchemaFieldInterface, McpOutputFieldInterface, OAuth resources, PAT scope groups, other hooks [5.12+] | ~270 |
references/security.md | What each server exposes, production hardening, rate limits, redirectDomains, revocation, the 5.12.x advisories [5.12+] | ~75 |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

