ERPNext MCP Server
The ERPNext MCP Server is a Model Context Protocol server that provides comprehensive API access to ERPNext, enabling AI assistants to interact with all aspects of an ERPNext instance.
Document Management (CRUD): Create, read, update, delete, and list documents across any ERPNext DocType with advanced filtering, sorting, pagination, field selection, and OR conditions. Get document counts and summary views with total counts in a single call.
Workflow Operations: Submit and cancel submittable documents like invoices, sales orders, and purchase orders.
Schema & Metadata: List all available DocTypes with optional module filtering, retrieve complete field definitions and metadata for any DocType, and search link field values with autocomplete support.
Inventory Management: Query real-time stock balances from warehouse bins, view stock ledger entries (inventory transaction history), and retrieve item prices from price lists.
Trading & Sales Operations: Convert documents through the sales/purchase cycle (e.g., Quotation → Sales Order → Delivery Note → Invoice) and check outstanding balances for customers and suppliers.
Customer & Supplier Details: Retrieve comprehensive party information including addresses, phone numbers, and contacts with alias search support.
File Management: Upload files from local paths or URLs, list files attached to documents, download files, and get file download URLs.
Reporting & Custom Methods: Execute ERPNext query reports with optional filters and call any whitelisted server-side method with custom arguments using GET or POST requests.
Flexible Integration: Works with any ERPNext instance via API keys and can be configured for MCP clients like Claude Desktop.
Provides tools to interact with an ERPNext instance via its REST API, allowing for document management (CRUD), workflow actions like submitting and cancelling documents, running query reports, inspecting schemas, and accessing specialized inventory and trading functions like stock balances and party balances.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@ERPNext MCP Server Show me the current stock balance for item 'iPhone 15' in the Main Warehouse"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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 syncRun
set -a && source .env && set +a && uv run erpnext-mcpAvailable Tools
Tool | Description |
| List documents with filters, sorting, pagination |
| Get a single document by name |
| Create a new document |
| Update an existing document |
| Delete a document |
| Submit a submittable document |
| Cancel a submitted document |
| Execute an ERPNext report |
| Get document count with optional filters |
| List documents with total count |
| Call any whitelisted server-side method |
| Link field autocomplete search |
| List all available DocType names |
| Get field definitions for a DocType |
| Real-time stock balance from Bin (exact item_code) |
| Stock ledger entries (exact item_code) |
| Item prices from price lists (exact item_code) |
| Fuzzy-search Item across name / item_name / item_code |
| Item master + stock + price in one call (supports keyword) |
| Document conversion (e.g. SO → DN) |
| Outstanding balance for Customer/Supplier |
| Get supplier with address, phone, contacts (supports alias search) |
| Get customer with address, phone, contacts (supports alias search) |
| Upload a local file to ERPNext (by file path) |
| Upload a file from URL |
| List files attached to a document |
| Download a file by 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 modelsLicense
MIT
Available Tools
28 toolscancel_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 支工具。 解析順序:
若提供
name→ 直接 get若提供
keyword→ 先試精確 name;找不到 fallbackfind_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.
search_linkC
Search for link field values (autocomplete).
Inputs: txt (required), doctype (required), filters, page_length. Returns: result
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
Scored across 28 tools
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.
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.
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.
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
Related MCP Connectors
ERPNext MCP server for ChatGPT, Claude and any AI agent: create sales invoice, submit invoice, create payment entry, list overdue invoices and create customer in your own ERPNext account. Cotlet works in the account through your Cloud Browser, a real Chrome where you sign in to ERPNext yourself; Cotlet does not store your password and you need no ERPNext API key. About the official ERPNext API: Yes. ERPNext has a full REST API (checked 14 Oct 2026): any record, including customers, sales invoices and payment entries, can be listed, created, updated and deleted, and whitelisted methods can be called. Setup and FAQ: https://cotlet.dev/integrations/erpnext-api-mcp-server
Connect AI to Odoo ERP 14-20: search, create, update and manage records in natural language.
Read-only access to a company's ERP for Claude, ChatGPT and Gemini, with OAuth and an audit trail.
Operate the Plixana CRM from any AI: contacts, deals, quotes, WhatsApp and metrics.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables 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.2417ISC
- AlicenseNot gradedqualityDmaintenanceEnables 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
- AlicenseBqualityDmaintenanceEnables AI assistants to interact with ERPNext/Frappe instances through the REST API, allowing document management, report execution, and DocType operations using natural language.6MIT
- AlicenseNot gradedqualityDmaintenanceAllows AI assistants to interact with Frappe applications through the official REST API, enabling document CRUD operations, schema handling, and detailed API instructions.2ISC