magector 2.13.1 → 2.13.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -10
- package/package.json +5 -5
- package/src/mcp-server.js +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
**Technology-aware MCP server for Magento 2 and Adobe Commerce with intelligent indexing and search.**
|
|
4
4
|
|
|
5
|
-
Magector is a Model Context Protocol (MCP) server that deeply understands Magento 2 and Adobe Commerce. It builds a semantic vector index of your entire codebase — 18,000+ files across hundreds of modules — and exposes
|
|
5
|
+
Magector is a Model Context Protocol (MCP) server that deeply understands Magento 2 and Adobe Commerce. It builds a semantic vector index of your entire codebase — 18,000+ files across hundreds of modules — and exposes 45 tools that let AI assistants search, navigate, and understand the code with domain-specific intelligence. Instead of grepping for keywords, your AI asks *"how are checkout totals calculated?"* and gets ranked, relevant results in under 50ms, enriched with Magento pattern detection (plugins, observers, controllers, DI preferences, layout XML, and 20+ more).
|
|
6
6
|
|
|
7
7
|
[](https://www.rust-lang.org)
|
|
8
|
-
[](https://nodejs.org)
|
|
9
9
|
[](https://magento.com)
|
|
10
10
|
[](https://business.adobe.com/products/magento/magento-commerce.html)
|
|
11
11
|
[](#validation)
|
|
@@ -58,7 +58,7 @@ The result: your AI assistant calls one MCP tool and gets ranked, pattern-enrich
|
|
|
58
58
|
- **Complexity analysis** -- cyclomatic complexity, function count, and hotspot detection across modules
|
|
59
59
|
- **Fast** -- 10-45ms queries via persistent serve process, batched ONNX embedding with adaptive thread scaling
|
|
60
60
|
- **LLM description enrichment** -- generate natural-language descriptions of di.xml files using Claude, stored in SQLite, and prepend them to embedding text so descriptions influence vector search ranking (not just post-retrieval display)
|
|
61
|
-
- **MCP server** --
|
|
61
|
+
- **MCP server** -- 45 tools integrating with Claude Code, Cursor, and any MCP-compatible AI tool
|
|
62
62
|
- **Clean architecture** -- Rust core handles all indexing/search, Node.js MCP server delegates to it
|
|
63
63
|
|
|
64
64
|
---
|
|
@@ -70,7 +70,7 @@ flowchart LR
|
|
|
70
70
|
subgraph node ["Node.js Layer"]
|
|
71
71
|
direction TB
|
|
72
72
|
G["CLI<br/>init · index · search · describe"]
|
|
73
|
-
E["MCP Server<br/>
|
|
73
|
+
E["MCP Server<br/>45 tools · LRU cache"]
|
|
74
74
|
F["Persistent Serve Process"]
|
|
75
75
|
G --> F
|
|
76
76
|
E --> F
|
|
@@ -129,7 +129,8 @@ flowchart LR
|
|
|
129
129
|
| JS parsing | `tree-sitter-javascript` | AMD/ES6 module detection |
|
|
130
130
|
| Pattern detection | Custom Rust | 20+ Magento-specific patterns |
|
|
131
131
|
| CLI | `clap` | Command-line interface (index, search, serve, validate) |
|
|
132
|
-
| Descriptions | `rusqlite` (bundled SQLite) | LLM-generated di.xml descriptions stored in
|
|
132
|
+
| Descriptions | `rusqlite` (bundled SQLite) | LLM-generated di.xml descriptions stored in `.magector/sqlite.db`, prepended to embeddings |
|
|
133
|
+
| Null-safety index | `node:sqlite` (Node.js 22.5+ built-in) | Method-chain enrichment index in `.magector/enrichment.db` — O(1) null-risk queries |
|
|
133
134
|
| SONA | Custom Rust | Feedback learning with MicroLoRA + EWC++ |
|
|
134
135
|
| MCP server | `@modelcontextprotocol/sdk` | AI tool integration with structured JSON output |
|
|
135
136
|
|
|
@@ -139,7 +140,8 @@ flowchart LR
|
|
|
139
140
|
|
|
140
141
|
### Prerequisites
|
|
141
142
|
|
|
142
|
-
- [Node.js
|
|
143
|
+
- [Node.js 22.5+](https://nodejs.org) — required for built-in `node:sqlite` (used by `magento_enrich` / `magento_find_null_risks`)
|
|
144
|
+
- [semgrep](https://semgrep.dev) (optional) — required for `magento_ast_search`: `pip install semgrep`
|
|
143
145
|
|
|
144
146
|
### 1. Initialize in Your Project
|
|
145
147
|
|
|
@@ -369,7 +371,7 @@ npx magector index --force
|
|
|
369
371
|
|
|
370
372
|
## MCP Server Tools
|
|
371
373
|
|
|
372
|
-
The MCP server exposes
|
|
374
|
+
The MCP server exposes 45 tools for AI-assisted Magento 2 and Adobe Commerce development. All search tools return **structured JSON** with file paths, class names, methods, role badges, and content snippets -- enabling AI clients to parse results programmatically and minimize file-read round-trips.
|
|
373
375
|
|
|
374
376
|
### Output Format
|
|
375
377
|
|
|
@@ -470,9 +472,23 @@ Auto-detects entry type from pattern (`/V1/...` → API, `snake_case` → event,
|
|
|
470
472
|
| Tool | Description |
|
|
471
473
|
|------|-------------|
|
|
472
474
|
| `magento_module_structure` | Show complete module structure -- controllers, models, blocks, plugins, observers, configs |
|
|
473
|
-
| `magento_index` | Trigger re-indexing of the codebase |
|
|
474
|
-
| `magento_describe` | Generate LLM descriptions for di.xml files (requires `ANTHROPIC_API_KEY`), stored in
|
|
475
|
+
| `magento_index` | Trigger re-indexing of the codebase (also kicks off background enrichment) |
|
|
476
|
+
| `magento_describe` | Generate LLM descriptions for di.xml files (requires `ANTHROPIC_API_KEY`), stored in `.magector/sqlite.db`, auto-reindexes affected files |
|
|
475
477
|
| `magento_stats` | View index statistics |
|
|
478
|
+
| `magento_batch` | Execute multiple tool queries in parallel in one MCP roundtrip. Supports all search, find, grep, read, and null-risk tools. Use to avoid N×3-5s roundtrip overhead. |
|
|
479
|
+
| `magento_grep` | Exact text/regex search across PHP/XML/PHTML files (`grep -rn -E` internally). Supports `filesOnly` mode (like `grep -l`), `context` lines, `ignoreCase`, `include` patterns. **(v2.9)** |
|
|
480
|
+
| `magento_read` | Read a specific file with optional `methodName` extraction (~10× fewer tokens than reading the whole file) and `startLine`/`endLine` range. **(v2.10)** |
|
|
481
|
+
| `magento_trace_api` | Trace REST/GraphQL API endpoint from URL to implementation: webapi.xml → service interface → DI preference → method body. One call replaces 4-5 grep+read steps. **(v2.11)** |
|
|
482
|
+
| `magento_find_trigger` | Find database triggers across the codebase |
|
|
483
|
+
| `magento_find_table_usage` | Find all PHP code referencing a specific database table |
|
|
484
|
+
|
|
485
|
+
### Null-Safety Analysis (v2.12–v2.13)
|
|
486
|
+
|
|
487
|
+
| Tool | Description |
|
|
488
|
+
|------|-------------|
|
|
489
|
+
| `magento_ast_search` | Structural PHP code search using [semgrep](https://semgrep.dev). Understands PHP AST — matches by structure regardless of variable names, ignores comments/strings. Pattern syntax: `$X` = any expression, `$Y` = any identifier, `...` = any args. Example: `$X->getPayment()->$Y(...)`. Requires `semgrep`. **(v2.12)** |
|
|
490
|
+
| `magento_enrich` | Build the method-chain enrichment index. Scans all `vendor/` PHP files for `->firstMethod()->secondMethod()` chains and detects null guards in surrounding code. Stores results in `.magector/enrichment.db` (SQLite, `node:sqlite`). Runs automatically after `magento_index`. **(v2.13)** |
|
|
491
|
+
| `magento_find_null_risks` | Query the enrichment index for method chains without null guards. O(1) SQLite query instead of file scanning. Pass `firstMethod` to filter (e.g., `"getPayment"` → all `->getPayment()->anything()` without null guard). Requires `magento_enrich`. **(v2.13)** |
|
|
476
492
|
|
|
477
493
|
### Search Enhancements (v2.1)
|
|
478
494
|
|
|
@@ -656,7 +672,7 @@ cd rust-core && cargo run --release -- validate -m ./magento2 --skip-index
|
|
|
656
672
|
magector/
|
|
657
673
|
├── src/ # Node.js source
|
|
658
674
|
│ ├── cli.js # CLI entry point (npx magector <command>)
|
|
659
|
-
│ ├── mcp-server.js # MCP server (
|
|
675
|
+
│ ├── mcp-server.js # MCP server (45 tools, structured JSON output)
|
|
660
676
|
│ ├── binary.js # Platform binary resolver
|
|
661
677
|
│ ├── model.js # ONNX model resolver/downloader
|
|
662
678
|
│ ├── init.js # Full init command (index + IDE config)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magector",
|
|
3
|
-
"version": "2.13.
|
|
3
|
+
"version": "2.13.3",
|
|
4
4
|
"description": "Semantic code search for Magento 2 — index, search, MCP server",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/mcp-server.js",
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"ruvector": "^0.1.96"
|
|
34
34
|
},
|
|
35
35
|
"optionalDependencies": {
|
|
36
|
-
"@magector/cli-darwin-arm64": "2.13.
|
|
37
|
-
"@magector/cli-linux-x64": "2.13.
|
|
38
|
-
"@magector/cli-linux-arm64": "2.13.
|
|
39
|
-
"@magector/cli-win32-x64": "2.13.
|
|
36
|
+
"@magector/cli-darwin-arm64": "2.13.3",
|
|
37
|
+
"@magector/cli-linux-x64": "2.13.3",
|
|
38
|
+
"@magector/cli-linux-arm64": "2.13.3",
|
|
39
|
+
"@magector/cli-win32-x64": "2.13.3"
|
|
40
40
|
},
|
|
41
41
|
"keywords": [
|
|
42
42
|
"magento",
|
package/src/mcp-server.js
CHANGED
|
@@ -1900,7 +1900,7 @@ const ERROR_PATTERNS = [
|
|
|
1900
1900
|
'',
|
|
1901
1901
|
'**2. Condition threshold mismatch**',
|
|
1902
1902
|
' Check which subtotal attribute the condition uses: base_subtotal, subtotal_incl_tax,',
|
|
1903
|
-
'
|
|
1903
|
+
' custom_free_shipping_price (custom). Each calculates differently (with/without tax, discounts).',
|
|
1904
1904
|
'',
|
|
1905
1905
|
'**3. Custom condition type**',
|
|
1906
1906
|
' Container attributes (SubtotalWithDiscountInclTax) aggregate per shop type.',
|