Provides comprehensive integration with ERPNext API, enabling access to documents, creation of custom DocTypes, child tables, modules, dashboards, workflows, scripts, webhooks, reports, charts, and webpages. Supports complete CRUD operations, bulk processing, and custom application development within ERPNext.
Integrates with Frappe API (ERPNext's framework), allowing access to Frappe-specific functionality for custom application development including DocTypes, scripts, workflows, and web components.
ERPNext MCP Server
A Model Context Protocol server for ERPNext integration with comprehensive custom application development capabilities
This is a TypeScript-based MCP server that provides comprehensive integration with ERPNext/Frappe API. It enables AI assistants to interact with ERPNext data and functionality through the Model Context Protocol, including the ability to create custom DocTypes, child tables, modules, dashboards, workflows, scripts, webhooks, reports, charts, webpages, and much more.
Features
Resources
- Access ERPNext documents via
erpnext://{doctype}/{name}
URIs - JSON format for structured data access
- DocType metadata and field definitions
Tools
Data Operations
get_documents
- Get a list of documents for a specific doctypecreate_document
- Create a new document in ERPNextupdate_document
- Update an existing document in ERPNextdelete_document
- Delete a document by doctype and nameclone_document
- Clone a document (optionally override fields)run_report
- Run an ERPNext report
Bulk Operations
bulk_create_documents
- Bulk create documentsbulk_update_documents
- Bulk update documentsbulk_delete_documents
- Bulk delete documents
Export/Import
export_documents
- Export documents as JSONimport_documents
- Import documents from JSON
Search & Filtering
search_documents
- Advanced search for documents
DocType Management
get_doctypes
- Get a list of all available DocTypesget_doctype_fields
- Get fields list for a specific DocTypeget_doctype_meta
- Get detailed metadata for a DocType including field definitionscreate_doctype
- Create a new DocType in ERPNext with enhanced field supportcreate_smart_doctype
- Create a new DocType with automatic dependency resolution (child tables and link validation)create_child_table
- Create a new child table DocType specifically designed for parent-child relationshipsadd_child_table_to_doctype
- Add a child table field to an existing DocType
Smart Tools (Enhanced Performance & Validation)
create_smart_workflow
- Create a new Workflow with automatic DocType validation and state managementcreate_smart_server_script
- Create a new Server Script with automatic validation and dependency checkingcreate_smart_client_script
- Create a new Client Script with automatic DocType validation and enhanced error handlingcreate_smart_webhook
- Create a new Webhook with automatic validation and security featurescreate_smart_report
- Create a new Report with automatic DocType validation and query optimizationcreate_smart_dashboard
- Create a new Dashboard with automatic chart and report integrationbulk_smart_create_documents
- Bulk create documents with validation, error handling, and progress trackingsmart_import_documents
- Import documents with validation, conflict resolution, and detailed reporting
Custom Application Creation
create_module
- Create a new Module in ERPNextcreate_dashboard
- Create a new Dashboard in ERPNextcreate_workflow
- Create a new Workflow in ERPNextcreate_server_script
- Create a new Server Script in ERPNextcreate_client_script
- Create a new Client Script in ERPNextcreate_webhook
- Create a new Webhook in ERPNextcreate_hook
- Create a new Hook (custom app hook) in ERPNextcreate_report
- Create a new Report in ERPNextcreate_chart
- Create a new Chart in ERPNextcreate_webpage
- Create a new Web Page in ERPNext
Validation & Testing
validate_doctype
- Validate a DocType definition (basic checks)validate_workflow
- Validate a Workflow definition (basic checks)validate_script
- Validate a script definition (basic checks)preview_script
- Preview a script (syntax check only)lint_script
- Lint a script (syntax check only)test_script
- Test a script (syntax check only)
Versioning & History
get_document_history
- Get version history for a documentrollback_document
- Rollback a document to a previous version
Scaffolding
scaffold_app
- Scaffold a new custom app (returns structure)scaffold_module
- Scaffold a new module (returns structure)
UI Schema Generation
generate_form_schema
- Generate a form schema for a DocTypegenerate_dashboard_schema
- Generate a dashboard schema for a Dashboard
Permissions & Sharing
get_permissions
- Get permissions for a DocTypeset_permissions
- Set permissions for a DocTypesmart_set_permissions
- Set permissions for a DocType with enhanced validation and error handlingshare_document
- Share a document with a user
Notifications & Automation
create_notification
- Create a notification/alertcreate_scheduled_job
- Create a scheduled job
Documentation Generation
generate_doctype_docs
- Generate documentation for a DocTypegenerate_workflow_docs
- Generate documentation for a Workflow
Integrations
register_integration
- Register a new integration servicemanage_integration
- Update/manage an integration service
✨ New in this Version
- Smart Tools Suite: Enhanced tools with automatic validation, dependency resolution, and detailed error reporting
create_smart_workflow
- Workflow creation with DocType validation and state managementcreate_smart_server_script
- Server script creation with validation and dependency checkingcreate_smart_client_script
- Client script creation with DocType validationcreate_smart_webhook
- Webhook creation with URL validation and security featurescreate_smart_report
- Report creation with DocType validation and query optimizationcreate_smart_dashboard
- Dashboard creation with automatic chart integrationbulk_smart_create_documents
- Bulk document creation with validation and progress trackingsmart_import_documents
- Document import with conflict resolution strategies
- Smart DocType Creation: Automatic dependency resolution for child tables and link validation
- Enhanced Error Handling: Detailed error messages with actionable suggestions for the agent
- Automatic Permission Setting: Administrator permissions (RWCD) are automatically set for new DocTypes
- Complete Custom Application Development: Create modules, dashboards, workflows, scripts, webhooks, reports, charts, and webpages
- Advanced CRUD Operations: Full create, read, update, delete, clone, and bulk operations
- Export/Import Capabilities: Export and import documents as JSON
- Validation & Testing: Validate and test DocTypes, workflows, and scripts
- Versioning & History: Track document changes and rollback to previous versions
- Scaffolding: Generate app and module structures
- UI Schema Generation: Auto-generate form and dashboard schemas
- Permissions Management: Get, set, and share document permissions
- Notifications & Automation: Create notifications and scheduled jobs
- Documentation Generation: Auto-generate documentation for DocTypes and workflows
- Integration Management: Register and manage external integrations
- Automatic Field Management: Required fields are automatically added to DocTypes and child tables
- DocType Reloading: Automatic reloading of DocTypes after creation to apply changes immediately
Configuration
The server requires the following environment variables:
ERPNEXT_URL
- The base URL of your ERPNext instanceERPNEXT_API_KEY
(optional) - API key for authenticationERPNEXT_API_SECRET
(optional) - API secret for authentication
Development
Install dependencies:
Build the server:
For development with auto-rebuild:
Installation
To use with Claude Desktop, add the server config:
On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json
To use with Claude in VSCode, add the server config to:
On MacOS: ~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
On Windows: %APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
Debugging
Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector, which is available as a package script:
The Inspector will provide a URL to access debugging tools in your browser.
Usage Examples
Basic Data Operations
Get Customer List
Create New Item
Update Document
Delete Document
Clone Document
Bulk Operations
Bulk Create Documents
Bulk Update Documents
Export/Import
Export Documents
Import Documents
Custom Application Creation
Create Module
Create Dashboard
Create Workflow
Create Server Script
Create Client Script
Create Webhook
Create Report
Create Chart
Create Web Page
Validation & Testing
Validate DocType
Preview Script
Permissions & Sharing
Get Permissions
Share Document
Documentation Generation
Generate DocType Documentation
Scaffolding
Scaffold App
Scaffold Module
UI Schema Generation
Generate Form Schema
Notifications & Automation
Create Notification
Create Scheduled Job
Integrations
Register Integration
Supported Field Types
The server supports all ERPNext field types including:
- Data - Single line text
- Text - Multi-line text
- Select - Dropdown selection
- Link - Reference to another DocType
- Date - Date picker
- Datetime - Date and time picker
- Currency - Currency amount
- Float - Decimal number
- Int - Whole number
- Check - Checkbox (0 or 1)
- Table - Child table reference
- Attach - File attachment
- Color - Color picker
- Code - Code editor
- HTML Editor - Rich text editor
- Password - Password field
- Read Only - Display-only field
Error Handling
The server includes comprehensive error handling:
- Detailed API error messages from ERPNext
- Parameter validation
- Authentication checks
- Graceful fallbacks for missing data
- Validation for custom objects before creation
- Syntax checking for scripts
Advanced Features
Custom Application Development
This MCP server is designed to be a complete powerhouse for custom ERPNext application development. You can:
- Create Custom Modules - Organize your custom functionality
- Build Dashboards - Visualize data with charts and widgets
- Design Workflows - Automate business processes
- Write Scripts - Server-side and client-side automation
- Set Up Webhooks - Integrate with external systems
- Generate Reports - Create custom data analysis
- Build Charts - Visual data representation
- Create Web Pages - Custom web interfaces
- Manage Permissions - Control access to custom objects
- Generate Documentation - Auto-document your custom applications
Bulk Operations
Efficiently handle large datasets with bulk create, update, and delete operations.
Export/Import
Backup and migrate data between ERPNext instances or environments.
Validation & Testing
Ensure your custom objects are properly structured before deployment.
Versioning & History
Track changes and rollback to previous versions when needed.
For detailed information about the improvements and new features, see IMPROVEMENTS.md.
Smart DocType Creation
The create_smart_doctype
tool provides intelligent DocType creation with automatic dependency resolution:
Features
- Automatic Child Table Creation: Creates child table DocTypes before the main DocType
- Link Validation: Verifies that Link fields reference existing DocTypes
- Automatic Permissions: Sets Administrator permissions (RWCD) automatically
- Detailed Feedback: Provides comprehensive information about what was created and any warnings
- Error Recovery: Suggests solutions when dependencies fail
Example: Creating a Sales Order with Items
What happens automatically:
- ✅ Creates "Sales Order Items" child table if it doesn't exist
- ✅ Validates that "Customer" and "Address" DocTypes exist
- ✅ Sets Administrator permissions (Read, Write, Create, Delete)
- ✅ Creates the main "Sales Order Enhanced" DocType
- ✅ Reloads the DocType to apply all changes
Error Handling
The smart doctype creation provides detailed error information:
- Missing Dependencies: Lists which DocTypes need to be created first
- Permission Issues: Suggests checking Administrator role
- Field Validation: Identifies invalid field configurations
- Recovery Suggestions: Provides specific steps to resolve issues
When to Use Smart vs Basic Creation
- Use
create_smart_doctype
when:- Creating DocTypes with child tables
- Referencing other DocTypes with Link fields
- Want automatic permission setting
- Need detailed feedback and error recovery
- Use
create_doctype
when:- Creating simple DocTypes without dependencies
- Want manual control over the creation process
- Creating child table DocTypes individually
Smart Tools Usage Examples
Smart Workflow Creation
Create a workflow with automatic validation and state management:
Smart Server Script Creation
Create a server script with automatic validation:
Smart Dashboard Creation
Create a dashboard with automatic chart integration:
Smart Bulk Document Creation
Create multiple documents with validation and error handling:
Smart Document Import
Import documents with conflict resolution:
Smart Webhook Creation
Create a webhook with URL validation and security features:
Smart Permissions Setting
Set permissions for a DocType with enhanced validation and error handling:
Smart Tools Benefits
Performance Improvements
- Reduced API Calls: Smart tools batch operations and validate dependencies upfront
- Better Error Handling: Detailed error messages with actionable suggestions
- Batch Processing: Efficient handling of large datasets with configurable batch sizes
- Conflict Resolution: Multiple strategies for handling existing data
Enhanced Error Handling
- Detailed Error Messages: Clear, descriptive error messages that explain what went wrong
- Context-Aware Suggestions: Intelligent recommendations based on specific error types
- Actionable Solutions: Step-by-step guidance to resolve common issues
- Best Practice Tips: Recommendations for optimal usage and configuration
Error Categories with Specific Guidance
- DocType-Related Errors: Suggestions for missing dependencies and DocType creation
- Validation Errors: Field validation guidance with specific checks and data type recommendations
- Permission Errors: Administrator role requirements and feature enablement guidance
- Syntax and Code Errors: Language-specific syntax checking and validation tool recommendations
- Duplicate and Conflict Errors: Unique naming suggestions and conflict resolution strategies
- URL and Network Errors: Webhook URL validation and security recommendations
- Batch and Performance Errors: Batch size optimization and processing strategy suggestions
Enhanced User Experience
- Detailed Feedback: Comprehensive reporting of what was created, warnings, and errors
- Progress Tracking: Real-time updates for long-running operations
- Validation: Pre-creation validation prevents invalid data
- Recovery Suggestions: Specific steps to resolve common issues
When to Use Smart Tools
Always use smart tools when:
- Creating complex resources with dependencies
- Performing bulk operations on large datasets
- Working with untrusted or external data
- Needing detailed feedback and error reporting
- Requiring high performance and reliability
- Managing data migrations or imports
Use basic tools when:
- Creating simple resources without dependencies
- Wanting manual control over the creation process
- Performing quick, one-off operations
- Working with trusted, validated data
Error Handling Examples
Smart tools provide comprehensive error handling with detailed messages and actionable suggestions:
Smart DocType Creation Error
Smart Workflow Creation Error
Smart Server Script Creation Error
Smart Webhook Creation Error
Bulk Smart Create Error
This server cannot be installed
A Model Context Protocol server that enables AI assistants to interact with ERPNext data and functionality, providing access to documents, reports, and CRUD operations via structured API calls.
Related MCP Servers
- -securityFlicense-qualityA comprehensive Model Context Protocol server implementation that enables AI assistants to interact with file systems, databases, GitHub repositories, web resources, and system tools while maintaining security and control.Last updated -161TypeScript
- -securityAlicense-qualityA TypeScript-based server that enables AI assistants to interact with ERPNext/Frappe systems through the Model Context Protocol, allowing access to documents, creation/updating of records, and running reports.Last updated -16JavaScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that provides AI models with structured access to external data and services, acting as a bridge between AI assistants and applications, databases, and APIs in a standardized, secure way.Last updated -1Python
- -securityFlicense-qualityA Model Context Protocol server that extends AI capabilities through tools for remote control, note-taking, email operations, and knowledge search.Last updated -Python