Skip to main content
Glama
ERPNext MCP Server

ERPNext MCP Server

by yazelin

ERPNext MCP Server

MCP (Model Context Protocol) server for ERPNext REST API, built with FastMCP and Python.

Features

  • CRUD — List, get, create, update, delete documents

  • Workflow — Submit and cancel submittable documents

  • Reports — Run ERPNext query reports

  • Schema — Inspect DocType field definitions, list all DocTypes

  • Inventory — Stock balance, stock ledger, item prices

  • Trading — Document conversion (e.g. Quotation → Sales Order), party balance

  • Supplier/Customer — Get complete details with address, phone, contacts; supports alias search

  • Files — Upload, list, download files

  • Helpers — Link search (autocomplete), document count, generic method calls

Related MCP server: ERPNext MCP Server

Requirements

  • Python >= 3.11

  • uv (recommended) or pip

  • ERPNext instance with API key/secret

Setup

# Clone the repo
git clone <repo-url> && cd erpnext-mcp

# Create .env file
cat > .env << 'EOF'
ERPNEXT_URL=https://your-erpnext-instance.com
ERPNEXT_API_KEY=your_api_key
ERPNEXT_API_SECRET=your_api_secret
EOF

# Install dependencies
uv sync

Run

set -a && source .env && set +a && uv run erpnext-mcp

Available Tools

Tool

Description

list_documents

List documents with filters, sorting, pagination

get_document

Get a single document by name

create_document

Create a new document

update_document

Update an existing document

delete_document

Delete a document

submit_document

Submit a submittable document

cancel_document

Cancel a submitted document

run_report

Execute an ERPNext report

get_count

Get document count with optional filters

get_list_with_summary

List documents with total count

run_method

Call any whitelisted server-side method

search_link

Link field autocomplete search

list_doctypes

List all available DocType names

get_doctype_meta

Get field definitions for a DocType

get_stock_balance

Real-time stock balance from Bin (exact item_code)

get_stock_ledger

Stock ledger entries (exact item_code)

get_item_price

Item prices from price lists (exact item_code)

find_items

Fuzzy-search Item across name / item_name / item_code

get_item_details

Item master + stock + price in one call (supports keyword)

make_mapped_doc

Document conversion (e.g. SO → DN)

get_party_balance

Outstanding balance for Customer/Supplier

get_supplier_details

Get supplier with address, phone, contacts (supports alias search)

get_customer_details

Get customer with address, phone, contacts (supports alias search)

upload_file

Upload a local file to ERPNext (by file path)

upload_file_from_url

Upload a file from URL

list_files

List files attached to a document

download_file

Download a file by URL

get_file_url

Get download URL for a file

MCP Client Configuration

Add to your MCP client config (e.g. Claude Desktop claude_desktop_config.json):

{
  "mcpServers": {
    "erpnext": {
      "command": "uv",
      "args": ["--directory", "/path/to/erpnext-mcp", "run", "erpnext-mcp"],
      "env": {
        "ERPNEXT_URL": "https://your-erpnext-instance.com",
        "ERPNEXT_API_KEY": "your_api_key",
        "ERPNEXT_API_SECRET": "your_api_secret"
      }
    }
  }
}

Project Structure

src/erpnext_mcp/
├── server.py   # MCP tool definitions (FastMCP)
├── client.py   # ERPNext REST API client (httpx async)
└── types.py    # Pydantic models

License

MIT

Available Tools

28 tools
cancel_documentB

Cancel a submitted document.

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

create_documentC

Create a new document.

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

delete_documentC

Delete a document.

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

download_fileB

Download a file's content from ERPNext.

Inputs: file_name (required). Returns: object

find_itemsA

Fuzzy-search Item across name / item_name / item_code (OR like %keyword%).

用途:把使用者口語化的關鍵字(原廠型號、品名片段、部分代碼)解析成系統實際的 item_code。ERPNext 的 Item code 常加公司前綴(例如 CTOS-KV-N40DT), 用原廠型號 KV-N40DT 直接查 get_stock_balance 會找不到——此工具負責橋接。

建議用法:先 find_items 確認 item_code,再 get_stock_balance / get_item_price / get_stock_ledger。或者直接用 get_item_details(keyword=...) 一次取完。

Inputs: keyword (required), brand, limit, item_group, +1 more. Returns: result

get_countA

Get document count for a DocType with optional filters.

Inputs: doctype (required), filters. Returns: result

get_customer_detailsB

Get complete customer details including address, phone, and contacts.

Inputs: name, keyword. Returns: object

get_doctype_metaA

Get field definitions for a DocType.

Inputs: doctype (required). Returns: result

get_documentA

Get a single document by DocType and name.

Inputs: name (required), doctype (required), fields. Returns: object

get_file_urlB

Get the full download URL for a file.

Inputs: file_name (required). Returns: result

get_item_detailsA

Get full item info (master + stock balance + prices) by exact name or fuzzy keyword.

一次回完整資料,避免 AI 為了查一個品項要連打 3~4 支工具。 解析順序:

  1. 若提供 name → 直接 get

  2. 若提供 keyword → 先試精確 name;找不到 fallback find_items 取第 1 筆候選

