iqual/icms_mcp
Composer 安装命令:
composer require iqual/icms_mcp
包简介
Drupal MCP tools for AI-powered, transactional ICMS content migration and import.
README 文档
README
Custom MCP plugin that exposes ICMS-specific tools to MCP clients (in our
case, the iqual drupal-bridge ADK agent on Cloud Run).
What it ships
Four tools. On the wire the names become icms-mcp_<sanitized-tool-name>
(drupal/mcp prepends the plugin id and _; note the hyphen — see
"Plugin ID gotcha" below):
| Tool (wire name) | Purpose |
|---|---|
icms-mcp_get_icms_catalog |
Live nodeTypes / paragraphTypes / allowedParagraphBundles introspected from this site. |
icms-mcp_validate_pivot |
Drupal-side validation of an icms-drupal-import-handoff-v1 pivot. |
icms-mcp_import_pivot |
Transactional create/update of node + paragraphs. Honours strategy and HITL gate. |
icms-mcp_lookup_existing_node |
Idempotency lookup by canonical source URL (matches against the configured source-key field). |
Plugin ID gotcha
drupal/mcp's McpPluginManager::getAvailablePlugins() enforces
/^[a-zA-Z0-9-]+$/ on plugin IDs — underscores are forbidden. That's
why the #[Mcp] attribute uses id: 'icms-mcp' (hyphen) even though the
module name is icms_mcp (underscore, as Drupal requires). If you ever see
tools/list silently drop your plugin, check
/admin/reports/dblog for InvalidArgumentException: "Plugin ID must be made of letters, numbers, and hyphens".
Wire perf gotcha
drupal/mcp's bundled drush MCP plugin exposes ~230 tools and each one
runs an access check that costs ~300–700ms in DDEV, which makes
tools/list time out (~4 min wall-clock). Disable plugins you don't need:
ddev drush php:eval '$c=\Drupal::configFactory()->getEditable("mcp.settings"); $p=$c->get("plugins"); foreach (["drush","content","aif","jsonapi","tools","aia"] as $k) { $p[$k]["enabled"]=false; } $c->set("plugins",$p)->save();'
ddev drush cr
Behaviour summary
- Validation runs on every import.
import_pivotcallsvalidate_pivotfirst and refuses to write a contract with any issues. - HITL gate. If
metadata.review_decision == "review_required", the import returnsstatus: pending_reviewunless the caller passesapprove: true.review_decision == "blocked"always refuses. - Strategies (
metadata.strategy):skip→ if a node with the sameidempotence_keyexists, returnstatus: skippedwithout writing.update/skip-or-update→ load and rewrite the existing node, replacing its paragraph children (old paragraphs are deleted after the node save commits, so a failure leaves the previous content intact).fail-if-exists→ returnsstatus: conflictif a node with the sameidempotence_keyalready exists.
- Transactional. All writes run inside a
database->startTransaction(). Any throw inside the write path triggers arollBack()and surfaces asstatus: error. - Audit journal. Every outcome (
created/updated/skipped/conflict/error) is logged to theicms_mcplogger channel withidempotence_key,batch_id,run_idin the context so you can correlate in/admin/reports/dblog. - Private pivot log. Every payload received by
validate_pivotorimport_pivotis saved as formatted JSON underprivate://icms_mcp/pivots. The resulting URI is returned aspivot_log_uri. Disable this diagnostic log withdrush state:set icms_mcp.log_pivots 0.
Prerequisites on the target site
Two field machine names are configurable via state (defaults shown):
| State key | Default | Purpose |
|---|---|---|
icms_mcp.source_key_field |
field_icms_source_key |
Plain string field (max 512) on icms_page storing the agent's idempotence_key. |
icms_mcp.layouts_field |
field_icms_paragraphs |
entity_reference_revisions field on icms_page that holds layout paragraphs. |
This module does not auto-create those fields — fields are part of your site configuration. If the defaults don't match your install:
ddev drush state:set icms_mcp.source_key_field field_my_source_key ddev drush state:set icms_mcp.layouts_field field_my_paragraphs
validate_pivot and get_icms_catalog both surface a clear error when
either field is missing, so misconfiguration is caught before the first
import attempt.
Install
Requires drupal/mcp ^1.0.
ddev composer require 'iqual/icms_mcp'
ddev drush en icms_mcp -y
Configure
/admin/config/mcp— enable token auth and theicms-mcpplugin (hyphen, not underscore — see "Plugin ID gotcha" above).- Create a dedicated Drupal user for the agent. Grant only the
Use MCP serverpermission (from drupal/mcp) and theUse ICMS MCP toolspermission (from this module). No other roles.
Why a plugin and not a custom REST/JSON:API endpoint?
Reuse + provenance. Every MCP-enabled client (Claude Desktop / Cursor / the
ADK McpToolset) discovers the tools automatically, the auth + RBAC layer
comes from drupal/mcp, and we get the streamable-HTTP transport, schema
validation, and permission gating for free.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-19