Skip to main content
Glama
ERPNext MCP Server

ERPNext MCP Server

by hatlabs

ERPNext MCP Server

A Model Context Protocol server that connects MCP-compatible AI tools to ERPNext. It gives your AI assistant full read/write access to your ERPNext instance — inventory, manufacturing, sales, purchasing, and reporting — through natural language.

Originally forked from rakeshgangwar/erpnext-mcp-server. This fork adds API key authentication, minimal response optimization, and additional tools for document lifecycle management and server-side method calls.

What You Can Do

Once connected, you interact with ERPNext through natural conversation with your AI assistant. Here are examples from real-world usage:

Inventory & Stock

  • "Check stock levels for all components in the HALPI2 BOM — do we have enough to build 10 units?"

  • "Create a stock reconciliation to set the actual quantity of SOM-CM5108000 to 15 in Stores"

  • "Record a material receipt for the 200 PCBs we received from JLCPCB"

Manufacturing

  • "Complete work orders for the 8 HALPI2 units I assembled this week and create the manufacture stock entries"

  • "The open work orders reference obsolete BOMs with disabled components — cancel and amend them with the current default BOMs"

  • "Manufacture 5 units from work order MFG-WO-2026-00014, substituting CM5-lite modules for the standard ones"

Sales & Fulfillment

  • "Shopify orders #A2399 and #A2402 have been fulfilled — find the corresponding ERPNext sales orders and create delivery notes"

  • "Which fulfilled Shopify orders are missing delivery notes in ERPNext?"

Note: Cross-system workflows involving Shopify require a separate Shopify MCP server (e.g., shopify-mcp) running alongside this one. The AI assistant uses both servers together seamlessly.

BOMs & Products

  • "Update all active HALPI2 BOMs to replace the old enclosure sub-assembly with the new one"

  • "Show me the full component breakdown and cost for BOM-COM-HALPI2-007"

  • "Create a new 256GB NVMe SSD item variant under the existing template"

Purchasing

  • "The purchase order has the wrong item on line 4 — it should be SOM-CM5116016, not SOM-CM5116000. Fix the PO and the linked purchase receipt."

Pricing (with Shopify MCP)

  • "Update Shopify prices for all HALPI2 variants to reflect the new ERPNext base prices, adding 25.5% VAT"

  • "Set up a 20% sale on all HALPI2 variants with strikethrough pricing"

Reporting

  • "Run the Stock Balance report for the Stores warehouse"

  • "Find all active BOMs that still reference disabled items"

Related MCP server: Frappe Assistant Core

Prerequisites

  • Node.js 20+

  • An ERPNext instance with API access enabled

  • API key and secret — generate these in ERPNext under Settings > Users > [your user] > API Access > Generate Keys

Installation

Clone and build:

git clone https://github.com/hatlabs/erpnext-mcp-server.git
cd erpnext-mcp-server
npm install
npm run build

Claude Code

claude mcp add erpnext \
  -e ERPNEXT_URL=https://your-erpnext.example.com \
  -e ERPNEXT_API_KEY=your-api-key \
  -e ERPNEXT_API_SECRET=your-api-secret \
  -- node /path/to/erpnext-mcp-server/build/index.js

Claude Desktop

Open Settings > Developer > Edit Config and add the erpnext entry under mcpServers:

{
  "mcpServers": {
    "erpnext": {
      "command": "node",
      "args": ["/path/to/erpnext-mcp-server/build/index.js"],
      "env": {
        "ERPNEXT_URL": "https://your-erpnext.example.com",
        "ERPNEXT_API_KEY": "your-api-key",
        "ERPNEXT_API_SECRET": "your-api-secret"
      }
    }
  }
}

Other MCP Clients

Any MCP-compatible client can use this server. It communicates over stdio and requires three environment variables:

Variable

Description

ERPNEXT_URL

Base URL of your ERPNext instance

ERPNEXT_API_KEY

API key for authentication

ERPNEXT_API_SECRET

API secret for authentication

Tools

The server exposes 10 tools that the AI client discovers automatically through MCP:

Tool

Description

get_doctypes

List all available DocTypes

get_doctype_fields

Get field definitions for a DocType

