Provides comprehensive access to ERPNext ERP system with generic, doctype-agnostic CRUD operations, search and filtering capabilities, dynamic schema discovery, and enterprise-grade security features including multi-layer permission controls and audit logging.
ERPNext MCP Server
A comprehensive Model Context Protocol (MCP) server for ERPNext that provides generic, doctype-agnostic access to any ERPNext document type with robust permission controls, audit logging, and enterprise-grade security.
🏗️ Architecture Overview
Core Components
- 🔧 Generic Client: Works with any ERPNext doctype (Customer, Item, Sales Order, etc.)
- 🛡️ Permission System: Multi-layer access control with field-level restrictions
- 📊 Audit System: Comprehensive logging of all operations
- ⚡ Performance: Built-in caching and rate limiting
- 🔍 Discovery: Dynamic tool generation based on configured doctypes
🚀 Quick Start
1. Installation
2. Configuration
Create config/config.json
:
3. Run Server
🔐 Permission Model
Multi-Layer Security Architecture
The permission system operates on four security layers:
1. Operation-Level Permissions
2. Field-Level Access Control
3. Conditional Validation
4. Audit & Monitoring
Permission Examples
Restrictive Configuration (Read-only analyst)
Operational Configuration (Sales user)
🛠️ Available Tools & Usage
System Tools
test_connection
Test ERPNext server connectivity
list_doctypes
Show all configured doctypes and permissions
get_doctype_permissions
Get detailed permissions for specific doctype
Generic Document Operations
get_generic_document
Get any document by doctype and name
list_generic_documents
List documents for any doctype with filters
create_generic_document
Create document for any doctype
Doctype-Specific Tools
For each configured doctype, the server automatically generates:
list_{doctype}_documents
- List documentsget_{doctype}_document
- Get specific documentsearch_{doctype}_documents
- Search documentscreate_{doctype}_document
- Create new documentupdate_{doctype}_document
- Update documentdelete_{doctype}_document
- Delete document (if permitted)
Example Usage with Claude
Data Analysis
→ Uses list_customer_documents
with filters
Data Entry
→ Uses create_customer_document
with validation
Information Retrieval
→ Uses get_sales_invoice_document
Search & Discovery
→ Uses search_item_documents
⚙️ Advanced Configuration
Rate Limiting
Caching
Environment Variables
🔒 Security Considerations
Authentication
- Uses ERPNext API Key/Secret authentication
- No passwords stored in configuration
- Supports ERPNext user-level permissions
Data Protection
- Field-level access control prevents sensitive data exposure
- Audit logging tracks all access attempts
- Rate limiting prevents abuse
- Input validation prevents injection attacks
Network Security
- HTTPS-only connections to ERPNext
- Configurable request timeouts
- Connection pooling with limits
Audit Trail
All operations are logged with:
- Timestamp and user context
- Operation type and target doctype
- Success/failure status and reasons
- Data accessed/modified (field names only)
- IP address and session information
Example audit log:
🧪 Testing & Validation
Test Connection
Validate Permissions
Performance Testing
🏃♂️ Deployment
Production Configuration
Claude Desktop Integration
Add to claude_desktop_config.json
:
Docker Deployment
🚨 Failure Modes & Recovery
Connection Failures
- Automatic retry with exponential backoff
- Graceful degradation when ERPNext is unavailable
- Connection pooling prevents resource exhaustion
Permission Violations
- All unauthorized operations are blocked and logged
- Clear error messages explain permission requirements
- No partial operations - atomic success/failure
Rate Limiting
This server cannot be installed
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
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.