Business Claw:ERPNext MCP 自动化与工作流 - Openclaw 技能

作者:互联网

2026-03-30

AI教程

什么是 Business Claw ERPNext 技能库?

Business Claw 技能提供了一个在 ERPNext 环境中构建高级企业工作流的结构化框架。通过将多个 MCP(模型上下文协议)工具组合成可重用的定义,这些 Openclaw 技能允许开发人员弥补简单 API 调用与复杂业务逻辑之间的差距。该系统使用自然语言触发器来激活预定义的序列,使 AI 代理能够更准确、安全地与 ERP 数据进行交互。

该库对于希望自动化重复性任务(如客户入驻、销售订单处理或库存管理)的团队至关重要。通过利用 Openclaw 技能,您可以确保每个操作都遵循严格的验证规则和组织护栏,从而减少错误并提高业务运营速度。它充当高级编排器,将自然语言意图转换为可执行的多步骤序列。

下载入口:https://github.com/openclaw/skills/tree/main/skills/ravana-indus/erpnext-frappe

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install erpnext-frappe

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 erpnext-frappe。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

Business Claw ERPNext 技能库 应用场景

  • 在 CRM 模块中自动创建线索和客户。
  • 执行从报价到付款处理的端到端销售工作流。
  • 通过库存分录和新项目注册同步库存。
  • 管理财务记录并处理跨各种 DocType 的付款。
  • 在 ERP 内执行批量操作和跨功能搜索。
Business Claw ERPNext 技能库 工作原理
  1. AI 代理检测到与可用技能模式匹配的自然语言触发器。
  2. SkillLoader 从 Openclaw 技能库中检索相应的 JSON 定义。
  3. 用户提供的输入参数根据严格的 JSON 模式进行验证。
  4. ToolRouter 按照工作流步骤中定义的顺序执行 MCP 工具。
  5. 变量替换处理生命周期中不同步骤之间的动态数据传递。
  6. 预定义的护栏检查验证规则以确保安全执行。
  7. 使用输出模板生成最终响应,为用户提供清晰的摘要。

Business Claw ERPNext 技能库 配置指南

要集成这些 Openclaw 技能,您必须拥有正常运行的 Frappe/ERPNext 环境并安装了 bc_mcp 模块。使用以下模式加载并执行工作流:

from bc_skills import get_available_skills, load_skill

# 列出所有可用的 Openclaw 技能
skills = get_available_skills()

# 加载并执行特定工作流
from bc_skills.loader import execute_skill
result = execute_skill(
    name="create_sales_order",
    context={"customer": "Example Corp", "items": [...]},
    user="Administrator"
)

Business Claw ERPNext 技能库 数据架构与分类体系

每个技能都由一个 JSON 模式定义,该模式规定了代理应如何解释和执行业务逻辑。

组件 类型 描述
triggers 数组 启动技能的自然语言模式。
tools 数组 工作流执行所需的特定 MCP 工具。
input_schema 对象 定义必选和可选参数的 JSON 模式。
workflow 对象 包含工具名称和参数映射的有序步骤。
guardrails 对象 防止无效或不安全操作的逻辑规则。
output_template 字符串 用于最终执行响应的 Markdown 模板。

Business Claw Skills

High-level business workflows that combine multiple MCP tools into reusable, executable skills for ERPNext.

Overview

Skills are pre-defined workflows stored as JSON files in definitions/. Each skill defines:

  • Triggers: Natural language patterns that activate the skill
  • Tools: MCP tools to execute in sequence
  • Input Schema: Required and optional parameters
  • Workflow Steps: Ordered execution plan with variable substitution
  • Guardrails: Validation rules for safe execution
  • Output Template: Formatted response message

Available Skills

CRM Skills

Skill Description Category
create_customer Create a new customer with contact and address crm
create_lead Register a new lead crm
create_supplier Add a new supplier crm

Sales Skills

Skill Description Category
create_sales_order Create a sales order sales
create_quotation Create a quotation sales
create_invoice Generate sales invoice sales
complete_sales_workflow Full Quotation → SO → Invoice → Payment sales