get_documents

Query documents with filters and field selection

get_document

Get a single document by name, including all child tables

create_document

Create a new document

update_document

Update an existing document

submit_document

Submit a document (set docstatus to 1)

cancel_document

Cancel a submitted document (set docstatus to 2)

call_method

Call a whitelisted server-side API method

run_report

Run an ERPNext report

Development

npm install          # Install dependencies
npm run build        # Compile TypeScript
npm run watch        # Auto-rebuild on changes
npm run lint         # Run linter
npm run format:check # Check formatting
npm run inspector    # Launch MCP Inspector for debugging

The MCP Inspector opens a browser-based UI for testing tool calls interactively.

Available Tools

11 tools
call_methodA

Call an ERPNext/Frappe whitelisted server-side API method. WARNING: This can invoke any whitelisted method including destructive operations — use with caution. Args are passed as JSON body (POST) or query params (GET), with keys matching the method's parameter names.

Inputs: method (required), args, http_method.

cancel_documentA

Cancel a submitted document (set docstatus to 2). Cancelled documents cannot be modified — use amend workflow to create a corrected copy.

Inputs: name (required), doctype (required).

create_documentB

Create a new document in ERPNext

Inputs: data (required), doctype (required).

get_child_documentsA

Query child table rows by joining parent and child DocTypes. Direct child table queries return 403; this tool queries the parent DocType with child table field joins. Returns one row per matching child table row.

Inputs: child_doctype (required), parent_doctype (required), limit, child_fields, +3 more.

get_doctype_fieldsA

Get field definitions for a specific DocType from ERPNext metadata. Returns fieldname, fieldtype, label, options, and reqd for each field.

Inputs: doctype (required).

get_doctypesA

Get a list of all available DocTypes

Inputs: no named parameters.

get_documentA

Get a single document by DocType and name, including child tables. Response is automatically stripped of system metadata and null/default fields. Use 'fields' to select specific top-level fields, and 'child_fields' to select fields within child tables. 'name', 'docstatus', and 'status' are always included.

Inputs: name (required), doctype (required), fields, child_fields.

get_documentsB

Get a list of documents for a specific doctype. ERPNext defaults to 20 results if no limit is specified.

Inputs: doctype (required), limit, fields, filters.

run_reportC

Run an ERPNext report

Inputs: report_name (required), filters.

submit_documentA

Submit a document (set docstatus to 1). This is irreversible — submitted documents can only be cancelled, not reverted to draft.

Inputs: name (required), doctype (required).

update_documentC

Update an existing document in ERPNext

Inputs: data (required), name (required), doctype (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 11 tools

    Disambiguation4/5

    Most tools are clearly separated by resource and action: metadata lookup, document list/single fetch, child-table query, create/update, and lifecycle actions are distinct. The main ambiguity is call_method, which is intentionally generic and could overlap with nearly every specialized tool, though its warning and description make that risk explicit.

    Naming Consistency5/5

    All tool names use consistent snake_case and a predictable verb-first pattern such as get_document, create_document, update_document, submit_document, and cancel_document. The few variations like run_report and get_doctypes still fit the same readable convention.

    Tool Count5/5

    Eleven tools is well-scoped for an ERPNext server: enough to cover metadata discovery, document CRUD-style operations, lifecycle transitions, reports, and generic API access without excessive fragmentation.

    Completeness4/5

    The surface covers core ERPNext workflows including metadata inspection, listing, single-document retrieval, creation, updates, child-table querying, submission/cancellation, reports, and generic method calls. Minor gaps remain around draft deletion and report discovery/metadata, but agents can work around most of these.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      A
      maintenance
      MCP server that enables LLMs to interact with ERPNext/Frappe sites for document CRUD, search, reports, workflows, and analytics, respecting user permissions and logging all actions.
      337
      AGPL 3.0
    • A
      license
      B
      quality
      D
      maintenance
      Integrates with ERPNext/Frappe API to enable AI assistants to create, read, update, and list documents, run reports, and authenticate via the Model Context Protocol.
      6
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI assistants to interact with ERPNext data and functionality through the Model Context Protocol, including document CRUD, report running, and API method calls.
      MIT