ERPNext MCP Server
Connects ChatGPT to an ERPNext instance, enabling AI-powered business analytics, report generation, and document management, such as generating financial reports, analyzing sales trends, checking inventory, managing documents, and creating custom dashboards.
Click on "Install 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 ServerShow me the profit and loss for last quarter"
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 for ChatGPT
A complete Model Context Protocol (MCP) integration that connects ChatGPT to your ERPNext instance, enabling AI-powered business analytics, report generation, and document management.
What This Does
This integration allows ChatGPT to:
Generate financial reports (P&L, Balance Sheet, Cash Flow)
Analyze sales trends and customer data
Check inventory and stock levels
Access HR and employee information
Create and update ERPNext documents
Build custom dashboards and visualizations
Project Structure
/home/frappe/test.bench/apps/erp_chatbot/
├── erp_chatbot/
│ ├── api.py # Main API endpoints
│ ├── mcp_server_sse.py # Standalone MCP server with SSE transport
│ └── hooks.py # Frappe app hooks
├── chatgpt_openapi.yaml # OpenAPI schema for ChatGPT Actions
├── chatgpt_gpt_instructions.md # GPT behavior instructions
├── QUICK_START.md # 5-minute setup guide
├── API_KEY_SETUP.md # Authentication troubleshooting
└── pyproject.toml # DependenciesQuick Start (5 Minutes)
Step 1: Install Dependencies
cd /home/frappe/test.bench
./env/bin/pip install mcp sse-starlette starlette uvicornStep 2: Get ERPNext API Key
Login to ERPNext as Administrator
Go to User → API Access
Click Generate Keys
Copy API Key and API Secret
Step 3: Create ChatGPT GPT
Go to chat.openai.com
Click Explore GPTs → Create
Name:
ERPNext Assistant
Step 4: Configure GPT
Instructions Tab:
Copy contents from
chatgpt_gpt_instructions.mdPaste in Instructions box
Actions Tab:
Click Add actions
Import schema:
chatgpt_openapi.yamlAuthentication:
Type: API Key
Key:
AuthorizationValue:
Bearer YOUR_API_KEY:YOUR_API_SECRETAuth Type: Bearer
Step 5: Test
Ask your GPT:
"What companies are available?"
"Show me this month's sales"Available API Endpoints
Public Endpoints (No Auth Required)
Endpoint | Method | Description |
| GET | List all available tools |
Authenticated Endpoints
Endpoint | Method | Description |
| POST | Execute MCP tools |
| GET | P&L and financial reports |
| GET | Sales analytics dashboard |
| GET | Inventory overview |
| POST | Create data visualizations |
| POST | Build custom reports |
| GET | Key performance indicators |
Available Tools
Reporting Tools
get_report_data- Execute standard ERPNext reportsget_sales_analytics- Sales trends with date filteringget_financial_analysis- P&L statements with charts
Data Query Tools
get_list_data- Query any DocType with filtersget_document- Fetch single documentget_companies- List available companiesget_inventory_summary- Stock levels and overview
Document Management
create_document- Create new ERPNext recordsupdate_document- Modify existing records
Analytics & Visualization
generate_chart- Create bar, pie, line chartscreate_report- Build custom reportsget_dashboard_kpis- Business KPIs
Authentication
API Key Format
Authorization: Bearer api_key:api_secretExample:
Authorization: Bearer d4e8f2c1b5a9:8f3e2d1c9b7a5f4eGetting API Keys
ERPNext → Users → Select your user
Scroll to API Access section
Click Generate Keys
Save both API Key and API Secret
Important: API Secret is shown only once. Save it immediately!
Standalone MCP Server
Run the MCP server independently:
cd /home/frappe/test.bench
./env/bin/python apps/erp_chatbot/erp_chatbot/mcp_server_sse.pyServer starts on http://localhost:8000
Endpoints
GET /mcp/sse- SSE connectionPOST /mcp/messages- MCP messagesGET /health- Health check
Usage Examples
Query Sales Data
{
"tool": "get_list_data",
"arguments": {
"doctype": "Sales Invoice",
"filters": {"status": "Overdue"},
"fields": ["name", "customer", "grand_total"],
"limit": 20
}
}Create a Customer
{
"tool": "create_document",
"arguments": {
"doctype": "Customer",
"data": {
"customer_name": "New Customer Ltd",
"customer_type": "Company",
"territory": "Pakistan"
}
}
}Generate P&L Report
{
"tool": "get_report_data",
"arguments": {
"report_name": "Profit and Loss Statement",
"filters": {
"company": "Your Company",
"fiscal_year": "2024-2025"
}
}
}Create a Chart
{
"chart_type": "bar",
"labels": ["Jan", "Feb", "Mar", "Apr"],
"values": [10000, 15000, 12000, 18000],
"title": "Monthly Sales"
}Troubleshooting
401 Authentication Error
Verify API Key format:
Bearer key:secret(with colon)Check user has proper permissions
Ensure API keys are generated correctly
Tools Not Showing
Refresh schema in ChatGPT Actions
Check
chatgpt_openapi.yamlis properly uploadedVerify server URL is correct
Connection Failed
Check ERPNext server is running
Verify domain URL in schema
Test endpoint directly in browser
Support
For issues:
Check Frappe logs:
bench --site yoursite.com logsVerify API permissions
Test endpoints directly:
https://yoursite.com/api/method/erp_chatbot.api.mcp_chatgpt_tools
Files Reference
File | Purpose |
| OpenAPI schema for ChatGPT |
| GPT behavior configuration |
| Backend API endpoints |
| Standalone MCP server |
| Quick setup guide |
| Auth troubleshooting |
Security Notes
Keep API keys secret and secure
Use HTTPS in production
Regularly rotate API keys
Grant minimum required permissions
Ready to Use!
Your ChatGPT is now connected to ERPNext. Start asking business questions!
Example queries:
"Show me overdue invoices"
"What's our inventory status?"
"Create a sales order for ABC Corp"
"Generate P&L for Q1 2024"
Built for test.bench / erp.site.com
Created by Ibni for ERPNext MCP Server
License
mit
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Musab1khan/erpnext-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server