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

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,13 @@ 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.10** hardens the read-only Buy capture and
88
+ > immutable recorded-session viewer introduced in beta.9. Features remain
89
+ > capability-gated by the MCP host. In particular, downloads require both
90
+ > proxied server tools and the MCP Apps `downloadFile` capability. Buy evidence
91
+ > does not purchase or qualify a live ERP.
79
92
 
80
93
  ## Documentation
81
94
 
@@ -181,18 +194,20 @@ until it exists. See
181
194
 
182
195
  ## UI Viewers
183
196
 
184
- Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
197
+ Nine interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
185
198
  viewers, registered as `ui://mcp-erpnext/{name}`:
186
199
 
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. |
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. |
196
211
 
197
212
  ### Navigation and active context
198
213
 
@@ -201,6 +216,9 @@ Viewers progressively select the best interaction supported by the host:
201
216
  - `serverTools` opens typed list, record, and chart targets inside the current
202
217
  viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
203
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.
204
222
  - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
205
223
  active-context snapshot. The compact context chip keeps up to eight items and
206
224
  lets users remove one item or clear them all. The snapshot contains selected
@@ -209,6 +227,8 @@ Viewers progressively select the best interaction supported by the host:
209
227
  direct navigation or context replacement is unavailable.
210
228
  - Without these capabilities, local inspection remains available and unsupported
211
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.
212
232
 
213
233
  The server supplies typed navigation metadata and the exact `_availableTools`
214
234
  allowed for each viewer, so category-filtered deployments do not expose tools
@@ -219,7 +239,10 @@ that are not loaded.
219
239
  Read-only viewers revalidate on focus and through their refresh control.
220
240
  Mutations use an explicit read-only request to fetch committed state; a mutating
221
241
  tool is never replayed automatically. Overlapping or stale responses are ignored
222
- when a newer host payload or mutation has already won.
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.
223
246
 
224
247
  ### Building UI viewers
225
248
 
@@ -229,10 +252,48 @@ npm ci
229
252
  node build-all.mjs
230
253
  ```
231
254
 
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.10`, 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
+
232
290
  ## Tools
233
291
 
234
- Each `_list` tool returns interactive results via the doclist-viewer with row
235
- click, inline detail, and cross-viewer navigation.
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.
236
297
 
237
298
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
238
299
  Submit, and Cancel.
@@ -247,26 +308,31 @@ click, inline detail, and cross-viewer navigation.
247
308
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
248
309
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
249
310
  - **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`).
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`).
253
314
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
254
315
  drag-and-drop.
255
316
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
256
317
  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.
257
321
  - **Setup** — Company creation and assignable user listing.
258
322
 
259
323
  Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
260
324
 
261
325
  ## Environment Variables
262
326
 
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 |
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 |
270
336
 
271
337
  MRTR is opt-in. Without this key, or when the client does not advertise
272
338
  elicitation, ambiguous links keep returning the existing actionable ambiguity
@@ -303,3 +369,7 @@ started, and [AGENTS.md](AGENTS.md) for the full architecture and conventions.
303
369
  ## License
304
370
 
305
371
  MIT
372
+
373
+ Buy result fields use the host locale (EN/FR/ZH). App-level waiting and
374
+ rejection screens retain English labels in this beta; host-context support for
375
+ those shared surface screens remains an upstream MCP View follow-up.