magebitcom / magento2-mcp-marketing-tools

magebitcom/magento2-mcp-marketing-tools

Promotion-domain MCP tools for Magebit_Mcp (catalog rules, cart price rules, coupons)

magento2-module Compatibility: 2.4.7-2.4.9 Code Quality: Fail Tests: N/A Security: Pass MIT

Magento2 MCP - Marketing Tools

This is a sub-module for the Magento2 MCP module


Promotion-domain MCP tools for Magebit_Mcp. Reads and toggles catalog
price rules
and cart price rules, and manages coupon supply for
cart rules — all as MCP tools.

Each tool is a thin wrapper over a Magento service contract
(CatalogRuleRepositoryInterface, SalesRule\RuleRepositoryInterface,
CouponRepositoryInterface, CouponManagementInterface) and composes its
read responses from field resolvers that 3rd-party modules can extend.

Install

composer require magebitcom/magento2-mcp-marketing-tools
bin/magento module:enable Magebit_McpMarketingTools
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush

Tool catalog

Catalog rules (read)

Tool What it does
marketing.catalog_rule.list Paginated catalog-rule search; filter by name, is_active, customer_group_id, website_id, from_date_after, to_date_before.
marketing.catalog_rule.get Single catalog rule by id with full detail (identity, scope, schedule, conditions, action, lifecycle).

Cart rules (read)

Tool What it does
marketing.cart_rule.list Paginated cart-rule search; filter by name, is_active, coupon_type, customer_group_id, website_id, date range.
marketing.cart_rule.get Single cart rule by id including the full condition and action_condition trees as JSON.

Coupons (read)

Tool What it does
marketing.cart_rule.coupon.list Paginated coupon search; filter by rule_id, code substring, type (MANUAL/GENERATED), is_primary, created_after.
marketing.cart_rule.coupon.get Single coupon by id.

Catalog rules (write)

Write tools require the global magebit_mcp/general/allow_writes flag and
the token's own allow_writes flag to be 1. Destructive operations
additionally set the requires_confirmation hint so MCP clients prompt
before firing.

Tool Confirm? What it does
marketing.catalog_rule.set_active no Toggles is_active on the rule; storefront prices update on the next catalogrule_rule reindex.
marketing.catalog_rule.delete yes Permanently deletes a catalog rule.
marketing.catalog_rule.apply_all yes Invalidates catalogrule_rule so the next reindex pass rebuilds the catalogrule_product_* aggregation tables. Heavy on realtime indexers — run off-peak.

Cart rules (write)

Tool Confirm? What it does
marketing.cart_rule.set_active no Toggles is_active on the rule. Disabling immediately stops it applying to new carts; existing orders are unaffected.
marketing.cart_rule.delete yes Permanently deletes a cart rule and cascade-deletes its coupons via FK. Existing orders are unaffected.

Coupons (write)

Tool Confirm? What it does
marketing.cart_rule.coupon.generate yes Bulk-generates coupon codes for a cart rule. The rule must have coupon_type = SPECIFIC_COUPON and use_auto_generation = true.
marketing.cart_rule.coupon.delete yes Bulk-deletes coupons by id list or code list. Existing orders that previously used a deleted code are unaffected.

Every write tool also implements Magebit\Mcp\Api\UnderlyingAclAwareInterface
so the handler blocks calls from admins who wouldn't be allowed to perform
the same action in the admin UI.

Extending

See docs/EXTENDING.md for:

  • adding a new field to any tool response via *FieldResolverInterface;
  • adding a new filter to a list tool via *FilterTranslatorInterface;
  • the ACL layering rules for custom write tools.

License

Released under the MIT License.


magebit (1)

Have questions or need help? Contact us at [email protected]

No changelog yet

The vendor hasn't published a changelog. Tagged releases appear in the Versions tab.

Versions
Version Stability QA Status Compatibility Released
v1.0.0 stable Fail Magento 2.4.7-2.4.9 Details 2026-05-27 08:00:59
v0.0.1 stable Not tested Not yet tested Details 2026-05-06 11:12:44

Requires 3

Package Constraint
magebitcom/magento2-mcp-module *
magento/framework ^103.0
php >=8.1

Compatibility

Each Magento release line is installed on its supported PHP versions, then the module is built (DI compilation + static-content deploy) and its unit and integration suites are run. The matrix shows the lines and PHP versions the module is confirmed to install and run on. Code-quality results further down (phpstan, phpcs, …) are reported separately and never affect compatibility.

Compatibility matrix (Magento × PHP)
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 Pass Pass
2.4.8 Pass Pass
2.4.9 Pass Pass

Code Quality

Advisory checks against the module's source. Static analysis runs once across the whole module; PHPStan re-runs per Magento + PHP version because resolvable symbols differ between releases. These NEVER affect the Compatibility badge — a phpcs finding can't make a module incompatible.

Static analysis

Coding standards (phpcs), mess detection (phpmd), copy-pasted code (cpd), PHP cross-version compatibility, composer.json validity. Each runs once for the whole module.

Static analysis results
Tool Status Findings Summary
PHPCS Warning 8 8 warnings (ruleset: Magento2) — 5 auto-fixable with phpcbf
PHPMD Warning 6 6 rule violations (CyclomaticComplexity:4, NPathComplexity:2)
Cpd Warning 2 2 duplicated chunks spanning 77 total lines (min-lines=5, min-tokens=70)
Composer validate Info 1 valid; 1 advisory note (composer validate --strict)

PHPStan

Type-checks the module's PHP against a real Magento install at the configured gate level. Re-runs per Magento and PHP version because resolvable symbols differ between releases. Cell → details modal.

PHPStan results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 11 11
2.4.8 12 12
2.4.9 12 12

Tests

Unit and integration suites, run for each applicable Magento and PHP version. A test failure speaks to the module's behaviour, not its compatibility with a Magento line, so it is reported here separately and never reddens the compatibility matrix.

Unit tests

Unit tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Integration tests

Integration tests results by Magento and PHP version
Magento PHP 8.2 PHP 8.3 PHP 8.4 PHP 8.5
2.4.7 N/A N/A
2.4.8 N/A N/A
2.4.9 N/A N/A

Security

Security checks run directly against the module: an audit of its declared dependencies for known vulnerabilities (composer audit) and a scan of its source for malware and web-shell signatures. Each runs once. A malware detection fails the version outright.

Security results
Tool Status Findings Summary
Composer audit Pass 0
Malware scan Pass 0
License
MIT

More from magebitcom

View vendor
Make it pay

Turn an existing module into recurring revenue.

If you already maintain a Magento 2 module on GitHub or GitLab, listing it on Packagento takes about five minutes. We mirror your tags, handle distribution signing, and route paid licenses through Stripe Connect, so you can keep shipping the way you already do.