@casys/mcp-erpnext 3.1.0-beta.9 → 3.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
@@ -9,15 +9,6 @@ English | [繁體中文](README.zh-TW.md)
9
9
  [![M8ven Score](https://m8ven.ai/badge/mcp/casys-ai-mcp-erpnext-1kev4k)](https://m8ven.ai/mcp/casys-ai-mcp-erpnext-1kev4k)
10
10
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
11
11
 
12
- > [!IMPORTANT]
13
- > **Installing the 3.1 beta:** for npm/Node use
14
- > `npx -y @casys/mcp-erpnext@next`; for Deno use
15
- > `deno run -A jsr:@casys/mcp-erpnext@^3.1.0-beta/server`. Both follow the
16
- > current prerelease — JSR has no dist-tags, hence the range there. Exact
17
- > versions are in the [CHANGELOG](CHANGELOG.md). The beta adds the generic
18
- > document viewer and attachment workflows, so test it with the MCP host your
19
- > users actually run before replacing a stable deployment.
20
-
21
12
  Let any MCP-compatible AI agent operate your [ERPNext](https://erpnext.com) /
22
13
  Frappe instance — documents, workflows, and interactive viewers inside the host
23
14
  (Claude Desktop, Claude Code, VS Code Copilot, or custom).
@@ -78,18 +69,20 @@ results.
78
69
 
79
70
  ## What's New
80
71
 
72
+ **3.1.0 is the stable release.** KPI and funnel viewers now use the refreshed
73
+ interface and support selecting context for the next conversation turn.
74
+ Recognized creation errors include recovery guidance in the existing tools. The
75
+ other five viewers keep their existing interactions.
76
+
77
+ For stable npm installations use `@casys/mcp-erpnext@latest`; for Deno use
78
+ `jsr:@casys/mcp-erpnext@3.1.0/server`. The separate 3.2 beta remains on npm
79
+ `@next` and includes the generic document viewer, attachment workflows and Buy
80
+ evidence features.
81
+
81
82
  See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
82
83
  [latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
83
84
  the current version's highlights.
84
85
 
85
- > **3.1 beta preview:** the beta keeps the 3.0 tool surface and adds a generic
86
- > document viewer, child tables, document attachments, in-view navigation, and
87
- > active context. **3.1.0-beta.9** adds read-only Buy evidence capture and an
88
- > immutable recorded-session viewer. Features remain capability-gated by the MCP
89
- > host. In particular, downloads require both proxied server tools and the MCP
90
- > Apps `downloadFile` capability. Buy evidence does not purchase or qualify a
91
- > live ERP.
92
-
93
86
  ## Documentation
94
87
 
95
88
  Organised by what you are doing, following [Diátaxis](https://diataxis.fr):
@@ -194,55 +187,52 @@ until it exists. See
194
187
 
195
188
  ## UI Viewers
196
189
 
197
- Nine interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
190
+ Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
198
191
  viewers, registered as `ui://mcp-erpnext/{name}`:
199
192
 
200
- | Viewer | Description | Interactive Features |
201
- | --------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
202
- | `doc-viewer` | Generic ERPNext document with fields and child tables | Capability-gated attachments, typed navigation, guarded Submit/Cancel, and raw JSON fallback. |
203
- | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
204
- | `invoice-viewer` | Sales Orders, Sales Invoices, and Quotations with line totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
205
- | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
206
- | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
207
- | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
208
- | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
209
- | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
210
- | `buy-evidence-viewer` | Immutable sealed Buy evidence (recorded session only) | Complete, partial, unresolved, and unavailable projections; no live ERP refresh or mutation. |
211
-
212
- ### Navigation and active context
213
-
214
- Viewers progressively select the best interaction supported by the host:
215
-
216
- - `serverTools` opens typed list, record, and chart targets inside the current
217
- viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
218
- the state of each level.
219
- - `downloadFile` lets the host confirm and save an attachment returned as a
220
- bounded embedded resource. The viewer never opens an ERPNext file URL
221
- directly.
222
- - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
223
- active-context snapshot. The compact context chip keeps up to eight items and
224
- lets users remove one item or clear them all. The snapshot contains selected
225
- values, never hidden instructions for the model.
226
- - `message.text` keeps `app.sendMessage()` as a conversational fallback when
227
- direct navigation or context replacement is unavailable.
228
- - Without these capabilities, local inspection remains available and unsupported
229
- remote actions are omitted.
230
- - The Buy evidence viewer is recorded-session only. It does not call server
231
- tools, refresh live documents, or mutate ERP state.
232
-
233
- The server supplies typed navigation metadata and the exact `_availableTools`
234
- allowed for each viewer, so category-filtered deployments do not expose tools
235
- that are not loaded.
193
+ | Viewer | Description | Interactive Features |
194
+ | ---------------- | ----------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
195
+ | `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. |
196
+ | `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. |
197
+ | `stock-viewer` | Stock balance table with color-coded qty badges | Row click → item info + recent movements. sendMessage to stock chart, item details, stock entries. |
198
+ | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Click bar/pie/line data points → sendMessage drill-down into underlying documents. |
199
+ | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop moves, inline edit (priority, progress, dates), sendMessage to Timesheets/Quotations/Related docs. |
200
+ | `kpi-viewer` | Responsive KPI card with delta and monthly trend | Select trend data/months as context; double-click or Enter requests details in the conversation. Scalar-only KPIs have no selection control. |
201
+ | `funnel-viewer` | Responsive sales funnel with stage counts, amounts and conversion rates | Click/Space selects or removes a stage from context; double-click, Enter or the explicit Ask button requests details in the conversation. |
202
+
203
+ ### Context selection in KPI and funnel
204
+
205
+ On hosts that support `app.updateModelContext()`, selecting an element prepares
206
+ context for the next conversation turn. It does not send a chat message. Click
207
+ again or use the Context control to remove a selection or clear the basket.
208
+ Pending and rejected updates are shown separately from confirmed selections.
209
+ Refreshing keeps the selections that still exist and updates their values.
210
+
211
+ KPI and funnel use the new Preact/Tailwind interface. The other five viewers
212
+ retain their existing React interface and interactions. Detail requests in these
213
+ two viewers use the conversation; they do not open nested document editors.
214
+
215
+ ### Cross-viewer navigation
216
+
217
+ Viewers communicate via `app.sendMessage()` — clicking a button in one viewer
218
+ sends a request to the conversation for the assistant to open the requested
219
+ data.
220
+
221
+ The server auto-injects navigation metadata into tool results:
222
+
223
+ - `_rowAction` — which tool to call when a row is clicked
224
+ - `_sendMessageHints` — navigation buttons shown in detail panels (e.g.
225
+ "Orders", "Invoices")
226
+ - `_drillDown` / `_trendDrillDown` — sendMessage templates for KPI and chart
227
+ click-through
236
228
 
237
229
  ### Refresh model
238
230
 
239
- Read-only viewers revalidate on focus and through their refresh control.
240
- Mutations use an explicit read-only request to fetch committed state; a mutating
241
- tool is never replayed automatically. Overlapping or stale responses are ignored
242
- when a newer host payload or mutation has already won. A confirmed document
243
- change marks every potentially derived snapshot in the current navigation stack
244
- as stale; each marker is removed only when that surface has actually been read
245
- again. Separate MCP Apps are not synchronized automatically in the 3.1 beta.
231
+ All viewers carry a `refreshRequest` payload for safe revalidation via
232
+ `app.callServerTool()`:
233
+
234
+ - `kanban-viewer` revalidates after mutations and on focus
235
+ - All other viewers support focus refresh + manual refresh button
246
236
 
247
237
  ### Building UI viewers
248
238
 
@@ -252,48 +242,10 @@ npm ci
252
242
  node build-all.mjs
253
243
  ```
254
244
 
255
- ## Buy evidence capture
256
-
257
- **One** read-only tool and **one** recorded App. They do not purchase, create a
258
- BOM/RFQ/PO, refresh live documents, replace generic ERP viewers, or qualify a
259
- live ERPNext instance.
260
-
261
- - Tool: `erpnext_buy_capture`. Closed DocTypes only (Item, BOM, Item Price,
262
- Supplier Quotation, Supplier, Price List, UOM, Currency Exchange). Two
263
- `skipCache` reads must agree on `modified` and the closed projection
264
- fingerprint. Return is ephemeral canonical JSON + SHA-256 + byte count. The
265
- caller cannot pass `sourceInstance`, URL, credentials, `capturedAt`, or a
266
- digest. Digital Thread stores those bytes in its own CAS; this server does not
267
- keep a second CAS.
268
- - App: `io.casys.mcp-erpnext.buy-evidence` `3.1.0-beta.9`, resource
269
- `ui://mcp-erpnext/buy-evidence-viewer` (`text/html;profile=mcp-app`), manifest
270
- `ui://mcp-erpnext/buy-evidence-manifest` (`application/json`),
271
- `acceptedActions` = `viewer.session.apply` only. Complete, partial,
272
- unresolved, and unavailable projections stay labelled. No live DocViewer
273
- refresh, mutation, or `app.callServerTool`. Session `anchor` is the sealed
274
- Digital Thread artefact (`provenance.bundleRef`), not a hash of the displayed
275
- projection.
276
- - Schemas: `io.casys.mcp-erpnext.buy-source-capture/1.0`,
277
- `io.casys.mcp-erpnext.buy-recorded-result/1.0`,
278
- `io.casys.mcp-erpnext.buy-recorded-session/1.0`.
279
- - The viewer is built with the other MCP Apps
280
- (`cd src/ui && npm ci && node
281
- build-all.mjs`). Published JSR/npm artifacts
282
- include `src/ui/dist/` and the Buy TypeScript module; the HTML resource and
283
- generated manifest are what a published installation serves.
284
-
285
- Digital Thread owns configuration/seal (`buy-configuration/1.0`,
286
- `buy-cost-bundle/1.0`, `buy.capture-configuration-cost@1`,
287
- `buy.seal-configuration-cost@1`). A qualified
288
- `commerce.read-erpnext-buy-source@1` binding is required before dispatch.
289
-
290
245
  ## Tools
291
246
 
292
- Record `_list` tools return interactive results via the doclist-viewer with row
293
- click, inline detail, and cross-viewer navigation. The attachment-specific
294
- `erpnext_file_list` tool does not render doclist-viewer. Generic and dedicated
295
- document reads use `doc-viewer`, except Sales Order, Sales Invoice, and
296
- Quotation, which retain the specialized invoice surface.
247
+ Each `_list` tool returns interactive results via the doclist-viewer with row
248
+ click, inline detail, and cross-viewer navigation.
297
249
 
298
250
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
299
251
  Submit, and Cancel.
@@ -308,31 +260,27 @@ Quotation, which retain the specialized invoice surface.
308
260
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
309
261
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
310
262
  - **Assets** — Assets, Movements, Maintenance records, and Categories.
311
- - **Operations** — Generic CRUD, native assignment, attachment listing, upload,
312
- host-mediated download, and deny-by-default Frappe method calls
313
- (`erpnext_doc_*`, `erpnext_file_*`, `erpnext_method_call`).
263
+ - **Operations** — Generic CRUD, native assignment, file upload, and
264
+ deny-by-default Frappe method calls (`erpnext_doc_*`, `erpnext_file_upload`,
265
+ `erpnext_method_call`).
314
266
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
315
267
  drag-and-drop.
316
268
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
317
269
  sparklines, and a sales funnel.
318
- - **Buy** — Read-only sealed capture of closed commercial documents
319
- (`erpnext_buy_capture`) and an immutable recorded-session evidence viewer. Not
320
- a purchase, BOM/RFQ/PO, or live ERP qualification.
321
270
  - **Setup** — Company creation and assignable user listing.
322
271
 
323
272
  Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
324
273
 
325
274
  ## Environment Variables
326
275
 
327
- | Variable | Required | Description |
328
- | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
329
- | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
330
- | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
331
- | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
332
- | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
333
- | `ERPNEXT_MAX_DOWNLOAD_BYTES` | No | Maximum attachment-download size in bytes (positive integer; default: 10 MiB) |
334
- | `ERPNEXT_METHOD_ALLOWLIST` | No | Comma-separated exact method paths or `prefix.*`; unset means `erpnext_method_call` denies every method, while `*` allows all |
335
- | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
276
+ | Variable | Required | Description |
277
+ | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
278
+ | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
279
+ | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
280
+ | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
281
+ | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
282
+ | `ERPNEXT_METHOD_ALLOWLIST` | No | Comma-separated exact method paths or `prefix.*`; unset means `erpnext_method_call` denies every method, while `*` allows all |
283
+ | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
336
284
 
337
285
  MRTR is opt-in. Without this key, or when the client does not advertise
338
286
  elicitation, ambiguous links keep returning the existing actionable ambiguity