Extended MCP (Model Context Protocol) Server for ERPNext with:
- π§ Improved Error Handling - Returns detailed ERPNext error messages instead of generic failures
- π Workflow Management - Create and manage approval workflows
- π Custom Fields - Add custom fields that survive ERPNext updates
- π¦ DocType Creation - Create new DocTypes programmatically
- π Document Lifecycle - Submit, cancel, and delete documents
git clone https://github.com/Kai-Oesterling/erpnext-mcp-server-extended.git
cd erpnext-mcp-server-extended
npm install
npm run buildSet environment variables:
export ERPNEXT_URL="https://your-erpnext-instance.com"
export ERPNEXT_API_KEY="your-api-key"
export ERPNEXT_API_SECRET="your-api-secret"
export ERPNEXT_DEBUG="true" # Optional: Enable debug loggingAdd to claude_desktop_config.json:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Linux: ~/.config/Claude/claude_desktop_config.json
{
"mcpServers": {
"erpnext": {
"command": "node",
"args": ["C:\\path\\to\\erpnext-mcp-server-extended\\build\\index.js"],
"env": {
"ERPNEXT_URL": "https://your-erpnext-instance.com",
"ERPNEXT_API_KEY": "your-api-key",
"ERPNEXT_API_SECRET": "your-api-secret"
}
}
}
}Tool execution failed
or
Failed to create Fiscal Year: Request failed with status code 417
Failed to create Fiscal Year (HTTP 417): ValidationError: Companies is required for Fiscal Year
The extended server extracts detailed error information from:
_server_messages- JSON-encoded array of server messagesexception- Python exception detailsexc_type- Exception type (ValidationError, MandatoryError, etc.)message- Human-readable error message
| Tool | Description |
|---|---|
authenticate_erpnext |
Authenticate with username/password |
get_documents |
List documents with filtering |
get_document |
Get single document |
create_document |
Create new document |
update_document |
Update existing document |
delete_document |
Delete a document |
| Tool | Description |
|---|---|
submit_document |
Submit document (Draft β Submitted) |
cancel_document |
Cancel submitted document |
| Tool | Description |
|---|---|
get_doctypes |
List all DocTypes |
get_doctype_fields |
Get field definitions |
get_doctype_meta |
Get complete metadata |
create_doctype |
Create new DocType |
add_doctype_field |
Add field to DocType |
| Tool | Description |
|---|---|
get_workflow |
Get active workflow for DocType |
create_workflow |
Create new workflow |
update_workflow |
Modify existing workflow |
| Tool | Description |
|---|---|
create_custom_field |
Add custom field (survives updates) |
create_property_setter |
Override DocType/field properties |
| Tool | Description |
|---|---|
run_report |
Execute ERPNext report |
Create a new Customer named "ACME Corp" with customer_group "Commercial"
Create an approval workflow for Purchase Order:
- Draft β Pending Approval (Submit action, Purchase User)
- Pending Approval β Approved (Approve action, Purchase Manager)
- Pending Approval β Rejected (Reject action, Purchase Manager)
Add a custom field "priority" (Select: Low/Medium/High) to the Customer DocType
Create a DocType called "Project Task" with fields:
- task_name (Data, required)
- status (Select: Open/In Progress/Completed)
- assigned_to (Link to User)
- due_date (Date)
Enable debug mode to see detailed API requests and responses:
export ERPNEXT_DEBUG=trueThis will log:
- All API requests with URLs and parameters
- All API responses with status codes and data
- Detailed error information
Set ERPNEXT_API_KEY and ERPNEXT_API_SECRET environment variables.
Generate API keys in ERPNext:
- Go to User settings
- Click "API Access"
- Generate new keys
Use the authenticate_erpnext tool at runtime:
Authenticate with ERPNext using username "admin" and password "..."
- Login to ERPNext as Administrator
- Go to Settings β User
- Select your user
- Scroll to API Access section
- Click Generate Keys
- Copy the API Key and API Secret
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file.
- Original MCP Server: rakeshgangwar/erpnext-mcp-server
- Extended by: SVAN GmbH