@casys/mcp-erpnext 2.5.0 → 3.0.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/README.md +50 -133
- package/mcp-erpnext.mjs +4257 -1434
- package/package.json +1 -1
- package/ui-dist/chart-viewer/index.html +1 -1
- package/ui-dist/doclist-viewer/index.html +1 -1
- package/ui-dist/funnel-viewer/index.html +1 -1
- package/ui-dist/invoice-viewer/index.html +1 -1
- package/ui-dist/kanban-viewer/index.html +1 -1
- package/ui-dist/kpi-viewer/index.html +1 -1
- package/ui-dist/stock-viewer/index.html +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
English | [繁體中文](README.zh-TW.md)
|
|
2
|
+
|
|
1
3
|
# @casys/mcp-erpnext
|
|
2
4
|
|
|
3
5
|
[](https://jsr.io/@casys/mcp-erpnext)
|
|
@@ -6,7 +8,7 @@
|
|
|
6
8
|
[](https://modelcontextprotocol.io)
|
|
7
9
|
[](LICENSE)
|
|
8
10
|
|
|
9
|
-
MCP server for [ERPNext](https://erpnext.com) / Frappe ERP — **
|
|
11
|
+
MCP server for [ERPNext](https://erpnext.com) / Frappe ERP — **124 tools**
|
|
10
12
|
across **14 categories**, with **7 interactive UI viewers**.
|
|
11
13
|
|
|
12
14
|
Connect any MCP-compatible AI agent (Claude Desktop, Claude Code, VS Code
|
|
@@ -73,6 +75,17 @@ See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
|
|
|
73
75
|
[latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
|
|
74
76
|
the current version's highlights.
|
|
75
77
|
|
|
78
|
+
## Documentation
|
|
79
|
+
|
|
80
|
+
Organised by what you are doing, following [Diátaxis](https://diataxis.fr):
|
|
81
|
+
|
|
82
|
+
| | |
|
|
83
|
+
| ------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
84
|
+
| **Learning** — never used this before | [Your first tool call](docs/tutorial-first-tool-call.md) — from nothing to a working response in four steps |
|
|
85
|
+
| **Doing** — you have a specific goal | [Seed a blank ERPNext instance](docs/fresh-instance-setup.md) · [Run the HTTP server](docs/http-deployment.md) · [Set up OAuth](docs/oauth-setup.md) · [Migrate to 2026-07-28](docs/migration-mcp-spec-2026-07-28.md) |
|
|
86
|
+
| **Looking something up** | [Tools](docs/tools.md) · [Environment variables](docs/environment-variables.md) · [DocType coverage](docs/coverage.md) |
|
|
87
|
+
| **Understanding why** | [Concepts](docs/concepts.md) — link resolution, transports, MRTR, and which cache does what · [ERPNext quirks](docs/erpnext-quirks.md) |
|
|
88
|
+
|
|
76
89
|
## Quick Start
|
|
77
90
|
|
|
78
91
|
### Prerequisites
|
|
@@ -146,30 +159,9 @@ Add to `.vscode/mcp.json`:
|
|
|
146
159
|
|
|
147
160
|
### HTTP mode
|
|
148
161
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
ERPNEXT_API_SECRET=xxx \
|
|
153
|
-
npx -y @casys/mcp-erpnext --http --port=3012
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
> **Note:** HTTP mode binds to `127.0.0.1` (loopback) by default as of v2.4.2.
|
|
157
|
-
> For Docker or multi-host setups, add `--hostname=0.0.0.0`.
|
|
158
|
-
|
|
159
|
-
### Deno (HTTP mode)
|
|
160
|
-
|
|
161
|
-
```bash
|
|
162
|
-
ERPNEXT_URL=http://localhost:8000 \
|
|
163
|
-
ERPNEXT_API_KEY=xxx \
|
|
164
|
-
ERPNEXT_API_SECRET=xxx \
|
|
165
|
-
deno run -A npm:@casys/mcp-erpnext --http --port=3012
|
|
166
|
-
```
|
|
167
|
-
|
|
168
|
-
> **Note:** Versions ≤ 2.3.1 of the npm bundle crashed with
|
|
169
|
-
> `ReferenceError: Deno is not defined` in HTTP mode — fixed in 2.4.0
|
|
170
|
-
> (`@casys/mcp-server` ≥ 0.21.1). If you hit this error, upgrade with
|
|
171
|
-
> `npx -y @casys/mcp-erpnext@latest`, or use the Deno runner above. See
|
|
172
|
-
> [`docs/known-issues.md`](docs/known-issues.md).
|
|
162
|
+
For a shared, always-on server rather than one process per client:
|
|
163
|
+
[how to run the HTTP server](docs/http-deployment.md). Note it is breaking for
|
|
164
|
+
pre-2026 HTTP clients in 3.0.0.
|
|
173
165
|
|
|
174
166
|
### Category filtering
|
|
175
167
|
|
|
@@ -181,18 +173,9 @@ npx -y @casys/mcp-erpnext --categories=sales,inventory
|
|
|
181
173
|
|
|
182
174
|
## Fresh Instance Setup
|
|
183
175
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
```
|
|
188
|
-
1. Warehouse Types: Transit, Default
|
|
189
|
-
2. UOMs: Nos, Kg, Unit, Set, Meter
|
|
190
|
-
3. Item Groups: All Item Groups (is_group=1), then Products, Raw Material (parent=All Item Groups)
|
|
191
|
-
4. Territories: All Territories (is_group=1), then France, etc.
|
|
192
|
-
5. Customer Groups: All Customer Groups (is_group=1), then Commercial, etc.
|
|
193
|
-
6. Supplier Groups: All Supplier Groups (is_group=1), then Hardware, etc.
|
|
194
|
-
7. Company: requires Warehouse Types to exist first
|
|
195
|
-
```
|
|
176
|
+
A blank ERPNext instance has no master data, so business tools fail validation
|
|
177
|
+
until it exists. See
|
|
178
|
+
[Seed a blank ERPNext instance](docs/fresh-instance-setup.md).
|
|
196
179
|
|
|
197
180
|
## UI Viewers
|
|
198
181
|
|
|
@@ -239,9 +222,9 @@ npm install
|
|
|
239
222
|
node build-all.mjs
|
|
240
223
|
```
|
|
241
224
|
|
|
242
|
-
## Tools (
|
|
225
|
+
## Tools (124)
|
|
243
226
|
|
|
244
|
-
|
|
227
|
+
124 tools across 14 categories. Each `_list` tool returns interactive results
|
|
245
228
|
via the doclist-viewer with row click, inline detail, and cross-viewer
|
|
246
229
|
navigation.
|
|
247
230
|
|
|
@@ -258,8 +241,8 @@ navigation.
|
|
|
258
241
|
- **Manufacturing** (7) — BOMs, Work Orders, and Job Cards.
|
|
259
242
|
- **CRM** (8) — Leads, Opportunities, Contacts, and Campaigns.
|
|
260
243
|
- **Assets** (8) — Assets, Movements, Maintenance records, and Categories.
|
|
261
|
-
- **Operations** (
|
|
262
|
-
(`erpnext_doc_
|
|
244
|
+
- **Operations** (10) — Generic CRUD, native assignment, and file upload for any
|
|
245
|
+
DocType (`erpnext_doc_*`, `erpnext_file_upload`).
|
|
263
246
|
- **Kanban** (2) — Read-write boards for Task, Opportunity, and Issue with
|
|
264
247
|
drag-and-drop.
|
|
265
248
|
- **Analytics** (17) — 11 analytics charts (bar, area, treemap, radar, scatter,
|
|
@@ -270,112 +253,46 @@ Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
|
|
|
270
253
|
|
|
271
254
|
## Environment Variables
|
|
272
255
|
|
|
273
|
-
| Variable
|
|
274
|
-
|
|
|
275
|
-
| `ERPNEXT_URL`
|
|
276
|
-
| `ERPNEXT_API_KEY`
|
|
277
|
-
| `ERPNEXT_API_SECRET`
|
|
256
|
+
| Variable | Required | Description |
|
|
257
|
+
| -------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------- |
|
|
258
|
+
| `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`) |
|
|
259
|
+
| `ERPNEXT_API_KEY` | Yes | API Key from User Settings |
|
|
260
|
+
| `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings |
|
|
261
|
+
| `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB) |
|
|
262
|
+
| `MCP_MRTR_SIGNING_KEY` | No | Exactly 64 lowercase hex characters; enables signed ambiguous-link elicitation. **Single-instance deployments only** — see below |
|
|
263
|
+
|
|
264
|
+
MRTR is opt-in. Without this key, or when the client does not advertise
|
|
265
|
+
elicitation, ambiguous links keep returning the existing actionable ambiguity
|
|
266
|
+
error instead of prompting for a selection.
|
|
267
|
+
|
|
268
|
+
> **Do not run MRTR behind a load balancer with this configuration.** The
|
|
269
|
+
> signing key proves a retry token is authentic; it does not make it single-use.
|
|
270
|
+
> That is the job of a replay store, and the default one is process-local. Share
|
|
271
|
+
> the key across two instances and the same signed retry validates on both —
|
|
272
|
+
> creating the purchase order, leave application or expense claim **twice**,
|
|
273
|
+
> irreversibly once submitted.
|
|
274
|
+
>
|
|
275
|
+
> A multi-instance deployment must pass a shared atomic `mrtr.replayStore` to
|
|
276
|
+
> `McpApp` (Redis satisfies the contract with `SET key 1 NX EXAT`). The
|
|
277
|
+
> framework logs a warning at startup whenever MRTR is enabled without one —
|
|
278
|
+
> that warning is not noise, it is this paragraph.
|
|
278
279
|
|
|
279
280
|
## Architecture
|
|
280
281
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
deno.json # Package config
|
|
285
|
-
src/
|
|
286
|
-
api/
|
|
287
|
-
frappe-client.ts # Frappe REST HTTP client (zero-dependency)
|
|
288
|
-
types.ts # Frappe type definitions
|
|
289
|
-
kanban/
|
|
290
|
-
adapters/ # Per-DocType kanban adapters (task, opportunity, issue)
|
|
291
|
-
definitions.ts # Board registry
|
|
292
|
-
types.ts # Shared kanban contracts
|
|
293
|
-
tools/
|
|
294
|
-
sales.ts # 17 sales tools
|
|
295
|
-
inventory.ts # 9 inventory tools
|
|
296
|
-
purchasing.ts # 11 purchasing tools
|
|
297
|
-
accounting.ts # 6 accounting tools
|
|
298
|
-
hr.ts # 12 HR tools
|
|
299
|
-
project.ts # 9 project tools
|
|
300
|
-
delivery.ts # 5 delivery tools
|
|
301
|
-
manufacturing.ts # 7 manufacturing tools
|
|
302
|
-
crm.ts # 8 CRM tools
|
|
303
|
-
assets.ts # 8 asset tools
|
|
304
|
-
operations.ts # 9 generic CRUD tools
|
|
305
|
-
setup.ts # 3 company/setup tools
|
|
306
|
-
kanban.ts # 2 read-write kanban tools
|
|
307
|
-
analytics.ts # 17 analytics tools (charts, KPIs, funnel)
|
|
308
|
-
ui-refresh.ts # Auto-inject _rowAction, _sendMessageHints, _drillDown
|
|
309
|
-
mod.ts # Tool registry
|
|
310
|
-
types.ts # Tool interface
|
|
311
|
-
client.ts # ErpNextToolsClient
|
|
312
|
-
runtime.ts # Deno runtime adapter
|
|
313
|
-
runtime.node.ts # Node.js runtime adapter
|
|
314
|
-
*_test.ts # Tests are colocated with source files
|
|
315
|
-
ui/
|
|
316
|
-
shared/ # ActionButton, InfoField, theme, branding, refresh
|
|
317
|
-
doclist-viewer/ # Generic document list (inline detail, chip filters)
|
|
318
|
-
invoice-viewer/ # Invoice display (item drill-down, actions)
|
|
319
|
-
stock-viewer/ # Stock balance (detail panel, sendMessage)
|
|
320
|
-
chart-viewer/ # Universal chart renderer (12 types, click drill-down)
|
|
321
|
-
kanban-viewer/ # Read-write kanban (drag, edit, sendMessage)
|
|
322
|
-
kpi-viewer/ # KPI card (clickable number + sparkline)
|
|
323
|
-
funnel-viewer/ # Sales funnel (trapezoid stages, click-through)
|
|
324
|
-
viewers.ts # Viewer registry
|
|
325
|
-
docs/
|
|
326
|
-
ROADMAP.md # Feature roadmap
|
|
327
|
-
coverage.md # Test coverage matrix
|
|
328
|
-
```
|
|
282
|
+
Tools are grouped by business domain under `src/tools/`, the Frappe REST client
|
|
283
|
+
is dependency-free, and each UI viewer is a separate build under `src/ui/`. Full
|
|
284
|
+
layout: [repository layout](docs/architecture.md).
|
|
329
285
|
|
|
330
286
|
## npm Package
|
|
331
287
|
|
|
332
288
|
The npm package (`@casys/mcp-erpnext`) is a single self-contained bundle with
|
|
333
289
|
zero runtime dependencies. UI viewers are embedded. Requires Node >= 20.
|
|
334
290
|
|
|
335
|
-
## Development
|
|
336
|
-
|
|
337
|
-
```bash
|
|
338
|
-
# Run tests
|
|
339
|
-
deno test --allow-all src/
|
|
340
|
-
|
|
341
|
-
# Type check
|
|
342
|
-
deno task check
|
|
343
|
-
|
|
344
|
-
# Start HTTP server (dev)
|
|
345
|
-
deno task serve
|
|
346
|
-
|
|
347
|
-
# Launch MCP Inspector
|
|
348
|
-
deno task inspect
|
|
349
|
-
|
|
350
|
-
# Build UI viewers
|
|
351
|
-
deno task ui:build
|
|
352
|
-
|
|
353
|
-
# Full local release preflight (no publish)
|
|
354
|
-
deno task release:check
|
|
355
|
-
|
|
356
|
-
# Dev a specific viewer with HMR
|
|
357
|
-
cd src/ui && npm run dev:kanban
|
|
358
|
-
```
|
|
359
|
-
|
|
360
291
|
## Contributing
|
|
361
292
|
|
|
362
293
|
Contributions are welcome — see **[CONTRIBUTING.md](CONTRIBUTING.md)** to get
|
|
363
294
|
started, and [AGENTS.md](AGENTS.md) for the full architecture and conventions.
|
|
364
295
|
|
|
365
|
-
## Release Flow
|
|
366
|
-
|
|
367
|
-
Releases are manual and explicit:
|
|
368
|
-
|
|
369
|
-
1. Update `deno.json`, `server.ts`, and `CHANGELOG.md`.
|
|
370
|
-
2. Run `deno task release:check` locally.
|
|
371
|
-
3. Commit and push the release commit to `main`.
|
|
372
|
-
4. Create the GitHub release/tag, for example `v2.3.0`.
|
|
373
|
-
5. Run the `Publish` workflow manually to publish the same version to JSR and
|
|
374
|
-
npm.
|
|
375
|
-
|
|
376
|
-
The package name stays `@casys/mcp-erpnext`; releases only bump the package
|
|
377
|
-
version.
|
|
378
|
-
|
|
379
296
|
## License
|
|
380
297
|
|
|
381
298
|
MIT
|