Inputs: name, keyword, warehouse, price_list. Returns: object

get_item_priceA

Get item prices from Item Price records (exact match on item_code).

⚠️ 對 item_code 做精確比對;空結果可能是 item_code 不存在或無價單。 不確定品項代碼時,先用 find_items(keyword=...) 找正確的 item_code。

Inputs: item_code (required), price_list. Returns: result

get_list_with_summaryA

Get a list of documents along with total count.

Inputs: doctype (required), fields, filters, order_by, +1 more. Returns: object

get_party_balanceB

Get outstanding balance for a Customer or Supplier.

Inputs: party (required), party_type (required).

get_stock_balanceA

Get real-time stock balance from Bin (exact match on item_code).

⚠️ 此工具對 item_code 做精確比對。回傳空陣列代表「找不到對應 Bin 紀錄」, 可能是真的零庫存,也可能是 item_code 拼錯或缺少公司前綴(例如系統實際是 CTOS-KV-N40DT 而你只查了 KV-N40DT)。若回傳空陣列,請改用 find_items(keyword=...) 或 get_item_details(keyword=...) 模糊確認。

Inputs: item_code, warehouse. Returns: result

get_stock_ledgerA

Get stock ledger entries (inventory transaction history; exact match on item_code).

⚠️ 對 item_code 做精確比對;查不到時改用 find_items(keyword=...) 找正確代碼。

Inputs: limit, item_code, warehouse. Returns: result

get_supplier_detailsB

Get complete supplier details including address, phone, and contacts.

Inputs: name, keyword. Returns: object

list_doctypesA

List all available DocType names.

Inputs: limit, module, is_submittable. Returns: result

list_documentsB

List documents of a given DocType with optional filtering, sorting and pagination.

Inputs: doctype (required), fields, filters, order_by, +3 more. Returns: result

list_filesC

List files in ERPNext, optionally filtered by attachment.

Inputs: limit, is_private, attached_to_name, attached_to_doctype. Returns: result

make_mapped_docC

Create a new document mapped from an existing one (document conversion).

Common methods:

  • erpnext.selling.doctype.quotation.quotation.make_sales_order (Quotation → Sales Order)

  • erpnext.selling.doctype.sales_order.sales_order.make_delivery_note (Sales Order → Delivery Note)

  • erpnext.selling.doctype.sales_order.sales_order.make_sales_invoice (Sales Order → Sales Invoice)

  • erpnext.stock.doctype.delivery_note.delivery_note.make_sales_invoice (Delivery Note → Sales Invoice)

  • erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_receipt (PO → Purchase Receipt)

  • erpnext.buying.doctype.purchase_order.purchase_order.make_purchase_invoice (PO → Purchase Invoice)

Inputs: method (required), source_name (required). Returns: object

run_methodC

Call a server-side method (whitelisted API).

Inputs: method (required), args, http_method.

run_reportC

Execute an ERPNext report.

Inputs: report_name (required), filters.

submit_documentB

Submit a submittable document (e.g. Sales Invoice).

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

update_documentB

Update an existing document.

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

upload_fileC

Upload a local file to ERPNext.

Inputs: file_path (required), filename, is_private, attached_to_name, +1 more. Returns: object

upload_file_from_urlA

Upload a file to ERPNext from a URL.

Inputs: file_url (required), filename, is_private, attached_to_name, +1 more. Returns: object

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    B3.2/5.0

    Scored across 28 tools

    Disambiguation3/5

    Most tools are nominal but there are several overlapping fetch utilities: list_documents, get_list_with_summary, and get_count all surface document lists/counts, and get_item_details overlaps with get_stock_balance, get_item_price, and find_items. The descriptions add helpful disambiguation notes, but an agent could still misselect when a single response includes both full-item details and stock-specific lookups.

    Naming Consistency5/5

    Tool names follow a consistent snake_case verb_noun pattern throughout: list_documents, get_document, create_document, update_document, delete_document, submit_document, cancel_document, upload_file, download_file. Even composite names like get_list_with_summary and make_mapped_doc stay within the same pattern, so the naming is predictable.

    Tool Count2/5

    At 28 tools, this server exceeds the 25+ threshold where tool count becomes a heavy burden. The count also inflates the surface area because several tools are near-duplicates of generic document access: get_count, get_list_with_summary, get_document, and list_documents could likely be consolidated.

    Completeness5/5

    The tool set gives strong lifecycle coverage for the ERPNext domain: generic DocType CRUD, submit/cancel, report execution, run_method, mapped document conversion, stock/item lookups, party balance and details, plus upload/download file support. There are no major dead ends and the generic document tools plus whitelisted run_method fill most edge cases.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Enables interaction with Frappe Framework sites through comprehensive document operations, schema introspection, report generation, and method execution. Provides secure API-based access to create, read, update, and delete Frappe documents while supporting financial reporting and DocType management.
      24
      17
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables comprehensive interaction with ERPNext systems through natural language, providing secure access to any document type (customers, items, invoices, etc.) with enterprise-grade permission controls and audit logging.
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Allows AI assistants to interact with Frappe applications through the official REST API, enabling document CRUD operations, schema handling, and detailed API instructions.
      2
      ISC