@casys/mcp-erpnext 2.6.0 → 3.0.1
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 +43 -129
- package/mcp-erpnext.mjs +5088 -1858
- 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
|
@@ -75,6 +75,17 @@ See the [CHANGELOG](CHANGELOG.md) for the full release history, or the
|
|
|
75
75
|
[latest release](https://github.com/Casys-AI/mcp-erpnext/releases/latest) for
|
|
76
76
|
the current version's highlights.
|
|
77
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
|
+
|
|
78
89
|
## Quick Start
|
|
79
90
|
|
|
80
91
|
### Prerequisites
|
|
@@ -148,30 +159,9 @@ Add to `.vscode/mcp.json`:
|
|
|
148
159
|
|
|
149
160
|
### HTTP mode
|
|
150
161
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
ERPNEXT_API_SECRET=xxx \
|
|
155
|
-
npx -y @casys/mcp-erpnext --http --port=3012
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
> **Note:** HTTP mode binds to `127.0.0.1` (loopback) by default as of v2.4.2.
|
|
159
|
-
> For Docker or multi-host setups, add `--hostname=0.0.0.0`.
|
|
160
|
-
|
|
161
|
-
### Deno (HTTP mode)
|
|
162
|
-
|
|
163
|
-
```bash
|
|
164
|
-
ERPNEXT_URL=http://localhost:8000 \
|
|
165
|
-
ERPNEXT_API_KEY=xxx \
|
|
166
|
-
ERPNEXT_API_SECRET=xxx \
|
|
167
|
-
deno run -A npm:@casys/mcp-erpnext --http --port=3012
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
> **Note:** Versions ≤ 2.3.1 of the npm bundle crashed with
|
|
171
|
-
> `ReferenceError: Deno is not defined` in HTTP mode — fixed in 2.4.0
|
|
172
|
-
> (`@casys/mcp-server` ≥ 0.21.1). If you hit this error, upgrade with
|
|
173
|
-
> `npx -y @casys/mcp-erpnext@latest`, or use the Deno runner above. See
|
|
174
|
-
> [`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.
|
|
175
165
|
|
|
176
166
|
### Category filtering
|
|
177
167
|
|
|
@@ -183,18 +173,9 @@ npx -y @casys/mcp-erpnext --categories=sales,inventory
|
|
|
183
173
|
|
|
184
174
|
## Fresh Instance Setup
|
|
185
175
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
```
|
|
190
|
-
1. Warehouse Types: Transit, Default
|
|
191
|
-
2. UOMs: Nos, Kg, Unit, Set, Meter
|
|
192
|
-
3. Item Groups: All Item Groups (is_group=1), then Products, Raw Material (parent=All Item Groups)
|
|
193
|
-
4. Territories: All Territories (is_group=1), then France, etc.
|
|
194
|
-
5. Customer Groups: All Customer Groups (is_group=1), then Commercial, etc.
|
|
195
|
-
6. Supplier Groups: All Supplier Groups (is_group=1), then Hardware, etc.
|
|
196
|
-
7. Company: requires Warehouse Types to exist first
|
|
197
|
-
```
|
|
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).
|
|
198
179
|
|
|
199
180
|
## UI Viewers
|
|
200
181
|
|
|
@@ -272,113 +253,46 @@ Full per-tool reference with parameters: [`docs/tools.md`](docs/tools.md).
|
|
|
272
253
|
|
|
273
254
|
## Environment Variables
|
|
274
255
|
|
|
275
|
-
| Variable | Required | Description
|
|
276
|
-
| -------------------------- | -------- |
|
|
277
|
-
| `ERPNEXT_URL` | Yes | ERPNext base URL — self-hosted (e.g. `http://localhost:8000`) or cloud (e.g. `https://mycompany.erpnext.com`)
|
|
278
|
-
| `ERPNEXT_API_KEY` | Yes | API Key from User Settings
|
|
279
|
-
| `ERPNEXT_API_SECRET` | Yes | API Secret from User Settings
|
|
280
|
-
| `ERPNEXT_MAX_UPLOAD_BYTES` | No | Maximum decoded file-upload size in bytes (positive integer; default: 10 MiB)
|
|
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.
|
|
281
279
|
|
|
282
280
|
## Architecture
|
|
283
281
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
deno.json # Package config
|
|
288
|
-
src/
|
|
289
|
-
api/
|
|
290
|
-
frappe-client.ts # Frappe REST HTTP client (zero-dependency)
|
|
291
|
-
types.ts # Frappe type definitions
|
|
292
|
-
kanban/
|
|
293
|
-
adapters/ # Per-DocType kanban adapters (task, opportunity, issue)
|
|
294
|
-
definitions.ts # Board registry
|
|
295
|
-
types.ts # Shared kanban contracts
|
|
296
|
-
tools/
|
|
297
|
-
sales.ts # 17 sales tools
|
|
298
|
-
inventory.ts # 9 inventory tools
|
|
299
|
-
purchasing.ts # 11 purchasing tools
|
|
300
|
-
accounting.ts # 6 accounting tools
|
|
301
|
-
hr.ts # 12 HR tools
|
|
302
|
-
project.ts # 9 project tools
|
|
303
|
-
delivery.ts # 5 delivery tools
|
|
304
|
-
manufacturing.ts # 7 manufacturing tools
|
|
305
|
-
crm.ts # 8 CRM tools
|
|
306
|
-
assets.ts # 8 asset tools
|
|
307
|
-
operations.ts # 10 generic operations tools
|
|
308
|
-
setup.ts # 3 company/setup tools
|
|
309
|
-
kanban.ts # 2 read-write kanban tools
|
|
310
|
-
analytics.ts # 17 analytics tools (charts, KPIs, funnel)
|
|
311
|
-
ui-refresh.ts # Auto-inject _rowAction, _sendMessageHints, _drillDown
|
|
312
|
-
mod.ts # Tool registry
|
|
313
|
-
types.ts # Tool interface
|
|
314
|
-
client.ts # ErpNextToolsClient
|
|
315
|
-
runtime.ts # Deno runtime adapter
|
|
316
|
-
runtime.node.ts # Node.js runtime adapter
|
|
317
|
-
*_test.ts # Tests are colocated with source files
|
|
318
|
-
ui/
|
|
319
|
-
shared/ # ActionButton, InfoField, theme, branding, refresh
|
|
320
|
-
doclist-viewer/ # Generic document list (inline detail, chip filters)
|
|
321
|
-
invoice-viewer/ # Invoice display (item drill-down, actions)
|
|
322
|
-
stock-viewer/ # Stock balance (detail panel, sendMessage)
|
|
323
|
-
chart-viewer/ # Universal chart renderer (12 types, click drill-down)
|
|
324
|
-
kanban-viewer/ # Read-write kanban (drag, edit, sendMessage)
|
|
325
|
-
kpi-viewer/ # KPI card (clickable number + sparkline)
|
|
326
|
-
funnel-viewer/ # Sales funnel (trapezoid stages, click-through)
|
|
327
|
-
viewers.ts # Viewer registry
|
|
328
|
-
docs/
|
|
329
|
-
ROADMAP.md # Feature roadmap
|
|
330
|
-
coverage.md # Test coverage matrix
|
|
331
|
-
```
|
|
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).
|
|
332
285
|
|
|
333
286
|
## npm Package
|
|
334
287
|
|
|
335
288
|
The npm package (`@casys/mcp-erpnext`) is a single self-contained bundle with
|
|
336
289
|
zero runtime dependencies. UI viewers are embedded. Requires Node >= 20.
|
|
337
290
|
|
|
338
|
-
## Development
|
|
339
|
-
|
|
340
|
-
```bash
|
|
341
|
-
# Run tests
|
|
342
|
-
deno test --allow-all src/
|
|
343
|
-
|
|
344
|
-
# Type check
|
|
345
|
-
deno task check
|
|
346
|
-
|
|
347
|
-
# Start HTTP server (dev)
|
|
348
|
-
deno task serve
|
|
349
|
-
|
|
350
|
-
# Launch MCP Inspector
|
|
351
|
-
deno task inspect
|
|
352
|
-
|
|
353
|
-
# Build UI viewers
|
|
354
|
-
deno task ui:build
|
|
355
|
-
|
|
356
|
-
# Full local release preflight (no publish)
|
|
357
|
-
deno task release:check
|
|
358
|
-
|
|
359
|
-
# Dev a specific viewer with HMR
|
|
360
|
-
cd src/ui && npm run dev:kanban
|
|
361
|
-
```
|
|
362
|
-
|
|
363
291
|
## Contributing
|
|
364
292
|
|
|
365
293
|
Contributions are welcome — see **[CONTRIBUTING.md](CONTRIBUTING.md)** to get
|
|
366
294
|
started, and [AGENTS.md](AGENTS.md) for the full architecture and conventions.
|
|
367
295
|
|
|
368
|
-
## Release Flow
|
|
369
|
-
|
|
370
|
-
Releases are manual and explicit:
|
|
371
|
-
|
|
372
|
-
1. Update `deno.json`, `server.ts`, and `CHANGELOG.md`.
|
|
373
|
-
2. Run `deno task release:check` locally.
|
|
374
|
-
3. Commit and push the release commit to `main`.
|
|
375
|
-
4. Create the GitHub release/tag, for example `v2.3.0`.
|
|
376
|
-
5. Run the `Publish` workflow manually to publish the same version to JSR and
|
|
377
|
-
npm.
|
|
378
|
-
|
|
379
|
-
The package name stays `@casys/mcp-erpnext`; releases only bump the package
|
|
380
|
-
version.
|
|
381
|
-
|
|
382
296
|
## License
|
|
383
297
|
|
|
384
298
|
MIT
|