Back to MCP directory
publicPublicdnsLocal runtime

ERPNext

ERPNext的MCP服务器,提供与ERPNext集成的TypeScript服务

article

README

🚀 ERPNext MCP 服务器

ERPNext MCP 服务器是一个用于 ERPNext 整合的模型上下文协议(Model Context Protocol)服务器。它基于 TypeScript 构建,提供与 ERPNext/Frappe API 集成的功能,能让 AI 助手通过 Model Context Protocol 访问 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:获取所有可用文档类型的列表。

📦 安装指南

服务器配置

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

  • ERPNEXT_URL:您的 ERPNext 实例基础 URL。
  • ERPNEXT_API_KEY(可选):API 访问密钥。
  • ERPNEXT_API_SECRET(可选):API 密码。

开发环境安装

安装依赖项:

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

与 VSCode 中的 Claude 使用

将服务器配置添加到: 在 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 Inspector,该工具可以通过包脚本运行:

npm run inspector

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": "Test Customer",
    "amount": 100
  }
}
</arguments>
</use_mcp_tool>

更新文档

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

运行报表

<use_mcp_tool>
<server_name>erpnext</server_name>
<tool_name>run_report</tool_name>
<arguments>
{
  "report": "Sales Report",
  "filters": {
    "from_date": "2023-01-01",
    "to_date": "2023-12-31"
  }
}
</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>
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