# magebitcom/magento2-mcp-report-tools

> Report-domain MCP tools for Magebit_Mcp (admin Reports menu + admin Dashboard + statistics refresh)

`composer require magebitcom/magento2-mcp-report-tools`

Canonical URL: https://packagento.com/magebitcom/magento2-mcp-report-tools

## At a glance

- **Vendor**: magebitcom (https://packagento.com/magebitcom.md)
- **Latest version**: v1.0.0 — released 2026-05-26
- **Pricing**: Free
- **Package type**: Magento 2 module
- **Status**: active, accepting new buyers

## Installation

Packagento is licence-gated, so even free packages need a licence on a project before Composer can resolve them.

1. **Sign in or create an account** at https://packagento.com/customer/account/.

2. **Add the package to your account.** Open https://packagento.com/magebitcom/magento2-mcp-report-tools and complete the free checkout. A licence is minted automatically.

3. **Create or pick a project, then activate the licence on it.**
   - Projects represent the Magento installs you deploy to. Manage them at https://packagento.com/projects/.
   - Activate the new licence on the project you'll deploy this package to. Activation is what generates the Composer credentials scoped to that project.

4. **Add the project credentials to your Magento codebase.**

   Grab the project's public + private key from https://packagento.com/projects/ (open the project, then its Credentials tab), and add them to `auth.json`:

   ```json
   {
     "http-basic": {
       "packagento.com": {
         "username": "ppk_live_...",
         "password": "psk_live_..."
       }
     }
   }
   ```

   Add the Packagento Composer repository to `composer.json`:

   ```json
   {
     "repositories": [
       { "type": "composer", "url": "https://packagento.com" }
     ]
   }
   ```

5. **Install and apply.**

   ```bash
   composer require magebitcom/magento2-mcp-report-tools:*
   bin/magento setup:upgrade
   bin/magento setup:di:compile
   bin/magento cache:flush
   ```

## What it does

Report-domain MCP tools for Magebit_Mcp (admin Reports menu + admin Dashboard + statistics refresh)

## README

This is a sub-module for the [Magento2 MCP module](https://github.com/magebitcom/magento2-mcp-module)

----

Report-domain MCP tools for `Magebit_Mcp`. Exposes the admin **Reports** menu
(sales, tax, customer, product, review, search-term, cart, newsletter), the
admin **Dashboard** summary, a **Customers Online** live view, and the
**Statistics** refresh machinery — all as MCP tools.

Each read tool is a thin wrapper over the same Magento collection or service
the admin grid uses, so row counts and totals match the admin UI exactly.
Statistics refresh tools dispatch the same aggregation models as
`Magento\Reports\Controller\Adminhtml\Report\Statistics\RefreshRecent` /
`RefreshLifetime`.

### Install

```bash
composer require magebitcom/magento2-mcp-report-tools
bin/magento module:enable Magebit_McpReportTools
bin/magento setup:upgrade
bin/magento setup:di:compile
bin/magento cache:flush
```

### Tool catalog

#### Shopping cart (live)

| Tool | What it does |
|---|---|
| `reports.cart.products` | Products currently sitting in open carts with quantities and carts count. |
| `reports.cart.abandoned` | Quotes that started checkout but were not converted. |

#### Marketing (live)

| Tool | What it does |
|---|---|
| `reports.marketing.search_terms` | Storefront search queries with popularity and number of matching products. |
| `reports.marketing.newsletter_problems` | Newsletter queue problem reports (bounces, send failures). |

#### Reviews (live)

| Tool | What it does |
|---|---|
| `reports.reviews.by_product` | Products ranked by review count with average rating. |
| `reports.reviews.by_customer` | Customers ranked by review count. |

#### Sales (aggregated)

All sales reports read from the `*_aggregated_created` / `*_aggregated_updated`
tables populated by `reports.statistics.refresh_*`. Arguments are shared:
`from`, `to`, `period` (day/month/year), `store_id?`, `show_empty?`,
`order_statuses?`.

| Tool | What it does |
|---|---|
| `reports.sales.orders` | Revenue / profit / quantity / tax / shipping / discount per period. |
| `reports.sales.tax` | Tax collected per rate, per period. |
| `reports.sales.invoiced` | Invoiced vs. paid vs. outstanding per period. |
| `reports.sales.shipping` | Shipping revenue per carrier / method / period. |
| `reports.sales.refunds` | Online and offline refunds per period. |
| `reports.sales.coupons` | Coupon usage and discount amount per rule / period. |

#### Customers

| Tool | What it does |
|---|---|
| `reports.customers.orders` | Order count per customer, date-ranged. |
| `reports.customers.totals` | Lifetime / period spend per customer. |
| `reports.customers.new` | Newly registered customer accounts per period. |
| `reports.customers.online` | Live snapshot of visitors (logged in or guest), with cart contents and last activity. |

#### Products

| Tool | What it does |
|---|---|
| `reports.products.viewed` | Most-viewed products, aggregated (daily/monthly/yearly). |
| `reports.products.bestsellers` | Bestselling products by quantity sold, aggregated. |
| `reports.products.low_stock` | Products at or below their notify-stock threshold. |
| `reports.products.ordered` | Quantity ordered per product within a date range. |
| `reports.products.downloads` | Downloadable-product link purchases and downloads. |

#### Dashboard

| Tool | What it does |
|---|---|
| `reports.dashboard.summary` | One-call roll-up that mirrors the admin Dashboard — lifetime sales, average order, revenue for a period, recent orders, top search terms, top bestsellers. |

#### Statistics refresh (write)

Write tools require the global `magebit_mcp/general/allow_writes` flag **and**
the token's own `allow_writes` flag to be `1`. Both refresh tools require
explicit confirmation so MCP clients prompt before firing.

| Tool | Confirm? | What it does |
|---|---|---|
| `reports.statistics.status` | no (read) | Last-refresh timestamp and flag state per aggregation code. |
| `reports.statistics.refresh_recent` | yes | Aggregates the last 25 hours (default) for the selected report codes. Mirrors admin *Refresh Statistics for Last Day*. |
| `reports.statistics.refresh_lifetime` | yes | Aggregates all time for the selected report codes. Mirrors admin *Refresh Lifetime Statistics*. **Heavy** — on stores with 500k+ orders this can take several minutes and will elevate DB load. Run off-peak. |

Both refresh tools also implement `Magebit\Mcp\Api\UnderlyingAclAwareInterface`
with `Magento_Reports::statistics` as the underlying Magento admin resource,
so they block calls from admins who wouldn't be allowed to refresh stats in
the admin UI.

### Extending

See `docs/EXTENDING.md` for:
- adding a new report tool that reuses the shared search-builder pattern;
- registering a new aggregation code with `AggregationRegistry` (e.g. a
  payment-module-specific settlement report);
- adding a field resolver to enrich an existing report row.

### License

Released under the [MIT License](LICENSE).

---

![magebit (1)](https://github.com/user-attachments/assets/cdc904ce-e839-40a0-a86f-792f7ab7961f)

*Have questions or need help? Contact us at info@magebit.com*

## Recent Versions

| Version | Released |
|---|---|
| v1.0.0 | 2026-05-26 |
| v0.0.2 | 2026-05-11 |
| v0.0.1 | 2026-05-06 |

## Dependencies

### Require

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

## Quality

Latest release (v1.0.0) fails the Packagento QA pipeline. Verdicts below are per-cell (Magento line × PHP version) for the matrixed tools, and run-once for the static / security tiers.


### Compatibility

Each Magento line is installed on its supported PHP versions, then the module is built (DI compile + static-content deploy). Cells show passed / failed / untested; staircase gaps render as `–`.

| 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. Never affect the Compatibility verdict — 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.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| PHPCS | Warning | 30 | 30 warnings (ruleset: Magento2) — 13 auto-fixable with phpcbf |
| PHPMD | Warning | 9 | 9 rule violations (MissingImport:4, TooManyPublicMethods:2, ExcessiveClassComplexity:1, CyclomaticComplexity:1, NPathComplexity:1) |
| Cpd | Warning | 2 | 2 duplicated chunks spanning 43 total lines (min-lines=5, min-tokens=70) |
| Composer validate | Info | 1 | valid; 1 advisory note (composer validate --strict) |

#### PHPStan

Type-checks the module against a real Magento install. Re-runs per Magento + PHP version because resolvable symbols differ between releases.

| 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 per Magento + PHP cell. Test failures speak to the module's behaviour, not its compatibility with a line, so they're reported here separately.

#### Unit Tests

| 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

| 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

Dependency-advisory audit (composer audit) plus a source malware scan. A malware detection fails the version outright.

| Tool | Status | Findings | Summary |
|---|---|---|---|
| Composer audit | Pass | 0 |  |
| Malware scan | Pass | 0 |  |

## Licence and pricing

Free. A licence is still minted on checkout and bound to your project for Composer access — no payment step.

Refundable within 14 days of first purchase via https://packagento.com/account/refunds/.

## Install via Claude Code or any MCP client

The Packagento MCP server can run the licence + project + Composer steps above in one tool call:

```
purchase_and_install_packages(
  composer_names=["magebitcom/magento2-mcp-report-tools"],
  project_id="proj_xxx"
)
```

This handles cart, checkout, licence minting, project activation, and writes auth.json credentials. Connect a client with `claude mcp add packagento https://mcp.packagento.com`. Full setup at https://packagento.com/docs/mcp-setup.

## Vendor

magebitcom is a Magento 2 vendor on Packagento. See https://packagento.com/magebitcom.md for their full catalogue.

