@casys/mcp-erpnext 3.1.0 → 3.2.0-beta.1

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
@@ -4,20 +4,31 @@ English | [繁體中文](README.zh-TW.md)
4
4
 
5
5
  [![JSR](https://jsr.io/badges/@casys/mcp-erpnext)](https://jsr.io/@casys/mcp-erpnext)
6
6
  [![npm](https://img.shields.io/npm/v/@casys/mcp-erpnext?logo=npm&color=cb3837)](https://www.npmjs.com/package/@casys/mcp-erpnext)
7
- [![CI](https://github.com/Casys-AI/mcp-erpnext/actions/workflows/test.yml/badge.svg)](https://github.com/Casys-AI/mcp-erpnext/actions/workflows/test.yml)
7
+ [![CI](https://github.com/superWorldSavior/mcp-erpnext/actions/workflows/test.yml/badge.svg)](https://github.com/superWorldSavior/mcp-erpnext/actions/workflows/test.yml)
8
8
  [![MCP](https://img.shields.io/badge/MCP-server-1f6feb?logo=modelcontextprotocol&logoColor=white)](https://modelcontextprotocol.io)
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.2 beta:** for npm/Node use
14
+ > `npx -y @casys/mcp-erpnext@next`; for Deno use
15
+ > `deno run -A jsr:@casys/mcp-erpnext@3.2.0-beta.1/server`. npm's `next` tag
16
+ > follows the current prerelease; the JSR command pins this exact beta because
17
+ > JSR has no dist-tags. Stable **3.1.0** is available through npm's `latest`
18
+ > tag. The beta retains the generic document viewer and attachment workflows, so
19
+ > test it with the MCP host your users actually run before replacing a stable
20
+ > deployment. See the [CHANGELOG](CHANGELOG.md) for release history.
21
+
12
22
  Let any MCP-compatible AI agent operate your [ERPNext](https://erpnext.com) /
13
23
  Frappe instance — documents, workflows, and interactive viewers inside the host
14
24
  (Claude Desktop, Claude Code, VS Code Copilot, or custom).
15
25
 
16
26
  Works with **self-hosted** and **ERPNext Cloud** (frappe.cloud) instances.
17
27
 
18
- > Built on **[@casys/mcp-server](https://github.com/Casys-AI/mcp-server)** — the
19
- > MCP server framework (concurrency, auth, MCP Apps, observability) that powers
20
- > this project.
28
+ > Built on
29
+ > **[@casys/mcp-server](https://github.com/superWorldSavior/mcp-platform)** —
30
+ > the MCP server framework (concurrency, auth, MCP Apps, observability) that
31
+ > powers this project.
21
32
 
22
33
  ## Screenshots
23
34
 
@@ -69,19 +80,17 @@ results.
69
80
 
70
81
  ## What's New
71
82
 
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
-
82
83
  See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
83
- [latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
84
- the current version's highlights.
84
+ [latest release](https://github.com/superWorldSavior/mcp-erpnext/releases/latest)
85
+ for the current version's highlights.
86
+
87
+ > **3.2.0-beta.1 preview:** the beta includes the creation-error guidance,
88
+ > ERPNext 16 Opportunity compatibility and calendar-date fixes carried into
89
+ > stable 3.1.0, alongside its generic document viewer, child tables,
90
+ > attachments, in-view navigation and recorded Buy evidence. KPI percentage
91
+ > changes, funnel currencies and context clearing on unsupported hosts are also
92
+ > corrected. Features remain capability-gated by the MCP host; Buy evidence does
93
+ > not purchase or qualify a live ERP.
85
94
 
86
95
  ## Documentation
87
96
 
@@ -187,52 +196,55 @@ until it exists. See
187
196
 
188
197
  ## UI Viewers
189
198
 
190
- Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
199
+ Nine interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
191
200
  viewers, registered as `ui://mcp-erpnext/{name}`:
192
201
 
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
202
+ | Viewer | Description | Interactive Features |
203
+ | --------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
204
+ | `doc-viewer` | Generic ERPNext document with fields and child tables | Capability-gated attachments, typed navigation, guarded Submit/Cancel, and raw JSON fallback. |
205
+ | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
206
+ | `invoice-viewer` | Sales Orders, Sales Invoices, and Quotations with line totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
207
+ | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
208
+ | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
209
+ | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
210
+ | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
211
+ | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
212
+ | `buy-evidence-viewer` | Immutable sealed Buy evidence (recorded session only) | Complete, partial, unresolved, and unavailable projections; no live ERP refresh or mutation. |
213
+
214
+ ### Navigation and active context
215
+
216
+ Viewers progressively select the best interaction supported by the host:
217
+
218
+ - `serverTools` opens typed list, record, and chart targets inside the current
219
+ viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
220
+ the state of each level.
221
+ - `downloadFile` lets the host confirm and save an attachment returned as a
222
+ bounded embedded resource. The viewer never opens an ERPNext file URL
223
+ directly.
224
+ - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
225
+ active-context snapshot. The compact context chip keeps up to eight items and
226
+ lets users remove one item or clear them all. The snapshot contains selected
227
+ values, never hidden instructions for the model.
228
+ - `message.text` keeps `app.sendMessage()` as a conversational fallback when
229
+ direct navigation or context replacement is unavailable.
230
+ - Without these capabilities, local inspection remains available and unsupported
231
+ remote actions are omitted.
232
+ - The Buy evidence viewer is recorded-session only. It does not call server
233
+ tools, refresh live documents, or mutate ERP state.
234
+
235
+ The server supplies typed navigation metadata and the exact `_availableTools`
236
+ allowed for each viewer, so category-filtered deployments do not expose tools
237
+ that are not loaded.
228
238
 
229
239
  ### Refresh model
230
240
 
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
241
+ Read-only viewers revalidate on focus and through their refresh control.
242
+ Mutations use an explicit read-only request to fetch committed state; a mutating
243
+ tool is never replayed automatically. Overlapping or stale responses are ignored
244
+ when a newer host payload or mutation has already won. A confirmed document
245
+ change marks every potentially derived snapshot in the current navigation stack
246
+ as stale; each marker is removed only when that surface has actually been read
247
+ again. Separate MCP Apps are not synchronized automatically in the 3.2 beta.
236
248
 
237
249
  ### Building UI viewers
238
250
 
@@ -242,10 +254,52 @@ npm ci
242
254
  node build-all.mjs
243
255
  ```
244
256
 
257
+ ## Buy evidence capture
258
+
259
+ **One** read-only tool and **one** recorded App. They do not purchase, create a
260
+ BOM/RFQ/PO, refresh live documents, replace generic ERP viewers, or qualify a
261
+ live ERPNext instance.
262
+
263
+ - Tool: `erpnext_buy_capture`. Closed DocTypes only (Item, BOM, Item Price,
264
+ Supplier Quotation, Supplier, Price List, UOM, Currency Exchange). Two
265
+ `skipCache` reads must agree on `modified` and the closed projection
266
+ fingerprint. Return is ephemeral canonical JSON + SHA-256 + byte count. The
267
+ caller cannot pass `sourceInstance`, URL, credentials, `capturedAt`, or a
268
+ digest. Digital Thread stores those bytes in its own CAS; this server does not
269
+ keep a second CAS.
270
+ - App: `io.casys.mcp-erpnext.buy-evidence` `3.2.0-beta.1`, resource
271
+ `ui://mcp-erpnext/buy-evidence-viewer` (`text/html;profile=mcp-app`), manifest
272
+ `ui://mcp-erpnext/buy-evidence-manifest` (`application/json`),
273
+ `acceptedActions` = `viewer.session.apply` only. Complete, partial,
274
+ unresolved, and unavailable projections stay labelled. No live DocViewer
275
+ refresh, mutation, or `app.callServerTool`. Session `anchor` is the sealed
276
+ Digital Thread artefact (`provenance.bundleRef`), not a hash of the displayed
277
+ projection.
278
+ - Schemas: `io.casys.mcp-erpnext.buy-source-capture/1.0`,
279
+ `io.casys.mcp-erpnext.buy-recorded-result/1.0` and `/2.0`,
280
+ `io.casys.mcp-erpnext.buy-recorded-session/1.0`.
281
+ - Result `/2.0` carries bounded `excludedLines` metadata for selected lines
282
+ absent from priced `lines`: exact line ID, quantity, unit, and stated reason.
283
+ It carries no amount, currency, or price source; covered subtotals remain
284
+ sealed values and unresolved lines remain visible.
285
+ - The viewer is built with the other MCP Apps
286
+ (`cd src/ui && npm ci && node
287
+ build-all.mjs`). Published JSR/npm artifacts
288
+ include `src/ui/dist/` and the Buy TypeScript module; the HTML resource and
289
+ generated manifest are what a published installation serves.
290
+
291
+ Digital Thread owns configuration/seal (`buy-configuration/1.0`,
292
+ `buy-cost-bundle/1.0`, `buy.capture-configuration-cost@1`,
293
+ `buy.seal-configuration-cost@1`). A qualified
294
+ `commerce.read-erpnext-buy-source@1` binding is required before dispatch.
295
+
245
296
  ## Tools
246
297
 
247
- Each `_list` tool returns interactive results via the doclist-viewer with row
248
- click, inline detail, and cross-viewer navigation.
298
+ Record `_list` tools return interactive results via the doclist-viewer with row
299
+ click, inline detail, and cross-viewer navigation. The attachment-specific
300
+ `erpnext_file_list` tool does not render doclist-viewer. Generic and dedicated
301
+ document reads use `doc-viewer`, except Sales Order, Sales Invoice, and
302
+ Quotation, which retain the specialized invoice surface.
249
303
 
250
304
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
251
305
  Submit, and Cancel.
@@ -260,27 +314,31 @@ click, inline detail, and cross-viewer navigation.
260
314
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
261
315
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
262
316
  - **Assets** — Assets, Movements, Maintenance records, and Categories.
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`).
317
+ - **Operations** — Generic CRUD, native assignment, attachment listing, upload,
318
+ host-mediated download, and deny-by-default Frappe method calls
319
+ (`erpnext_doc_*`, `erpnext_file_*`, `erpnext_method_call`).
266
320
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
267
321
  drag-and-drop.
268
322
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
269
323
  sparklines, and a sales funnel.
324
+ - **Buy** — Read-only sealed capture of closed commercial documents
325
+ (`erpnext_buy_capture`) and an immutable recorded-session evidence viewer. Not
326
+ a purchase, BOM/RFQ/PO, or live ERP qualification.
270
327
  - **Setup** — Company creation and assignable user listing.
271
328
 
272
329
  Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
273
330
 
274
331
  ## Environment Variables
275
332
 
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 |
333
+ | Variable | Required | Description |
334
+ | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
335
+ | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
336
+ | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
337
+ | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
338
+ | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
339
+ | `ERPNEXT_MAX_DOWNLOAD_BYTES` | No | Maximum attachment-download size in bytes (positive integer; default: 10 MiB) |
340
+ | `ERPNEXT_METHOD_ALLOWLIST` | No | Comma-separated exact method paths or `prefix.*`; unset means `erpnext_method_call` denies every method, while `*` allows all |
341
+ | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
284
342
 
285
343
  MRTR is opt-in. Without this key, or when the client does not advertise
286
344
  elicitation, ambiguous links keep returning the existing actionable ambiguity
@@ -317,3 +375,12 @@ started, and [AGENTS.md](AGENTS.md) for the full architecture and conventions.
317
375
  ## License
318
376
 
319
377
  MIT
378
+
379
+ Viewers and Buy result fields use the host locale: English, French, Simplified
380
+ Chinese, Traditional Chinese, Hindi, Bengali, Tamil and Urdu. Chinese script
381
+ tags take precedence over region tags; `zh-TW`, `zh-HK` and `zh-MO` select
382
+ Traditional Chinese when no script is specified. Urdu uses right-to-left
383
+ document direction, and a later host locale change updates the language and
384
+ direction without reloading the viewer. App-level waiting and rejection screens
385
+ retain English labels in this beta; host-context support for those shared
386
+ surface screens remains an upstream MCP View follow-up.