@casys/mcp-erpnext 0.1.9 → 2.1.0

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 CHANGED
@@ -2,14 +2,19 @@
2
2
 
3
3
  MCP server for [ERPNext](https://erpnext.com) / Frappe ERP — **120 tools** across **14 categories**, with **7 interactive UI viewers**.
4
4
 
5
- Connect any MCP-compatible AI agent (Claude Desktop, PML, custom) to your ERPNext instance via the standard [Model Context Protocol](https://modelcontextprotocol.io).
5
+ Connect any MCP-compatible AI agent (Claude Desktop, Claude Code, VS Code Copilot, custom) to your ERPNext instance via the [Model Context Protocol](https://modelcontextprotocol.io).
6
6
 
7
- ## Current Surface
7
+ Works with **self-hosted** and **ERPNext Cloud** (frappe.cloud) instances.
8
8
 
9
- - `kanban-viewer` is the canonical read-write MCP App viewer
10
- - kanban is live for `Task`, `Opportunity`, and `Issue`
11
- - `doclist-viewer`, `stock-viewer`, `invoice-viewer`, `chart-viewer`, `kpi-viewer`, and `funnel-viewer` are refresh-aware MCP Apps
12
- - `order-pipeline-viewer` and the legacy order/purchase pipeline tools have been removed
9
+ ## What's New in v2.1
10
+
11
+ - **Cross-viewer navigation** click a row in any list to drill down, click a button to open related documents in another viewer via `sendMessage`
12
+ - **Inline detail panels** expand any row in doclist/stock viewers to see full document details + action buttons (Submit, Cancel, Payments)
13
+ - **Interactive charts** — click bar/pie/line data points to drill into underlying documents
14
+ - **KPI drill-down** — click the big number or sparkline to explore exceptions or trends
15
+ - **Funnel redesign** — trapezoid stages with gradient fills, conversion badges, click-through navigation
16
+ - **Better error messages** — Frappe API errors are now surfaced with full detail instead of generic "Tool execution failed"
17
+ - **VS Code Copilot fix** — schema validation issue with `erpnext_doc_list` filters resolved (#2)
13
18
 
14
19
  ## Quick Start
15
20
 
@@ -38,8 +43,31 @@ Generate API credentials in ERPNext:
38
43
  }
39
44
  ```
40
45
 
46
+ > **Works with ERPNext Cloud** — set `ERPNEXT_URL` to your Frappe Cloud URL (e.g. `https://mycompany.erpnext.com` or `https://mysite.frappe.cloud`). API key authentication works the same way on self-hosted and cloud instances.
47
+
41
48
  > Zero dependencies — single self-contained bundle. Requires Node >= 20.
42
49
 
50
+ ### VS Code Copilot
51
+
52
+ Add to `.vscode/mcp.json`:
53
+
54
+ ```json
55
+ {
56
+ "servers": {
57
+ "erpnext": {
58
+ "type": "stdio",
59
+ "command": "npx",
60
+ "args": ["-y", "@casys/mcp-erpnext"],
61
+ "env": {
62
+ "ERPNEXT_URL": "http://localhost:8000",
63
+ "ERPNEXT_API_KEY": "your-api-key",
64
+ "ERPNEXT_API_SECRET": "your-api-secret"
65
+ }
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
43
71
  ### Deno (stdio)
44
72
 
45
73
  ```json
@@ -89,228 +117,34 @@ On a fresh ERPNext instance (no setup wizard), you need to create master data be
89
117
  7. Company: requires Warehouse Types to exist first
90
118
  ```
91
119
 
92
- ## Tools (120)
93
-
94
- ### Setup (2)
95
-
96
- | Tool | DocType | Operations |
97
- |------|---------|-----------|
98
- | `erpnext_company_list` | Company | List companies |
99
- | `erpnext_company_create` | Company | Create (name, abbr, currency, country, domain) |
100
-
101
- ### Sales (17)
102
-
103
- | Tool | DocType | Operations |
104
- |------|---------|-----------|
105
- | `erpnext_customer_list` | Customer | List + filters (group, territory, disabled) |
106
- | `erpnext_customer_get` | Customer | Get by name |
107
- | `erpnext_customer_create` | Customer | Create (name, group, territory, email, type) |
108
- | `erpnext_customer_update` | Customer | Update fields |
109
- | `erpnext_sales_order_list` | Sales Order | List + filters (customer, status, dates) |
110
- | `erpnext_sales_order_get` | Sales Order | Get with line items |
111
- | `erpnext_sales_order_create` | Sales Order | Create (customer + items + delivery_date) |
112
- | `erpnext_sales_order_update` | Sales Order | Update (delivery_date, items) |
113
- | `erpnext_sales_order_submit` | Sales Order | Submit (Draft → To Deliver and Bill) |
114
- | `erpnext_sales_order_cancel` | Sales Order | Cancel |
115
- | `erpnext_sales_invoice_list` | Sales Invoice | List + filters |
116
- | `erpnext_sales_invoice_get` | Sales Invoice | Get with line items |
117
- | `erpnext_sales_invoice_create` | Sales Invoice | Create (customer + items + dates) |
118
- | `erpnext_sales_invoice_submit` | Sales Invoice | Submit (Draft → Unpaid) |
119
- | `erpnext_quotation_list` | Quotation | List + filters (party, status) |
120
- | `erpnext_quotation_get` | Quotation | Get with line items |
121
- | `erpnext_quotation_create` | Quotation | Create (Customer/Lead + items) |
122
-
123
- ### Inventory (9)
124
-
125
- | Tool | DocType | Operations |
126
- |------|---------|-----------|
127
- | `erpnext_item_list` | Item | List + filters (group, stock flag, disabled) |
128
- | `erpnext_item_get` | Item | Get by name/code |
129
- | `erpnext_item_create` | Item | Create (code, name, group, uom, rate) |
130
- | `erpnext_item_update` | Item | Update fields |
131
- | `erpnext_stock_balance` | Bin | Stock balances by item/warehouse |
132
- | `erpnext_warehouse_list` | Warehouse | List + filters (company, type) |
133
- | `erpnext_stock_entry_list` | Stock Entry | List + filters (type, dates) |
134
- | `erpnext_stock_entry_get` | Stock Entry | Get with item details |
135
- | `erpnext_stock_entry_create` | Stock Entry | Create (type + items + warehouses) |
136
-
137
- ### Purchasing (11)
138
-
139
- | Tool | DocType | Operations |
140
- |------|---------|-----------|
141
- | `erpnext_supplier_list` | Supplier | List + filters (group, type, disabled) |
142
- | `erpnext_supplier_get` | Supplier | Get by name |
143
- | `erpnext_supplier_create` | Supplier | Create (name, group, type, country, currency) |
144
- | `erpnext_purchase_order_list` | Purchase Order | List + filters (supplier, status, dates) |
145
- | `erpnext_purchase_order_get` | Purchase Order | Get with line items |
146
- | `erpnext_purchase_order_create` | Purchase Order | Create (supplier + items + schedule_date) |
147
- | `erpnext_purchase_invoice_list` | Purchase Invoice | List + filters |
148
- | `erpnext_purchase_invoice_get` | Purchase Invoice | Get with line items |
149
- | `erpnext_purchase_receipt_list` | Purchase Receipt | List + filters |
150
- | `erpnext_purchase_receipt_get` | Purchase Receipt | Get with received items |
151
- | `erpnext_supplier_quotation_list` | Supplier Quotation | List + filters |
152
-
153
- ### Accounting (6)
154
-
155
- | Tool | DocType | Operations |
156
- |------|---------|-----------|
157
- | `erpnext_account_list` | Account | Chart of accounts + filters (root_type, is_group) |
158
- | `erpnext_journal_entry_list` | Journal Entry | List + filters (voucher_type, dates) |
159
- | `erpnext_journal_entry_get` | Journal Entry | Get with accounts |
160
- | `erpnext_journal_entry_create` | Journal Entry | Create (voucher_type + balanced accounts) |
161
- | `erpnext_payment_entry_list` | Payment Entry | List + filters (type, party, dates) |
162
- | `erpnext_payment_entry_get` | Payment Entry | Get with references |
163
-
164
- ### HR (12)
165
-
166
- | Tool | DocType | Operations |
167
- |------|---------|-----------|
168
- | `erpnext_employee_list` | Employee | List + filters (department, status, company) |
169
- | `erpnext_employee_get` | Employee | Get by ID |
170
- | `erpnext_attendance_list` | Attendance | List + filters (employee, status, dates) |
171
- | `erpnext_leave_application_list` | Leave Application | List + filters |
172
- | `erpnext_leave_application_get` | Leave Application | Get by name |
173
- | `erpnext_leave_application_create` | Leave Application | Create (employee, type, dates, reason) |
174
- | `erpnext_salary_slip_list` | Salary Slip | List + filters (employee, status, dates) |
175
- | `erpnext_salary_slip_get` | Salary Slip | Get with earnings/deductions |
176
- | `erpnext_payroll_entry_list` | Payroll Entry | List + filters (company, status) |
177
- | `erpnext_expense_claim_list` | Expense Claim | List + filters |
178
- | `erpnext_expense_claim_create` | Expense Claim | Create (employee + expenses[]) |
179
- | `erpnext_leave_balance` | Leave Allocation | Get allocations by employee |
180
-
181
- ### Project (9)
182
-
183
- | Tool | DocType | Operations |
184
- |------|---------|-----------|
185
- | `erpnext_project_list` | Project | List + filters (status, company) |
186
- | `erpnext_project_get` | Project | Get by name |
187
- | `erpnext_project_create` | Project | Create (name, status, dates, budget, company) |
188
- | `erpnext_task_list` | Task | List + filters (project, status, priority) |
189
- | `erpnext_task_get` | Task | Get with dependencies |
190
- | `erpnext_task_create` | Task | Create (project, subject, status, priority, dates) |
191
- | `erpnext_task_update` | Task | Update (status, priority, progress, dates) |
192
- | `erpnext_timesheet_list` | Timesheet | List + filters (employee, project, status) |
193
- | `erpnext_timesheet_get` | Timesheet | Get with time log details |
194
-
195
- ### Delivery (5)
196
-
197
- | Tool | DocType | Operations |
198
- |------|---------|-----------|
199
- | `erpnext_delivery_note_list` | Delivery Note | List + filters (customer, status, dates) |
200
- | `erpnext_delivery_note_get` | Delivery Note | Get with delivered items |
201
- | `erpnext_delivery_note_create` | Delivery Note | Create (customer + items + against_sales_order) |
202
- | `erpnext_shipment_list` | Shipment | List + filters (status, carrier, dates) |
203
- | `erpnext_shipment_get` | Shipment | Get with parcels |
204
-
205
- ### Manufacturing (7)
206
-
207
- | Tool | DocType | Operations |
208
- |------|---------|-----------|
209
- | `erpnext_bom_list` | BOM | List + filters (item, is_active, is_default) |
210
- | `erpnext_bom_get` | BOM | Get with raw materials + operations |
211
- | `erpnext_work_order_list` | Work Order | List + filters (production_item, status, dates) |
212
- | `erpnext_work_order_get` | Work Order | Get with operations + materials |
213
- | `erpnext_work_order_create` | Work Order | Create (production_item, bom_no, qty, dates) |
214
- | `erpnext_job_card_list` | Job Card | List + filters (work_order, status, operation) |
215
- | `erpnext_job_card_get` | Job Card | Get with time logs + material transfers |
216
-
217
- ### CRM (8)
218
-
219
- | Tool | DocType | Operations |
220
- |------|---------|-----------|
221
- | `erpnext_lead_list` | Lead | List + filters (status, lead_owner, source) |
222
- | `erpnext_lead_get` | Lead | Get by name |
223
- | `erpnext_lead_create` | Lead | Create (name, company, email, phone, source) |
224
- | `erpnext_opportunity_list` | Opportunity | List + filters (status, owner, party) |
225
- | `erpnext_opportunity_get` | Opportunity | Get with items + competitors |
226
- | `erpnext_contact_list` | Contact | List + filters (company, status) |
227
- | `erpnext_contact_get` | Contact | Get by name |
228
- | `erpnext_campaign_list` | Campaign | List + filters (campaign_type) |
229
-
230
- ### Assets (8)
231
-
232
- | Tool | DocType | Operations |
233
- |------|---------|-----------|
234
- | `erpnext_asset_list` | Asset | List + filters (status, category, location) |
235
- | `erpnext_asset_get` | Asset | Get with depreciation + maintenance |
236
- | `erpnext_asset_create` | Asset | Create (name, category, company, purchase_date, cost) |
237
- | `erpnext_asset_movement_list` | Asset Movement | List + filters (purpose, dates) |
238
- | `erpnext_asset_movement_get` | Asset Movement | Get with assets moved |
239
- | `erpnext_asset_maintenance_list` | Asset Maintenance | List + filters |
240
- | `erpnext_asset_maintenance_get` | Asset Maintenance | Get with maintenance tasks |
241
- | `erpnext_asset_category_list` | Asset Category | List all categories |
242
-
243
- ### Generic Operations (7)
244
-
245
- These tools work with **any** ERPNext DocType:
246
-
247
- | Tool | Operation | Notes |
248
- |------|-----------|-------|
249
- | `erpnext_doc_create` | Create | Any DocType — essential for master data setup |
250
- | `erpnext_doc_get` | Get | Any document by DocType + name |
251
- | `erpnext_doc_list` | List | Any DocType with fields, filters, limit, order_by |
252
- | `erpnext_doc_update` | Update | Partial patch — pass only fields to change |
253
- | `erpnext_doc_delete` | Delete | Draft documents only |
254
- | `erpnext_doc_submit` | Submit | Any submittable document |
255
- | `erpnext_doc_cancel` | Cancel | Any submitted document |
256
-
257
- ### Kanban (2)
258
-
259
- Tools that power the canonical read-write kanban MCP App.
260
-
261
- | Tool | Viewer | Description |
262
- |------|--------|-------------|
263
- | `erpnext_kanban_get_board` | `kanban-viewer` | Get a normalized kanban board for `Task`, `Opportunity`, or `Issue` |
264
- | `erpnext_kanban_move_card` | `kanban-viewer` | Execute a validated card move and return reconciliation data / business errors |
265
-
266
- ### Analytics (17)
267
-
268
- Tools that return shaped data for chart, KPI, and funnel viewers.
269
-
270
- | Tool | Viewer | Description |
271
- |------|--------|-------------|
272
- | `erpnext_stock_chart` | chart-viewer | Bar chart of stock levels by item/warehouse |
273
- | `erpnext_sales_chart` | chart-viewer | Revenue by customer, item, or status (bar/donut) |
274
- | `erpnext_revenue_trend` | chart-viewer | Monthly revenue trend (line/area, per customer) |
275
- | `erpnext_order_breakdown` | chart-viewer | Orders by customer/status (stacked-bar/pie/donut) |
276
- | `erpnext_revenue_vs_orders` | chart-viewer | Revenue bars + order count line (dual axis) |
277
- | `erpnext_stock_treemap` | chart-viewer | Stock value treemap by item or warehouse |
278
- | `erpnext_product_radar` | chart-viewer | Radar comparing items (stock, value, orders, revenue) |
279
- | `erpnext_price_vs_qty` | chart-viewer | Scatter: selling price vs quantity ordered |
280
- | `erpnext_ar_aging` | chart-viewer | AR aging buckets (0-30, 31-60, 61-90, 90+ days) |
281
- | `erpnext_gross_profit` | chart-viewer | Revenue bars + margin % line by item/customer |
282
- | `erpnext_profit_loss` | chart-viewer | P&L: income vs expenses per month + net profit |
283
- | `erpnext_kpi_revenue` | kpi-viewer | Revenue MTD with delta vs previous month + sparkline |
284
- | `erpnext_kpi_outstanding` | kpi-viewer | Outstanding receivables (count + total) |
285
- | `erpnext_kpi_orders` | kpi-viewer | Orders this month with delta vs last month |
286
- | `erpnext_kpi_gross_margin` | kpi-viewer | Gross margin % based on valuation rates |
287
- | `erpnext_kpi_overdue` | kpi-viewer | Overdue invoices count + value |
288
- | `erpnext_sales_funnel` | funnel-viewer | Lead → Opportunity → Quotation → Order funnel |
289
-
290
120
  ## UI Viewers
291
121
 
292
122
  Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps) viewers, registered as `ui://mcp-erpnext/{name}`:
293
123
 
294
- | Viewer | Description |
295
- |--------|-------------|
296
- | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export |
297
- | `invoice-viewer` | Single invoice display (header, items, totals, payment status) |
298
- | `stock-viewer` | Stock balance table with color-coded qty badges |
299
- | `chart-viewer` | Universal chart renderer (12 chart types via Recharts) |
300
- | `kanban-viewer` | Canonical read-write kanban board with optimistic updates, AX, and server reconciliation |
301
- | `kpi-viewer` | Single metric card with delta, sparkline, trend indicator |
302
- | `funnel-viewer` | Trapezoid sales funnel with conversion rates between stages |
124
+ | Viewer | Description | Interactive Features |
125
+ |--------|-------------|---------------------|
126
+ | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Row click → inline detail panel with Submit/Cancel + sendMessage navigation. Chip filters for status columns. Max 6 columns, rest in detail panel. |
127
+ | `invoice-viewer` | Sales/Purchase Invoice with parties, items, totals | Item click → stock balance + item info panel. Submit/Cancel/Payment actions. sendMessage to payment entries and customer invoices. |
128
+ | `stock-viewer` | Stock balance table with color-coded qty badges | Row click → item info + recent movements. sendMessage to stock chart, item details, stock entries. |
129
+ | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Click bar/pie/line data points → sendMessage drill-down into underlying documents. |
130
+ | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop moves, inline edit (priority, progress, dates), sendMessage to Timesheets/Quotations/Related docs. |
131
+ | `kpi-viewer` | Big number card with delta, sparkline, trend | Click number → sendMessage to exception list. Click sparkline → trend chart. |
132
+ | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Click stage → sendMessage to document list at that stage. Stage action buttons. |
303
133
 
304
- ### Why not native ERPNext kanban?
134
+ ### Cross-viewer navigation
305
135
 
306
- `kanban-viewer` exists because the user is already inside an MCP host conversation. Instead of sending them back into the ERPNext web app, the viewer keeps the context in-chat, reads through MCP tools, and writes back through `app.callServerTool()` with the server as source of truth.
136
+ Viewers communicate via `app.sendMessage()` clicking a button in one viewer injects a message into the conversation, which triggers the AI to call the right tool and open the appropriate viewer. This creates a seamless drill-down experience without leaving the chat.
307
137
 
308
- ### Refresh model
138
+ The server auto-injects navigation metadata into tool results:
139
+ - `_rowAction` — which tool to call when a row is clicked
140
+ - `_sendMessageHints` — navigation buttons shown in detail panels (e.g. "Orders", "Invoices")
141
+ - `_drillDown` / `_trendDrillDown` — sendMessage templates for KPI and chart click-through
309
142
 
310
- Interactive and long-lived viewers carry their own `refreshRequest` payload so they can safely revalidate through MCP without depending on host-provided `tool-input` echoes.
143
+ ### Refresh model
311
144
 
312
- - `kanban-viewer` revalidates after successful mutations and refreshes on focus
313
- - `doclist-viewer`, `stock-viewer`, `invoice-viewer`, `chart-viewer`, `kpi-viewer`, and `funnel-viewer` support focus refresh plus a manual fallback refresh action
145
+ All viewers carry a `refreshRequest` payload for safe revalidation via `app.callServerTool()`:
146
+ - `kanban-viewer` revalidates after mutations and on focus
147
+ - All other viewers support focus refresh + manual refresh button
314
148
 
315
149
  ### Building UI viewers
316
150
 
@@ -320,42 +154,50 @@ npm install
320
154
  node build-all.mjs
321
155
  ```
322
156
 
323
- ## npm Package
324
-
325
- The npm package (`@casys/mcp-erpnext`) is a single self-contained bundle (1.3MB) with zero runtime dependencies. UI viewers are embedded.
326
-
327
- To rebuild for npm from source:
157
+ ## Tools (120)
328
158
 
329
- ```bash
330
- cd lib/erpnext
331
- deno task ui:build # Build UI viewers
332
- ./scripts/build-node.sh # Generate dist-node/ and a publishable dist-node/bin/
333
- cd dist-node/bin && npm publish --access public
334
- ```
159
+ **14 categories** covering the full ERPNext surface. Each `_list` tool returns interactive results in the doclist-viewer with row click, inline detail, and cross-viewer navigation.
160
+
161
+ | Category | Tools | Viewer | Key capabilities |
162
+ |----------|-------|--------|-----------------|
163
+ | **Sales** | 17 | doclist / invoice | Customers, Sales Orders, Invoices, Quotations — CRUD + Submit/Cancel |
164
+ | **Purchasing** | 11 | doclist / invoice | Suppliers, Purchase Orders, Invoices, Receipts |
165
+ | **Inventory** | 9 | doclist / stock | Items, Stock Balance, Warehouses, Stock Entries |
166
+ | **Accounting** | 6 | doclist | Accounts, Journal Entries, Payment Entries |
167
+ | **HR** | 12 | doclist | Employees, Attendance, Leave, Salary, Expenses |
168
+ | **Project** | 9 | doclist | Projects, Tasks, Timesheets |
169
+ | **Delivery** | 5 | doclist | Delivery Notes, Shipments |
170
+ | **Manufacturing** | 7 | doclist | BOMs, Work Orders, Job Cards |
171
+ | **CRM** | 8 | doclist | Leads, Opportunities, Contacts, Campaigns |
172
+ | **Assets** | 8 | doclist | Assets, Movements, Maintenance, Categories |
173
+ | **Operations** | 7 | doclist | Generic CRUD for **any** DocType (`erpnext_doc_*`) |
174
+ | **Kanban** | 2 | kanban | Task/Opportunity/Issue boards with drag-and-drop |
175
+ | **Analytics** | 17 | chart / kpi / funnel | 12 chart types, 5 KPIs, sales funnel |
176
+ | **Setup** | 2 | — | Company creation |
177
+
178
+ > Full tool reference with all parameters: [`docs/tools.md`](docs/tools.md)
335
179
 
336
180
  ## Environment Variables
337
181
 
338
182
  | Variable | Required | Description |
339
183
  |----------|----------|-------------|
340
- | `ERPNEXT_URL` | Yes | ERPNext base URL (e.g. `http://localhost:8000`) |
184
+ | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
341
185
  | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
342
186
  | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
343
187
 
344
188
  ## Architecture
345
189
 
346
190
  ```
191
+ server.ts # MCP server (stdio + HTTP + inspector)
347
192
  mod.ts # Public API
348
- server.ts # MCP server (stdio + HTTP)
349
193
  deno.json # Package config
350
- scripts/
351
- build-node.sh # Node.js distribution builder
352
194
  src/
353
195
  api/
354
- frappe-client.ts # Frappe REST HTTP client
355
- types.ts # Type definitions
196
+ frappe-client.ts # Frappe REST HTTP client (zero-dependency)
197
+ types.ts # Frappe type definitions
356
198
  kanban/
357
- adapters/ # Per-DocType kanban adapters
358
- definitions.ts # V1 board registry
199
+ adapters/ # Per-DocType kanban adapters (task, opportunity, issue)
200
+ definitions.ts # Board registry
359
201
  types.ts # Shared kanban contracts
360
202
  tools/
361
203
  sales.ts # 17 sales tools
@@ -372,33 +214,39 @@ src/
372
214
  setup.ts # 2 company/setup tools
373
215
  kanban.ts # 2 read-write kanban tools
374
216
  analytics.ts # 17 analytics tools (charts, KPIs, funnel)
375
- mod.ts # Registry
217
+ ui-refresh.ts # Auto-inject _rowAction, _sendMessageHints, _drillDown
218
+ mod.ts # Tool registry
376
219
  types.ts # Tool interface
377
220
  client.ts # ErpNextToolsClient
378
- runtime.ts # Deno runtime shim
379
- runtime.node.ts # Node.js runtime shim
221
+ runtime.ts # Deno runtime adapter
222
+ runtime.node.ts # Node.js runtime adapter
380
223
  ui/
381
- doclist-viewer/ # Generic document list
382
- invoice-viewer/ # Invoice display
383
- stock-viewer/ # Stock balance display
384
- chart-viewer/ # Universal chart renderer (Recharts)
385
- kanban-viewer/ # Canonical read-write kanban
386
- kpi-viewer/ # Single metric card
387
- funnel-viewer/ # Sales funnel
388
- shared/ # Shared theme + branding
389
- viewers.ts # UI viewer registry
224
+ shared/ # ActionButton, InfoField, theme, branding, refresh
225
+ doclist-viewer/ # Generic document list (inline detail, chip filters)
226
+ invoice-viewer/ # Invoice display (item drill-down, actions)
227
+ stock-viewer/ # Stock balance (detail panel, sendMessage)
228
+ chart-viewer/ # Universal chart renderer (12 types, click drill-down)
229
+ kanban-viewer/ # Read-write kanban (drag, edit, sendMessage)
230
+ kpi-viewer/ # KPI card (clickable number + sparkline)
231
+ funnel-viewer/ # Sales funnel (trapezoid stages, click-through)
232
+ viewers.ts # Viewer registry
390
233
  tests/
391
- kanban/ # Kanban domain tests
392
- ui/ # Kanban UI state tests
234
+ tools/ # Tool + ui-refresh + client tests
235
+ kanban/ # Kanban adapter tests
236
+ ui/ # UI state + refresh tests
393
237
  docs/
394
- coverage.md # Full coverage matrix
395
- ROADMAP.md # Viewer & analytics roadmap
238
+ ROADMAP.md # Feature roadmap
239
+ coverage.md # Test coverage matrix
396
240
  ```
397
241
 
242
+ ## npm Package
243
+
244
+ The npm package (`@casys/mcp-erpnext`) is a single self-contained bundle with zero runtime dependencies. UI viewers are embedded.
245
+
398
246
  ## Development
399
247
 
400
248
  ```bash
401
- # Run tests
249
+ # Run tests (147 tests)
402
250
  deno test --allow-all tests/
403
251
 
404
252
  # Type check
@@ -406,6 +254,15 @@ deno check mod.ts server.ts
406
254
 
407
255
  # Start HTTP server (dev)
408
256
  deno task serve
257
+
258
+ # Launch MCP Inspector
259
+ deno task inspect
260
+
261
+ # Build UI viewers
262
+ deno task ui:build
263
+
264
+ # Dev a specific viewer with HMR
265
+ cd src/ui && npm run dev:kanban
409
266
  ```
410
267
 
411
268
  ## License