Back to MCP directory
publicPublicdnsLocal runtime

ERPNext

一个基于TypeScript的MCP服务器,提供与ERPNext/Frappe API的集成,使AI助手能够通过模型上下文协议与ERPNext数据和功能交互。

article

README

🚀 ERPNext MCP 服务器

这是一个基于 TypeScript 的 MCP 服务器,主要用于与 ERPNext/Frappe 接口集成。借助该服务器,AI 助手能够通过模型上下文协议(Model Context Protocol)与 ERPNext 的数据和功能进行交互。

🚀 快速开始

本服务器可助力 AI 助手通过模型上下文协议与 ERPNext 交互,下面为你详细介绍其特性、配置、开发、安装及使用方法。

✨ 主要特性

资源

  • 可通过 erpnext://{doctype}/{name} URI 访问 ERPNext 文档。
  • 支持使用 JSON 格式进行结构化数据访问。

工具

  • authenticate_erpnext:使用用户名和密码对 ERPNext 进行身份验证。
  • get_documents:获取特定文档类型的文档列表。
  • create_document:在 ERPNext 中创建新文档。
  • update_document:更新现有文档。
  • run_report:运行 ERPNext 报表。
  • get_doctype_fields:获取特定文档类型的字段列表。
  • get_doctypes:获取所有可用文档类型列表。

📦 安装指南

开发环境安装

安装依赖:

npm install

构建服务器:

npm run build

带有自动重建的开发:

npm run watch

与 Claude 集成安装

与 Claude Desktop 一起使用

需添加服务器配置:

  • 在 MacOS 上:~/Library/Application Support/Claude/claude_desktop_config.json
  • 在 Windows 上:%APPDATA%/Claude/claude_desktop_config.json
{
  "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"
      }
    }
  }
}

与 Claude 在 VSCode 中一起使用

将服务器配置添加到:

  • 在 MacOS 上:~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json
  • 在 Windows 上:%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json

调试

由于 MCP 服务器通过标准输入/输出通信,调试可能具有挑战性。我们推荐使用 MCP 检查器,它作为包脚本可用:

npm run inspector

检查器会在浏览器中提供调试工具的 URL。

💻 使用示例

基础用法

身份验证

<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>

获取客户列表

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

高级用法

创建新文档

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>create_document</tool_name>
<arguments>
{
  "doctype": "Sales Invoice",
  "data": {
    "customer": "John Doe",
    "amount": 100
  }
}
</arguments>
</use_mcp_tool>

更新文档

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>update_document</tool_name>
<arguments>
{
  "doctype": "Sales Invoice",
  "name": "INV-001",
  "data": {
    "amount": 150
  }
}
</arguments>
</use_mcp_tool>

运行报表

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>run_report</tool_name>
<arguments>
{
  "report": "Sales Summary"
}
</arguments>
</use_mcp_tool>

获取文档类型字段

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

获取所有文档类型

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>get_doctypes</tool_name>
</use_mcp_tool>

🔧 技术细节

服务器需要以下环境变量:

  • ERPNEXT_URL:ERPNext 实例的基础 URL。
  • ERPNEXT_API_KEY (可选):API 密钥。
  • ERPNEXT_API_SECRET (可选):API 秘密。
help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client