First-party app
ERPNext

ERPNext

Read and write ERPNext documents — any DocType — over Frappe's generic REST API, plus the submit/cancel document lifecycle.

stable Finance & AccountingCustomer Relationship ManagementHuman Resources

About

ERPNext ships in the w6w first-party pack. It declares 10 actions, 2 health checks, and the host runs its code in a sandbox that never sees the credential.

App id
io.w6w.erpnext
Version
0.1.0
Author
w6w
Licence
MIT
Categories
Finance & Accounting · Customer Relationship Management · Human Resources

Overview

ERPNext is an open-source, self-hosted ERP built on the Frappe framework, and Frappe does not expose per-business-object endpoints the way a SaaS CRM does — it exposes its own metadata layer, so every Customer, Sales Order, Item, Lead or Employee is a “DocType” reachable through one generic REST surface: /api/resource/<doctype>. This app wraps that surface rather than guessing at a fixed schema, because which DocTypes and fields exist depends entirely on which ERPNext modules and customizations a given install has turned on.

It covers the full document lifecycle any DocType shares: list with Frappe’s own filter/field/sort/paging language, read one by name, create, update and delete. On top of that it adds ERPNext’s submit/cancel workflow — the draft → submitted → cancelled state machine that Sales Orders, Purchase Orders, Sales Invoices and most transactional DocTypes use to move from an editable draft to a posted, accounting-relevant document — plus a record count and a whitelisted remote-method escape hatch for business logic no generic CRUD call reaches.

Good for creating a Customer or Lead from an external form, submitting a Sales Order once a workflow’s own approval step clears, keeping an Item catalog in sync with an outside pricing tool, or reaching any other DocType an installation exposes without waiting for a dedicated action to be written for it.

Build with ERPNext

Three routes to the same 10 actions. The Workflow tab is generated from ERPNext's own manifest and carries its real ids, so it is copy-pasteable; the Code and CLI examples are the same call for any action on any app, so every app-specific value in them is a blank you fill in.

Call Method

call-method

Call any whitelisted Frappe/ERPNext method directly, for business logic no generic document action reaches — e.g. `frappe.client.get_list`, or a method a custom app adds. Runs with exactly the connected User's permissions.

Cancel Document

cancel-document

Cancel a submitted document (Sales Order, Purchase Order, Sales Invoice, or any other submittable DocType). Only a submitted document can be cancelled.

Count Documents

count-documents

Count documents of any DocType matching a filter, using the framework's `frappe.client.get_count`, without fetching the records themselves.

Create Document

create-document

Create a new document of any DocType — Customer, Sales Order, Item, Lead, or any other DocType this site has installed.

Delete Document

delete-document

Permanently delete a document of any DocType by its `name`. Submitted documents must be cancelled first — Frappe refuses to delete them directly.

Get Document

get-document

Read one document of any DocType by its `name` (Frappe's primary key, not a display title).

Get Logged-In User

get-logged-user

Return the User this connection's API Key belongs to.

List Documents

list-documents

List records of any DocType — Customer, Sales Order, Item, Lead, or any other DocType this site has installed — with Frappe's own filter, field-selection, sort and paging parameters.

Submit Document

submit-document

Submit a draft document (Sales Order, Purchase Order, Sales Invoice, or any other submittable DocType), moving it from Draft to Submitted. Pass the FULL document — the output of Get Document — not just its doctype and name.

Update Document

update-document

Update a document of any DocType by its `name`. Only the fields present in Values are changed — everything else is left alone.

A workflow step names the app and the action, and the editor fills in the connection when you pick one. This is the Step shape from the workflow spec, carrying ERPNext's real ids.

{
  "manifestVersion": "2",
  "name": "erpnext-example",
  "steps": [
    {
      "id": "call-method",
      "uses": {
        "app": "io.w6w.erpnext",
        "action": "call-method",
        "connection": "conn_YOUR_CONNECTION_ID"
      },
      "with": {
        "method": "<method>",
        "httpMethod": "<httpMethod>"
      }
    }
  ]
}

Here are some of the things you can do

  • Call Method

    perform
    call-method
  • Count Documents

    read
    count-documents
  • Create Document

    perform
    create-document
  • Get Document

    read
    get-document
  • Get Logged-In User

    read
    get-logged-user

+5 more actions available

Every app-specific value here is a blank you have to fill in. An app action is reached through the connection that authenticates it, so the address is a connection id, not the app id — and connections belong to your account, so a public page cannot know yours. Create one for ERPNext, then fill in the three blanks: conn_YOUR_CONNECTION_ID, the action key, and the parameters that action declares. The call itself is real — the shape is transcribed from the studio's own snippet builder, which prints the same kind of blanks — but nothing in it is specific to ERPNext. The Workflow tab is where this app's real ids are.

Install
npm install @w6w/sdk
yarn add @w6w/sdk
pnpm add @w6w/sdk
deno add npm:@w6w/sdk
Code
import { W6wClient, isActionRun } from "@w6w/sdk";

// Reads W6W_BASE_URL and W6W_TOKEN from the environment when omitted.
const client = new W6wClient();

const envelope = await client.run({
  urn: "conn_YOUR_CONNECTION_ID",
  action: "call-method",
  payload: {
    method: "<value>",
    httpMethod: "<value>",
    // args: "<value>",
  },
});

if (isActionRun(envelope)) console.log(envelope.value);
Install the CLI
npm install -g @w6w/cli
CLI
w6w run conn_YOUR_CONNECTION_ID --action call-method --payload '{"method":"<value>","httpMethod":"<value>"}'

Give an AI agent ERPNext — without giving it ERPNext's credentials. One MCP endpoint exposes every app, function and workflow the caller is entitled to, as tools it can discover and run. Access is granted per team while we onboard.

One tool call
{
  "name": "w6w_invoke",
  "arguments": {
    "ref": "app:io.w6w.erpnext#call-method",
    "input": {
      "method": "<method>",
      "httpMethod": "<httpMethod>"
    }
  }
}

Every tool names its target with a single ref. The app: form above doesn't name a connection at all — the host resolves which of the caller's ERPNext connections to sign with, and refuses rather than guesses when the answer is ambiguous.

What the agent gets

Credentials it can't read

The token is attached host-side, at the moment of the call. It is never a tool argument, never in the model's context, and never in a transcript — so a prompt injection has nothing to exfiltrate.

A tool surface scoped to the caller

Tools are derived per end user from what that person has actually connected and is entitled to — not one shared bot identity carrying the union of everyone's access.

A durable workflow in one call

Multi-step work runs on the workflow engine and returns a run handle the agent can poll — retries, branching and state survive the conversation that started them.

Health-aware discovery

ERPNext's declared health checks are on the surface too, so an agent can tell "the vendor is down" from "your credential expired" before it burns a retry on either.

The MCP surface is part of the hosted platform. ERPNext itself is MIT, and the runtime that executes it is source-available (FSL).

Request MCP access

Health checks

ERPNext declares its own checks, so its health is a property of the app rather than something the host guesses at.

dependency

ERPNext site reachable

This connection's own site, probed unsigned against frappe.auth.get_logged_user. Frappe's own 403 'login to access' refusal proves the site is answering as Frappe — no credential is sent, so an expired API Secret must not make the site look down.

service

ERPNext platform status