@casys/mcp-erpnext 3.1.0-beta.8 → 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/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
@@ -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,16 +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. Features remain capability-gated by the MCP host. In
88
- > particular, downloads require both proxied server tools and the MCP Apps
89
- > `downloadFile` capability.
90
-
91
86
  ## Documentation
92
87
 
93
88
  Organised by what you are doing, following [Diátaxis](https://diataxis.fr):
@@ -192,52 +187,52 @@ until it exists. See
192
187
 
193
188
  ## UI Viewers
194
189
 
195
- Eight interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
190
+ Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
196
191
  viewers, registered as `ui://mcp-erpnext/{name}`:
197
192
 
198
- | Viewer | Description | Interactive Features |
199
- | ---------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
200
- | `doc-viewer` | Generic ERPNext document with fields and child tables | Capability-gated attachments, typed navigation, guarded Submit/Cancel, and raw JSON fallback. |
201
- | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
202
- | `invoice-viewer` | Sales Orders, Sales Invoices, and Quotations with line totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
203
- | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
204
- | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
205
- | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
206
- | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
207
- | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
208
-
209
- ### Navigation and active context
210
-
211
- Viewers progressively select the best interaction supported by the host:
212
-
213
- - `serverTools` opens typed list, record, and chart targets inside the current
214
- viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
215
- the state of each level.
216
- - `downloadFile` lets the host confirm and save an attachment returned as a
217
- bounded embedded resource. The viewer never opens an ERPNext file URL
218
- directly.
219
- - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
220
- active-context snapshot. The compact context chip keeps up to eight items and
221
- lets users remove one item or clear them all. The snapshot contains selected
222
- values, never hidden instructions for the model.
223
- - `message.text` keeps `app.sendMessage()` as a conversational fallback when
224
- direct navigation or context replacement is unavailable.
225
- - Without these capabilities, local inspection remains available and unsupported
226
- remote actions are omitted.
227
-
228
- The server supplies typed navigation metadata and the exact `_availableTools`
229
- allowed for each viewer, so category-filtered deployments do not expose tools
230
- 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
231
228
 
232
229
  ### Refresh model
233
230
 
234
- Read-only viewers revalidate on focus and through their refresh control.
235
- Mutations use an explicit read-only request to fetch committed state; a mutating
236
- tool is never replayed automatically. Overlapping or stale responses are ignored
237
- when a newer host payload or mutation has already won. A confirmed document
238
- change marks every potentially derived snapshot in the current navigation stack
239
- as stale; each marker is removed only when that surface has actually been read
240
- 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
241
236
 
242
237
  ### Building UI viewers
243
238
 
@@ -249,11 +244,8 @@ node build-all.mjs
249
244
 
250
245
  ## Tools
251
246
 
252
- Record `_list` tools return interactive results via the doclist-viewer with row
253
- click, inline detail, and cross-viewer navigation. The attachment-specific
254
- `erpnext_file_list` tool does not render doclist-viewer. Generic and dedicated
255
- document reads use `doc-viewer`, except Sales Order, Sales Invoice, and
256
- 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.
257
249
 
258
250
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
259
251
  Submit, and Cancel.
@@ -268,9 +260,9 @@ Quotation, which retain the specialized invoice surface.
268
260
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
269
261
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
270
262
  - **Assets** — Assets, Movements, Maintenance records, and Categories.
271
- - **Operations** — Generic CRUD, native assignment, attachment listing, upload,
272
- host-mediated download, and deny-by-default Frappe method calls
273
- (`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`).
274
266
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
275
267
  drag-and-drop.
276
268
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
@@ -281,15 +273,14 @@ Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
281
273
 
282
274
  ## Environment Variables
283
275
 
284
- | Variable | Required | Description |
285
- | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
286
- | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
287
- | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
288
- | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
289
- | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
290
- | `ERPNEXT_MAX_DOWNLOAD_BYTES` | No | Maximum attachment-download size in bytes (positive integer; default: 10 MiB) |
291
- | `ERPNEXT_METHOD_ALLOWLIST` | No | Comma-separated exact method paths or `prefix.*`; unset means `erpnext_method_call` denies every method, while `*` allows all |
292
- | `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 |
293
284
 
294
285
  MRTR is opt-in. Without this key, or when the client does not advertise
295
286
  elicitation, ambiguous links keep returning the existing actionable ambiguity