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

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Casys AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -6,8 +6,18 @@ English | [繁體中文](README.zh-TW.md)
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
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)
8
8
  [![MCP](https://img.shields.io/badge/MCP-server-1f6feb?logo=modelcontextprotocol&logoColor=white)](https://modelcontextprotocol.io)
9
+ [![M8ven Score](https://m8ven.ai/badge/mcp/casys-ai-mcp-erpnext-1kev4k)](https://m8ven.ai/mcp/casys-ai-mcp-erpnext-1kev4k)
9
10
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
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
+
11
21
  Let any MCP-compatible AI agent operate your [ERPNext](https://erpnext.com) /
12
22
  Frappe instance — documents, workflows, and interactive viewers inside the host
13
23
  (Claude Desktop, Claude Code, VS Code Copilot, or custom).
@@ -72,10 +82,14 @@ See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
72
82
  [latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
73
83
  the current version's highlights.
74
84
 
75
- > **3.1 beta preview:** install with `npx -y @casys/mcp-erpnext@next`. The beta
76
- > remains compatible with the 3.0 tool surface and progressively enables in-view
77
- > navigation and active context according to the capabilities advertised by the
78
- > MCP host.
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.11** adds reversible context selection, compact
88
+ > Kanban details with distinct Timesheet counts, exact selected-document
89
+ > navigation, five more host languages, and correct generic Company columns. It
90
+ > also retains bounded metadata for unpriced Buy lines and adds offline demo
91
+ > import plans. Features remain capability-gated by the MCP host; Buy evidence
92
+ > does not purchase or qualify a live ERP.
79
93
 
80
94
  ## Documentation
81
95
 
@@ -181,18 +195,20 @@ until it exists. See
181
195
 
182
196
  ## UI Viewers
183
197
 
184
- Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
198
+ Nine interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
185
199
  viewers, registered as `ui://mcp-erpnext/{name}`:
186
200
 
187
- | Viewer | Description | Interactive Features |
188
- | ---------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
189
- | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
190
- | `invoice-viewer` | Sales/Purchase documents with parties, items, totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
191
- | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
192
- | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
193
- | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
194
- | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
195
- | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
201
+ | Viewer | Description | Interactive Features |
202
+ | --------------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
203
+ | `doc-viewer` | Generic ERPNext document with fields and child tables | Capability-gated attachments, typed navigation, guarded Submit/Cancel, and raw JSON fallback. |
204
+ | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
205
+ | `invoice-viewer` | Sales Orders, Sales Invoices, and Quotations with line totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
206
+ | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
207
+ | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
208
+ | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
209
+ | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
210
+ | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
211
+ | `buy-evidence-viewer` | Immutable sealed Buy evidence (recorded session only) | Complete, partial, unresolved, and unavailable projections; no live ERP refresh or mutation. |
196
212
 
197
213
  ### Navigation and active context
198
214
 
@@ -201,6 +217,9 @@ Viewers progressively select the best interaction supported by the host:
201
217
  - `serverTools` opens typed list, record, and chart targets inside the current
202
218
  viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
203
219
  the state of each level.
220
+ - `downloadFile` lets the host confirm and save an attachment returned as a
221
+ bounded embedded resource. The viewer never opens an ERPNext file URL
222
+ directly.
204
223
  - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
205
224
  active-context snapshot. The compact context chip keeps up to eight items and
206
225
  lets users remove one item or clear them all. The snapshot contains selected
@@ -209,6 +228,8 @@ Viewers progressively select the best interaction supported by the host:
209
228
  direct navigation or context replacement is unavailable.
210
229
  - Without these capabilities, local inspection remains available and unsupported
211
230
  remote actions are omitted.
231
+ - The Buy evidence viewer is recorded-session only. It does not call server
232
+ tools, refresh live documents, or mutate ERP state.
212
233
 
213
234
  The server supplies typed navigation metadata and the exact `_availableTools`
214
235
  allowed for each viewer, so category-filtered deployments do not expose tools
@@ -219,7 +240,10 @@ that are not loaded.
219
240
  Read-only viewers revalidate on focus and through their refresh control.
220
241
  Mutations use an explicit read-only request to fetch committed state; a mutating
221
242
  tool is never replayed automatically. Overlapping or stale responses are ignored
222
- when a newer host payload or mutation has already won.
243
+ when a newer host payload or mutation has already won. A confirmed document
244
+ change marks every potentially derived snapshot in the current navigation stack
245
+ as stale; each marker is removed only when that surface has actually been read
246
+ again. Separate MCP Apps are not synchronized automatically in the 3.1 beta.
223
247
 
224
248
  ### Building UI viewers
225
249
 
@@ -229,10 +253,52 @@ npm ci
229
253
  node build-all.mjs
230
254
  ```
231
255
 
256
+ ## Buy evidence capture
257
+
258
+ **One** read-only tool and **one** recorded App. They do not purchase, create a
259
+ BOM/RFQ/PO, refresh live documents, replace generic ERP viewers, or qualify a
260
+ live ERPNext instance.
261
+
262
+ - Tool: `erpnext_buy_capture`. Closed DocTypes only (Item, BOM, Item Price,
263
+ Supplier Quotation, Supplier, Price List, UOM, Currency Exchange). Two
264
+ `skipCache` reads must agree on `modified` and the closed projection
265
+ fingerprint. Return is ephemeral canonical JSON + SHA-256 + byte count. The
266
+ caller cannot pass `sourceInstance`, URL, credentials, `capturedAt`, or a
267
+ digest. Digital Thread stores those bytes in its own CAS; this server does not
268
+ keep a second CAS.
269
+ - App: `io.casys.mcp-erpnext.buy-evidence` `3.1.0-beta.11`, resource
270
+ `ui://mcp-erpnext/buy-evidence-viewer` (`text/html;profile=mcp-app`), manifest
271
+ `ui://mcp-erpnext/buy-evidence-manifest` (`application/json`),
272
+ `acceptedActions` = `viewer.session.apply` only. Complete, partial,
273
+ unresolved, and unavailable projections stay labelled. No live DocViewer
274
+ refresh, mutation, or `app.callServerTool`. Session `anchor` is the sealed
275
+ Digital Thread artefact (`provenance.bundleRef`), not a hash of the displayed
276
+ projection.
277
+ - Schemas: `io.casys.mcp-erpnext.buy-source-capture/1.0`,
278
+ `io.casys.mcp-erpnext.buy-recorded-result/1.0` and `/2.0`,
279
+ `io.casys.mcp-erpnext.buy-recorded-session/1.0`.
280
+ - Result `/2.0` carries bounded `excludedLines` metadata for selected lines
281
+ absent from priced `lines`: exact line ID, quantity, unit, and stated reason.
282
+ It carries no amount, currency, or price source; covered subtotals remain
283
+ sealed values and unresolved lines remain visible.
284
+ - The viewer is built with the other MCP Apps
285
+ (`cd src/ui && npm ci && node
286
+ build-all.mjs`). Published JSR/npm artifacts
287
+ include `src/ui/dist/` and the Buy TypeScript module; the HTML resource and
288
+ generated manifest are what a published installation serves.
289
+
290
+ Digital Thread owns configuration/seal (`buy-configuration/1.0`,
291
+ `buy-cost-bundle/1.0`, `buy.capture-configuration-cost@1`,
292
+ `buy.seal-configuration-cost@1`). A qualified
293
+ `commerce.read-erpnext-buy-source@1` binding is required before dispatch.
294
+
232
295
  ## Tools
233
296
 
234
- Each `_list` tool returns interactive results via the doclist-viewer with row
235
- click, inline detail, and cross-viewer navigation.
297
+ Record `_list` tools return interactive results via the doclist-viewer with row
298
+ click, inline detail, and cross-viewer navigation. The attachment-specific
299
+ `erpnext_file_list` tool does not render doclist-viewer. Generic and dedicated
300
+ document reads use `doc-viewer`, except Sales Order, Sales Invoice, and
301
+ Quotation, which retain the specialized invoice surface.
236
302
 
237
303
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
238
304
  Submit, and Cancel.
@@ -247,26 +313,31 @@ click, inline detail, and cross-viewer navigation.
247
313
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
248
314
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
249
315
  - **Assets** — Assets, Movements, Maintenance records, and Categories.
250
- - **Operations** — Generic CRUD, native assignment, and attachment listing or
251
- upload for any DocType (`erpnext_doc_*`, `erpnext_file_list`,
252
- `erpnext_file_upload`).
316
+ - **Operations** — Generic CRUD, native assignment, attachment listing, upload,
317
+ host-mediated download, and deny-by-default Frappe method calls
318
+ (`erpnext_doc_*`, `erpnext_file_*`, `erpnext_method_call`).
253
319
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
254
320
  drag-and-drop.
255
321
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
256
322
  sparklines, and a sales funnel.
323
+ - **Buy** — Read-only sealed capture of closed commercial documents
324
+ (`erpnext_buy_capture`) and an immutable recorded-session evidence viewer. Not
325
+ a purchase, BOM/RFQ/PO, or live ERP qualification.
257
326
  - **Setup** — Company creation and assignable user listing.
258
327
 
259
328
  Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
260
329
 
261
330
  ## Environment Variables
262
331
 
263
- | Variable | Required | Description |
264
- | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
265
- | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
266
- | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
267
- | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
268
- | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
269
- | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
332
+ | Variable | Required | Description |
333
+ | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
334
+ | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
335
+ | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
336
+ | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
337
+ | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
338
+ | `ERPNEXT_MAX_DOWNLOAD_BYTES` | No | Maximum attachment-download size in bytes (positive integer; default: 10 MiB) |
339
+ | `ERPNEXT_METHOD_ALLOWLIST` | No | Comma-separated exact method paths or `prefix.*`; unset means `erpnext_method_call` denies every method, while `*` allows all |
340
+ | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
270
341
 
271
342
  MRTR is opt-in. Without this key, or when the client does not advertise
272
343
  elicitation, ambiguous links keep returning the existing actionable ambiguity
@@ -303,3 +374,12 @@ started, and [AGENTS.md](AGENTS.md) for the full architecture and conventions.
303
374
  ## License
304
375
 
305
376
  MIT
377
+
378
+ Viewers and Buy result fields use the host locale: English, French, Simplified
379
+ Chinese, Traditional Chinese, Hindi, Bengali, Tamil and Urdu. Chinese script
380
+ tags take precedence over region tags; `zh-TW`, `zh-HK` and `zh-MO` select
381
+ Traditional Chinese when no script is specified. Urdu uses right-to-left
382
+ document direction, and a later host locale change updates the language and
383
+ direction without reloading the viewer. App-level waiting and rejection screens
384
+ retain English labels in this beta; host-context support for those shared
385
+ surface screens remains an upstream MCP View follow-up.