ERPNext MCP server

Integrates with ERPNext/Frappe API to enable document operations, report generation, and metadata discovery for enterprise resource planning data access without direct database interaction.
Back to servers
Provider
Rakesh Gangwar
Release date
Mar 31, 2025
Language
TypeScript
Stats
6 stars

The ERPNext MCP Server is a TypeScript-based implementation of the Model Context Protocol that allows AI assistants to interact with ERPNext data and functionality. It provides a bridge between AI assistants and your ERPNext instance, enabling seamless access to documents, reports, and other ERPNext features.

Configuration

The server requires the following environment variables:

  • ERPNEXT_URL - The base URL of your ERPNext instance
  • ERPNEXT_API_KEY (optional) - API key for authentication
  • ERPNEXT_API_SECRET (optional) - API secret for authentication

Installation

For Claude Desktop

To use with Claude Desktop, add the server configuration to Claude's config file:

On MacOS:

~/Library/Application Support/Claude/claude_desktop_config.json

On Windows:

%APPDATA%/Claude/claude_desktop_config.json

Add the following configuration:

{
  "mcpServers": {
    "erpnext": {
      "command": "node",
      "args": ["/path/to/erpnext-server/build/index.js"],
      "env": {
        "ERPNEXT_URL": "http://your-erpnext-instance.com",
        "ERPNEXT_API_KEY": "your-api-key",
        "ERPNEXT_API_SECRET": "your-api-secret"
      }
    }
  }
}

For Claude in VSCode

Add the server configuration 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

Usage

Authentication

Authenticate with your ERPNext credentials:

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>authenticate_erpnext</tool_name>
<arguments>
{
  "username": "your-username",
  "password": "your-password"
}
</arguments>
</use_mcp_tool>

Accessing Documents

Get a List of Documents

Retrieve a list of documents for a specific DocType:

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>get_documents</tool_name>
<arguments>
{
  "doctype": "Customer"
}
</arguments>
</use_mcp_tool>

Get Document Details

Access a specific document using its URI:

<access_mcp_resource>
<server_name>erpnext</server_name>
<uri>erpnext://Customer/CUSTOMER001</uri>
</access_mcp_resource>

Creating and Updating Documents

Create a New Document

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>create_document</tool_name>
<arguments>
{
  "doctype": "Item",
  "data": {
    "item_code": "ITEM001",
    "item_name": "Test Item",
    "item_group": "Products",
    "stock_uom": "Nos"
  }
}
</arguments>
</use_mcp_tool>

Update an Existing Document

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>update_document</tool_name>
<arguments>
{
  "doctype": "Item",
  "name": "ITEM001",
  "data": {
    "description": "Updated description"
  }
}
</arguments>
</use_mcp_tool>

Working with DocTypes

Get DocType Fields

Retrieve the field definitions for a specific DocType:

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>get_doctype_fields</tool_name>
<arguments>
{
  "doctype": "Item"
}
</arguments>
</use_mcp_tool>

Get Available DocTypes

List all available DocTypes in the ERPNext instance:

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>get_doctypes</tool_name>
<arguments>{}</arguments>
</use_mcp_tool>

Running Reports

Execute an ERPNext report:

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>run_report</tool_name>
<arguments>
{
  "report_name": "Accounts Receivable",
  "filters": {
    "company": "Your Company"
  }
}
</arguments>
</use_mcp_tool>

Debugging

For troubleshooting, you can use the MCP Inspector:

npm run inspector

This will provide a URL to access debugging tools in your browser, which is helpful since MCP servers communicate over stdio making traditional debugging challenging.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later