Purchase Skills

Skill Description Category
create_purchase_order Create a purchase order purchase

Inventory Skills

Skill Description Category
create_item Create new item in inventory inventory
stock_entry Record stock movements inventory

Project Skills

Skill Description Category
create_project Create a new project project

Financial Skills

Skill Description Category
process_payment Record payment entry payments

Utility Skills

Skill Description Category
search_records Search across DocTypes utility
bulk_operation Bulk create/update/delete utility
generic_task Flexible multi-step workflow utility

Usage

Loading Skills

from bc_skills import get_available_skills, load_skill

# List all available skills
skills = get_available_skills()
print(skills)  # ['create_customer', 'create_sales_order', ...]

# Load a specific skill
skill = load_skill("create_customer")

Executing Skills

from bc_skills.loader import execute_skill

result = execute_skill(
    name="create_customer",
    context={
        "customer_name": "ACME Corp",
        "customer_type": "Company",
        "customer_group": "Commercial",
        "email": "contact@acme.com"
    },
    user="Administrator"
)

print(result)

Trigger Examples

Skills respond to natural language triggers:

Trigger Phrase Skill
"create customer" create_customer
"add customer" create_customer
"new customer" create_customer
"complete sales workflow" complete_sales_workflow
"full sales process" complete_sales_workflow
"process order to payment" complete_sales_workflow
"create sales order" create_sales_order
"generate invoice" create_invoice

Skill Definition Schema

{
  "name": "skill_name",
  "version": "1.0.0",
  "description": "What the skill does",
  "author": "Business Claw Team",
  "category": "crm|sales|purchase|inventory|project|payments|utility",
  
  "triggers": [
    "trigger phrase 1",
    "trigger phrase 2"
  ],
  
  "tools": [
    {
      "name": "tool_name",
      "description": "What it does",
      "required": true
    }
  ],
  
  "input_schema": {
    "type": "object",
    "properties": {
      "param_name": {
        "type": "string",
        "description": "Parameter description",
        "enum": ["option1", "option2"]
      }
    },
    "required": ["required_param"]
  },
  
  "workflow": {
    "steps": [
      {
        "step": "step_name",
        "tool": "tool_to_call",
        "arguments": {
          "doctype": "DocType",
          "data": {
            "field": "${variable}"
          }
        }
      }
    ]
  },
  
  "guardrails": {
    "rule_name": true
  },
  
  "output_template": "Formatted output {{variable}}"
}

Variable Substitution

Workflow steps support ${variable} substitution from execution context:

{
  "step": "create_order",
  "tool": "create_document",
  "arguments": {
    "doctype": "Sales Order",
    "data": {
      "customer": "${customer_id}",
      "items": "${items}"
    }
  }
}

Creating Custom Skills

  1. Create a JSON file in definitions/
  2. Define triggers, tools, input schema, and workflow
  3. Use the SkillLoader to load and execute

Example custom skill structure:

{
  "name": "my_custom_skill",
  "version": "1.0.0",
  "description": "My custom workflow",
  "category": "utility",
  "triggers": ["my trigger"],
  "tools": [
    {"name": "get_doctype_meta", "required": true},
    {"name": "create_document", "required": true}
  ],
  "input_schema": {
    "type": "object",
    "properties": {
      "param1": {"type": "string"}
    },
    "required": ["param1"]
  },
  "workflow": {
    "steps": [
      {
        "step": "step1",
        "tool": "get_doctype_meta",
        "arguments": {"doctype": "Item"}
      }
    ]
  },
  "output_template": "Result: {{result}}"
}

Architecture

  • loader.py - SkillLoader class manages skill loading and execution
  • definitions/ - JSON files containing skill definitions
  • Skills use the ToolRouter to execute MCP tools in sequence
  • Guardrails provide validation before skill execution

Requirements

  • Frappe/ERPNext environment
  • bc_mcp module for tool routing
  • JSON or YAML skill definitions

License

MIT