@casys/mcp-erpnext 3.0.2 → 3.1.0-beta.2

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
@@ -8,6 +8,14 @@ English | [繁體中文](README.zh-TW.md)
8
8
  [![MCP](https://img.shields.io/badge/MCP-server-1f6feb?logo=modelcontextprotocol&logoColor=white)](https://modelcontextprotocol.io)
9
9
  [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
10
10
 
11
+ > [!IMPORTANT]
12
+ > **Installing the 3.1 beta:** pin the prerelease while this UX is being
13
+ > validated. For npm/Node use `npx -y @casys/mcp-erpnext@3.1.0-beta.2`; for Deno
14
+ > use `deno run -A jsr:@casys/mcp-erpnext@3.1.0-beta.2/server`. The moving npm
15
+ > alias is `@next`. Beta 2 adds the generic document viewer and attachment
16
+ > workflows, so test it with the MCP host your users actually run before
17
+ > replacing a stable deployment.
18
+
11
19
  Let any MCP-compatible AI agent operate your [ERPNext](https://erpnext.com) /
12
20
  Frappe instance — documents, workflows, and interactive viewers inside the host
13
21
  (Claude Desktop, Claude Code, VS Code Copilot, or custom).
@@ -72,6 +80,12 @@ See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
72
80
  [latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
73
81
  the current version's highlights.
74
82
 
83
+ > **3.1 beta 2 preview:** the beta keeps the 3.0 tool surface and adds a generic
84
+ > document viewer, child tables, document attachments, in-view navigation, and
85
+ > active context. Features remain capability-gated by the MCP host. In
86
+ > particular, downloads require both proxied server tools and the MCP Apps
87
+ > `downloadFile` capability.
88
+
75
89
  ## Documentation
76
90
 
77
91
  Organised by what you are doing, following [Diátaxis](https://diataxis.fr):
@@ -176,53 +190,68 @@ until it exists. See
176
190
 
177
191
  ## UI Viewers
178
192
 
179
- Seven interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
193
+ Eight interactive [MCP Apps](https://github.com/modelcontextprotocol/ext-apps)
180
194
  viewers, registered as `ui://mcp-erpnext/{name}`:
181
195
 
182
- | Viewer | Description | Interactive Features |
183
- | ---------------- | ---------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
184
- | `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. |
185
- | `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. |
186
- | `stock-viewer` | Stock balance table with color-coded qty badges | Row click item info + recent movements. sendMessage to stock chart, item details, stock entries. |
187
- | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Click bar/pie/line data points sendMessage drill-down into underlying documents. |
188
- | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop moves, inline edit (priority, progress, dates), sendMessage to Timesheets/Quotations/Related docs. |
189
- | `kpi-viewer` | Big number card with delta, sparkline, trend | Click number sendMessage to exception list. Click sparkline → trend chart. |
190
- | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Click stage sendMessage to document list at that stage. Stage action buttons. |
191
-
192
- ### Cross-viewer navigation
193
-
194
- Viewers communicate via `app.sendMessage()` — clicking a button in one viewer
195
- injects a message into the conversation, which triggers the AI to call the right
196
- tool and open the appropriate viewer.
197
-
198
- The server auto-injects navigation metadata into tool results:
199
-
200
- - `_rowAction` which tool to call when a row is clicked
201
- - `_sendMessageHints` navigation buttons shown in detail panels (e.g.
202
- "Orders", "Invoices")
203
- - `_drillDown` / `_trendDrillDown` sendMessage templates for KPI and chart
204
- click-through
196
+ | Viewer | Description | Interactive Features |
197
+ | ---------------- | ---------------------------------------------------------------- | --------------------------------------------------------------------------------------------- |
198
+ | `doc-viewer` | Generic ERPNext document with fields and child tables | Capability-gated attachments, typed navigation, guarded Submit/Cancel, and raw JSON fallback. |
199
+ | `doclist-viewer` | Generic document table with sort, filter, pagination, CSV export | Inline details, typed nested navigation, Submit/Cancel, and compact status filters. |
200
+ | `invoice-viewer` | Sales Orders, Sales Invoices, and Quotations with line totals | Item, stock, party, and payment navigation plus guarded Submit/Cancel actions. |
201
+ | `stock-viewer` | Stock balance table with color-coded qty badges | Item details, recent movements, stock charts, and stock-entry navigation. |
202
+ | `chart-viewer` | Universal chart renderer (12 types via Recharts) | Exact point/series navigation and active-context selection across simple and composed charts. |
203
+ | `kanban-viewer` | Read-write kanban for Task, Opportunity, Issue | Drag-and-drop, inline editing, serialized saves, and typed related-document navigation. |
204
+ | `kpi-viewer` | Big number card with delta, sparkline, trend | Number and trend navigation with bounded active-context selection. |
205
+ | `funnel-viewer` | Trapezoid sales funnel with conversion rates | Period-aware stage navigation and bounded active-context selection. |
206
+
207
+ ### Navigation and active context
208
+
209
+ Viewers progressively select the best interaction supported by the host:
210
+
211
+ - `serverTools` opens typed list, record, and chart targets inside the current
212
+ viewer through `app.callServerTool()`. Back and breadcrumb navigation restore
213
+ the state of each level.
214
+ - `downloadFile` lets the host confirm and save an attachment returned as a
215
+ bounded embedded resource. The viewer never opens an ERPNext file URL
216
+ directly.
217
+ - `updateModelContext` lets chart, KPI, and funnel selections join a bounded
218
+ active-context snapshot. The compact context chip keeps up to eight items and
219
+ lets users remove one item or clear them all. The snapshot contains selected
220
+ values, never hidden instructions for the model.
221
+ - `message.text` keeps `app.sendMessage()` as a conversational fallback when
222
+ direct navigation or context replacement is unavailable.
223
+ - Without these capabilities, local inspection remains available and unsupported
224
+ remote actions are omitted.
225
+
226
+ The server supplies typed navigation metadata and the exact `_availableTools`
227
+ allowed for each viewer, so category-filtered deployments do not expose tools
228
+ that are not loaded.
205
229
 
206
230
  ### Refresh model
207
231
 
208
- All viewers carry a `refreshRequest` payload for safe revalidation via
209
- `app.callServerTool()`:
210
-
211
- - `kanban-viewer` revalidates after mutations and on focus
212
- - All other viewers support focus refresh + manual refresh button
232
+ Read-only viewers revalidate on focus and through their refresh control.
233
+ Mutations use an explicit read-only request to fetch committed state; a mutating
234
+ tool is never replayed automatically. Overlapping or stale responses are ignored
235
+ when a newer host payload or mutation has already won. A confirmed document
236
+ change marks every potentially derived snapshot in the current navigation stack
237
+ as stale; each marker is removed only when that surface has actually been read
238
+ again. Separate MCP Apps are not synchronized automatically in beta 2.
213
239
 
214
240
  ### Building UI viewers
215
241
 
216
242
  ```bash
217
243
  cd src/ui
218
- npm install
244
+ npm ci
219
245
  node build-all.mjs
220
246
  ```
221
247
 
222
248
  ## Tools
223
249
 
224
- Each `_list` tool returns interactive results via the doclist-viewer with row
225
- click, inline detail, and cross-viewer navigation.
250
+ Record `_list` tools return interactive results via the doclist-viewer with row
251
+ click, inline detail, and cross-viewer navigation. The attachment-specific
252
+ `erpnext_file_list` tool does not render doclist-viewer. Generic and dedicated
253
+ document reads use `doc-viewer`, except Sales Order, Sales Invoice, and
254
+ Quotation, which retain the specialized invoice surface.
226
255
 
227
256
  - **Sales** — Customers, Sales Orders, Invoices, and Quotations with full CRUD,
228
257
  Submit, and Cancel.
@@ -237,8 +266,9 @@ click, inline detail, and cross-viewer navigation.
237
266
  - **Manufacturing** — BOMs, Work Orders, and Job Cards.
238
267
  - **CRM** — Leads, Opportunities, Contacts, and Campaigns.
239
268
  - **Assets** — Assets, Movements, Maintenance records, and Categories.
240
- - **Operations** — Generic CRUD, native assignment, and file upload for any
241
- DocType (`erpnext_doc_*`, `erpnext_file_upload`).
269
+ - **Operations** — Generic CRUD, native assignment, and attachment listing,
270
+ upload, or host-mediated download for any DocType (`erpnext_doc_*`,
271
+ `erpnext_file_*`).
242
272
  - **Kanban** — Read-write boards for Task, Opportunity, and Issue with
243
273
  drag-and-drop.
244
274
  - **Analytics** — Charts (bar, area, treemap, radar, scatter, P&L…), KPIs with
@@ -249,13 +279,14 @@ Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
249
279
 
250
280
  ## Environment Variables
251
281
 
252
- | Variable | Required | Description |
253
- | -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
254
- | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
255
- | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
256
- | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
257
- | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
258
- | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** see below |
282
+ | Variable | Required | Description |
283
+ | ---------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
284
+ | `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
285
+ | `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
286
+ | `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
287
+ | `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
288
+ | `ERPNEXT_MAX_DOWNLOAD_BYTES` | No | Maximum attachment-download size in bytes (positive integer; default: 10 MiB) |
289
+ | `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
259
290
 
260
291
  MRTR is opt-in. Without this key, or when the client does not advertise
261
292
  elicitation, ambiguous links keep returning the existing actionable ambiguity