Skip to content

Commit bf59c16

Browse files
Merge pull request #19 from suraj-webkul/mcp-docs
add mcp and refactor.
2 parents e7b6c55 + adf01bf commit bf59c16

3 files changed

Lines changed: 256 additions & 1 deletion

File tree

.vitepress/routes/master.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const routes = [
1919
{ text: 'Requirements', link: '/master/installation/requirements' },
2020
{ text: 'Installation', link: '/master/installation/installation' },
2121
{ text: 'Docker', link: '/master/installation/docker' },
22-
{ text: 'Skills', link: '/master/installation/skills' }
2322
]
2423
},
2524
{
@@ -141,6 +140,20 @@ const routes = [
141140
}
142141
]
143142
},
143+
{
144+
text: 'AI Agents',
145+
collapsed: false,
146+
items: [
147+
{
148+
text: 'Agent Skills',
149+
link: '/master/ai/skills'
150+
},
151+
{
152+
text: 'MCP Plugin',
153+
link: '/master/ai/mcp'
154+
},
155+
]
156+
},
144157
{
145158
text: 'Digging Deeper',
146159
collapsed: false,

src/master/ai/mcp.md

Lines changed: 242 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,242 @@
1+
# AureusERP MCP Plugin
2+
3+
This plugin adds MCP servers to AureusERP so AI clients (MCP Inspector, coding agents, ERP assistants) can use ERP tools securely.
4+
5+
## What this plugin provides
6+
7+
Two MCP servers are exposed:
8+
9+
### Dev Agent Server
10+
11+
| Transport | Endpoint / Command | Auth |
12+
|---|---|---|
13+
| **stdio** (artisan) | `php artisan mcp:dev` | None — local process |
14+
| **HTTP** | `POST /mcp/dev` | OAuth Bearer token |
15+
16+
Use the stdio transport for local AI coding agents (Cursor, Claude Code, GitHub Copilot, etc.) via `.mcp.json`. Use the HTTP transport for remote or OAuth-authenticated clients.
17+
18+
Tools: documentation search, plugin introspection, route discovery, model inspection, Filament resource listing, API resource discovery.
19+
20+
### ERP Agent Server
21+
22+
| Transport | Endpoint | Auth |
23+
|---|---|---|
24+
| **HTTP** | `POST /mcp/erp` | OAuth Bearer token |
25+
26+
READ-ONLY business insights (34 tools across Sales, Purchases, Invoices, Accounting, Inventory, Projects). No stdio transport — this server requires authentication.
27+
28+
OAuth discovery + registration endpoints are also exposed (via `Mcp::oauthRoutes()`):
29+
30+
- `GET /.well-known/oauth-protected-resource/{path?}`
31+
- `GET /.well-known/oauth-authorization-server/{path?}`
32+
- `POST /oauth/register`
33+
34+
## Requirements
35+
36+
- PHP `^8.2`
37+
- Laravel `^11`
38+
- Filament `^4`
39+
- `laravel/mcp` `^0.5`
40+
- `laravel/passport` `^12`
41+
- AureusERP plugin manager
42+
43+
## Install
44+
45+
First, require the package via Composer:
46+
47+
```bash
48+
composer require aureuserp/mcp
49+
```
50+
51+
You can then complete the installation in two ways:
52+
53+
### Option 1: Via Command Line
54+
55+
Run:
56+
57+
```bash
58+
php artisan mcp:install
59+
```
60+
61+
This command does the setup automatically:
62+
63+
- publishes CORS config (`config/cors.php`) if not already published
64+
- publishes MCP OAuth authorization view (`mcp-views`)
65+
- runs Passport API install scaffold (`install:api --passport`)
66+
- ensures `config/auth.php` has MCP API guard/provider
67+
- configures Passport authorization view from the MCP plugin service provider
68+
- clears caches
69+
70+
### Option 2: Via Web Plugin Manager
71+
72+
Navigate to the Plugin Manager in your AureusERP admin panel and install the MCP plugin from there.
73+
74+
## Plugin install hook
75+
76+
If you install via plugin manager or composer, setup is auto-triggered from the plugin install command.
77+
78+
## Tool catalog
79+
80+
### Dev Agent server
81+
82+
Available via **stdio** (`php artisan mcp:dev`) and **HTTP** (`POST /mcp/dev`).
83+
84+
For developers and coding agents. Always call `search_docs` first before writing any plugin or feature code.
85+
86+
#### Tools (7)
87+
88+
- `search_docs` — Search the official AureusERP developer documentation at devdocs.aureuserp.com
89+
- `list_plugins` — List all installed plugins with activation status
90+
- `plugin_summary` — Get plugin details, dependency graph, and installation state
91+
- `route_list` — List registered routes filtered by plugin, HTTP method, or URI prefix
92+
- `filament_resource_list` — List Filament resources, pages, and widgets per panel
93+
- `plugin_model_list` — Inspect Eloquent models: table, fillable, casts, relationships, soft deletes
94+
- `api_resource_list` — Discover JSON API resource classes per plugin and version (V1, V2, …)
95+
96+
#### Resources (1)
97+
98+
- `DevGuideResource` (`erp://mcp/dev-guide`) — Developer guidance and quick commands for building AureusERP plugins
99+
100+
#### Prompts (1)
101+
102+
- `DevCodingPrompt` — Build a developer-oriented prompt payload for coding tasks targeting a specific plugin
103+
104+
---
105+
106+
### ERP Agent server
107+
108+
Available via **HTTP only** (`POST /mcp/erp`, requires OAuth). For business users and AI assistants querying ERP data. All tools are **READ-ONLY**.
109+
110+
#### Sales (5 tools)
111+
112+
- `sales_order_insights` — Recent orders, revenue, counts by period, top performers
113+
- `sales_order_fulfillment_status` — Delivery status and overdue commitments
114+
- `sales_pipeline_summary` — Leads and opportunities
115+
- `sales_team_performance` — Team metrics
116+
- `sales_quotation_conversion` — Quote to order rates
117+
118+
#### Purchases (4 tools)
119+
120+
- `purchase_orders_pending` — Pending POs
121+
- `purchase_spend_summary` — Spending analysis
122+
- `purchase_requisition_queue` — Pending requisitions
123+
- `purchase_supplier_delivery_risk` — Delivery risks
124+
125+
#### Invoices (6 tools)
126+
127+
- `invoice_list` — All invoices
128+
- `invoice_overdue_summary` — Overdue amounts
129+
- `invoice_aging_buckets` — 0–7, 8–30, 31+ days
130+
- `invoice_payment_followups` — Follow-up candidates
131+
- `invoice_status_breakdown` — States & payment states
132+
- `credit_notes_overview` — Customer credit notes and vendor refunds (counts, amounts, top partners)
133+
134+
#### Accounting (9 tools)
135+
136+
- `account_receivable_summary` — AR amounts
137+
- `account_payable_summary` — AP amounts
138+
- `account_move_state_breakdown` — Journal states
139+
- `account_payment_state_breakdown` — Payment states
140+
- `accounting_cashflow_snapshot` — Cash flow
141+
- `accounting_tax_liability_snapshot` — Tax obligations
142+
- `accounting_journal_entry_health` — Entry issues
143+
- `accounting_unposted_entries` — Unposted entries
144+
- `bank_statement_queue` — Pending reconciliation
145+
146+
#### Inventory (6 tools)
147+
148+
- `inventory_low_stock_alerts` — Low stock
149+
- `inventory_out_of_stock_items` — Out of stock
150+
- `inventory_replenishment_queue` — Reorder items
151+
- `inventory_location_balance` — Stock by location
152+
- `inventory_operation_backlog` — Pending ops
153+
- `inventory_warehouse_kpis` — Warehouse metrics
154+
155+
#### Projects (4 tools)
156+
157+
- `project_status_overview` — Active projects
158+
- `project_task_backlog` — Tasks by status
159+
- `project_deadline_risk` — Overdue tasks
160+
- `project_timesheet_summary` — Time logged
161+
162+
#### Prompts (5)
163+
164+
- `SalesSummaryPrompt` — Guide for sales queries
165+
- `PurchaseSummaryPrompt` — Guide for purchase queries
166+
- `InvoiceSummaryPrompt` — Guide for invoice queries
167+
- `InventorySummaryPrompt` — Guide for inventory queries
168+
- `ProjectSummaryPrompt` — Guide for project queries
169+
170+
## Security
171+
172+
All ERP Agent server tools are **READ-ONLY**. They only retrieve data — no create, update, or delete operations. This ensures AI assistants can query business data safely without making changes to the system.
173+
174+
## Example Usage
175+
176+
### Connecting via an MCP client
177+
178+
Both servers can be registered in any MCP-compatible editor or AI agent that supports `mcp.json` / `.mcp.json` configuration (VS Code, Cursor, Claude Code, Windsurf, etc.).
179+
180+
```jsonc
181+
{
182+
"servers": {
183+
"aureus-dev-mcp-server": {
184+
"command": "php",
185+
"args": [
186+
"artisan",
187+
"mcp:dev"
188+
]
189+
},
190+
"aureus-erp-mcp-server": {
191+
"url": "http://127.0.0.1:8000/mcp/erp",
192+
"type": "http"
193+
}
194+
}
195+
}
196+
```
197+
198+
> **File location** — place this in `.vscode/mcp.json` (VS Code / GitHub Copilot), `.cursor/mcp.json` (Cursor), `.mcp.json` (Claude Code / project root), or wherever your editor reads its MCP server config.
199+
200+
| Server | Key | Transport | Auth |
201+
|---|---|---|---|
202+
| Dev Agent | `aureus-dev-mcp-server` | stdio — spawned via `php artisan mcp:dev` | None — local process |
203+
| ERP Agent | `aureus-erp-mcp-server` | HTTP — `POST /mcp/erp` | OAuth Bearer token |
204+
205+
The Dev server starts automatically as a subprocess — no OAuth setup required. The ERP server connects over HTTP using the URL of your running application; ensure it is authenticated via OAuth before use.
206+
207+
This is the same pattern used by [Laravel Boost](https://laravel.com/docs/12.x/boost) (`boost:mcp`).
208+
209+
### Using with AI Assistants via HTTP (ERP Agent)
210+
211+
Ask natural language questions:
212+
213+
```
214+
- "How many orders did we get this week?"
215+
- "What is our total accounts receivable?"
216+
- "Which products are low on stock?"
217+
- "Show me our active projects"
218+
- "What are the overdue invoices?"
219+
```
220+
221+
### Using with Coding Agents via stdio (Dev Agent)
222+
223+
```
224+
- "How do I create a new plugin?"
225+
- "What routes does the Sales plugin expose?"
226+
- "What are the fillable fields on the Order model?"
227+
- "List all Filament resources for the Inventory plugin"
228+
- "What API resource classes exist for accounts?"
229+
```
230+
231+
### Using MCP Inspector
232+
233+
```bash
234+
# Test Dev Agent server (stdio)
235+
php artisan mcp:inspector aureuserp-dev
236+
237+
# Test Dev Agent server (HTTP)
238+
php artisan mcp:inspector mcp/dev
239+
240+
# Test ERP Agent server (HTTP)
241+
php artisan mcp:inspector mcp/erp
242+
```
File renamed without changes.

0 commit comments

Comments
 (0)