/ 目录 / 演练场 / Frappe_Assistant_Core
● 社区 buildswithpaul ⚡ 即开即用

Frappe_Assistant_Core

作者 buildswithpaul · buildswithpaul/Frappe_Assistant_Core

通过 21 个工具将你的 ERPNext 实例暴露给 Claude——文档、报表、分析,甚至 Python 执行——都支持 OAuth 和基于角色的权限。

Frappe Assistant Core 装在你的 Frappe/ERPNext bench 里,用 MCP 和 LLM 客户端通话。文档 CRUD、搜索、报表、Python 执行、图表生成都由你现有的 ERPNext 角色权限把守,OAuth 保证每个用户用自己的账号登录。

为什么要用

核心特性

实时演示

实际使用效果

frappe-assistant-core.replay ▶ 就绪
0/0

安装

选择你的客户端

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "frappe-assistant-core": {
      "command": "uvx",
      "args": [
        "Frappe_Assistant_Core"
      ],
      "_inferred": true
    }
  }
}

打开 Claude Desktop → Settings → Developer → Edit Config。保存后重启应用。

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "frappe-assistant-core": {
      "command": "uvx",
      "args": [
        "Frappe_Assistant_Core"
      ],
      "_inferred": true
    }
  }
}

Cursor 使用与 Claude Desktop 相同的 mcpServers 格式。项目级配置优先于全局。

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "frappe-assistant-core": {
      "command": "uvx",
      "args": [
        "Frappe_Assistant_Core"
      ],
      "_inferred": true
    }
  }
}

点击 Cline 侧栏中的 MCP Servers 图标,然后选 "Edit Configuration"。

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "frappe-assistant-core": {
      "command": "uvx",
      "args": [
        "Frappe_Assistant_Core"
      ],
      "_inferred": true
    }
  }
}

格式与 Claude Desktop 相同。重启 Windsurf 生效。

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "frappe-assistant-core",
      "command": "uvx",
      "args": [
        "Frappe_Assistant_Core"
      ]
    }
  ]
}

Continue 使用服务器对象数组,而非映射。

~/.config/zed/settings.json
{
  "context_servers": {
    "frappe-assistant-core": {
      "command": {
        "path": "uvx",
        "args": [
          "Frappe_Assistant_Core"
        ]
      }
    }
  }
}

加入 context_servers。Zed 保存后热重载。

claude mcp add frappe-assistant-core -- uvx Frappe_Assistant_Core

一行命令搞定。用 claude mcp list 验证,claude mcp remove 卸载。

使用场景

实战用法: Frappe_Assistant_Core

用自然语言向 ERPNext 提出业务问题

👤 创始人、运营主管、财务团队 ⏱ ~15 min beginner

何时使用: 你想要销售/库存/应收账款数字,但不想点击 ERPNext 报表或等待分析师。

前置条件
  • 已安装 Frappe Assistant Core 的 ERPNext 站点bench get-app + bench install-app frappe_assistant_core
  • 拥有适当读权限的用户账号 — 用你自己的登录;权限自动跟随
步骤
  1. 通过 OAuth 连接 Claude Desktop
    Connect to my ERPNext MCP endpoint at https://erp.example.com/api/method/frappe_assistant_core.mcp✓ 已复制
    → OAuth 登录完成;Claude 列出可用工具
  2. 提出业务问题
    What's my total sales this month broken down by customer group? Compare to last month.✓ 已复制
    → Claude 运行报表工具并返回对比结果
  3. 深入分析异常
    Customer group 'Wholesale' dropped 40%. Show me the top 10 customers in that group and their YoY sales.✓ 已复制
    → 排序列表及可操作的洞察

结果: 在不离开聊天客户端的情况下,数秒内获得财务/运营问题的答案。

注意事项
  • Claude 幻想出你的定制中不存在的 Doctype 名称 — 总是先让它列出可用的 Doctype,然后用确切的名称引用
  • Python 执行工具对你的数据库运行未经验证的代码 — 通过角色权限为非管理员用户禁用 execute_python_code 工具
搭配使用: notion

从摘要批量创建或更新文档

👤 ERPNext 实现顾问、数据迁移人员 ⏱ ~20 min intermediate

何时使用: 你有一个电子表格或段落数据,需要作为多个文档(项目、客户、供应商)落地到 ERPNext。

前置条件
  • 对目标 Doctype 的写权限 — 通过分配给用户的角色
步骤
  1. 描述要创建的内容
    I have these 15 new suppliers [paste table]. Create them as Supplier records with country, currency, and tax category set.✓ 已复制
    → Claude 提议记录,在写入前要求确认
  2. 确认后执行
    Looks good, proceed. Report any validation errors per row.✓ 已复制
    → 按行创建报告,包括任何错误
  3. 在 ERPNext 中验证
    List the Suppliers I just created along with their creation date to confirm.✓ 已复制
    → 15 条匹配的列表

结果: 在没有 CSV 导入工具摩擦的情况下,在数分钟内完成批量数据输入。

注意事项
  • 如果不检查自然键,Claude 会创建重复记录 — 告诉它在每次创建前搜索现有记录

将你的自定义 Frappe 应用逻辑作为 MCP 工具暴露

👤 Frappe/ERPNext 开发者 ⏱ ~45 min advanced

何时使用: 你有一个带有域逻辑的自定义应用(如贷款摊销、制造 BOM 展开器),想让 LLM 直接调用它。

前置条件
  • Frappe 自定义应用 — 标准 bench new-app
步骤
  1. 在你的应用的 hooks.py 中注册工具
    Walk me through adding a custom MCP tool in my app acme_lending that computes loan amortization, based on the Frappe Assistant Core plugin spec.✓ 已复制
    → 具体的 hooks.py 代码片段 + 工具函数
  2. 重新加载并验证
    How do I reload Frappe Assistant Core to pick up the new tool, and how do I confirm it shows up in Claude?✓ 已复制
    bench restart + 工具列表检查

结果: 你的域逻辑现在可从任何 MCP 客户端调用,无需构建单独的 API。

注意事项
  • 工具将敏感字段记录到审计日志中 — 将字段标记为 no_copy 或在工具响应中屏蔽

组合

与其他 MCP 搭配,撬动十倍杠杆

frappe-assistant-core + notion

运行月度 ERPNext 损益表,将摘要发布到 Notion 供领导力周会

Run our monthly P&L report in ERPNext for last month, summarize top 3 variances vs plan, and create a Notion page in 'Finance Weekly'.✓ 已复制
frappe-assistant-core + filesystem

将 ERPNext 报表导出为 CSV/Markdown 用于离线共享

Run Sales by Customer report for Q1, save as /reports/sales-q1.csv.✓ 已复制

工具

此 MCP 暴露的能力

工具输入参数何时调用成本
get_document doctype: str, name: str 通过主键获取特定的 ERPNext 文档 1 DB read
get_list doctype: str, filters?: obj, fields?: str[], limit?: int 用过滤器列出/搜索 Doctype 的文档 1 DB query
create_document doctype: str, data: obj 插入新文档——遵守验证 1 DB write + hooks
update_document doctype, name, data 修补现有文档上的字段 1 DB write
run_report report_name: str, filters?: obj 执行保存的 Frappe Query/Script/Report Builder 报表 variable
execute_python_code code: str 在 Frappe 上下文中运行任意 Python——仅管理员,为普通用户禁用 unbounded
get_chart_data chart_name / config 将 Frappe Dashboard 图表呈现为数据 1 aggregation query

成本与限制

运行它的成本

API 配额
受你的 ERPNext 站点容量限制——将 MCP 调用视为网络 UI 调用
每次调用 Token 数
列表查询 500-3000 tokens;单个 Doc 读取 200-800
费用
免费——AGPL-3.0。成本就是你为 ERPNext 托管支付的费用。
提示
总是将 fields 传递给 get_list——获取包含所有子表的完整 Sales Invoice 可能会消耗每行 10k 个 token。

安全

权限、密钥、影响范围

最小权限: 用户在 ERPNext 中已有的任何角色权限
凭据存储: OAuth token 由 MCP 客户端存储;在 ERPNext 用户设置中轮换
数据出站: 直接从你的 ERPNext 站点到你连接的 LLM 提供商
切勿授予: 除非确实需要,否则不要给 OAuth 应用 System Manager 不要为非管理员用户启用 `execute_python_code`

故障排查

常见错误与修复

OAuth redirect fails / invalid_client

确认 OAuth 客户端在 ERPNext > OAuth Client 中注册,并且重定向 URI 与你的 MCP 客户端的回调完全匹配。

验证: Check `bench log` and the OAuth Client record
Tool says 'Permission denied' for a Doctype

登录用户缺少读/写角色。在用户权限中授予适当的角色。

验证: Try the same operation in the ERPNext web UI
Custom plugin tool not appearing

运行 bench restart 并确保应用安装在站点上且 hooks.py 正确暴露工具。

验证: List tools from Claude — your custom tool should be present
ChatGPT custom connector rejects the endpoint

ChatGPT 自定义连接器需要 ChatGPT Plus with Developer Mode。Claude Desktop 更宽容。

替代方案

Frappe_Assistant_Core 对比其他方案

替代方案何时用它替代权衡
Direct REST API + custom MCP wrapper你只需要 2-3 个操作,不想安装 Frappe 应用你自己构建并维护包装器
Odoo MCP你使用的是 Odoo 而不是 ERPNext不同的 ERP,不同的 Doctype

更多

资源

📖 阅读 GitHub 上的官方 README

🐙 查看未解决的 issue

🔍 浏览全部 400+ MCP 服务器和 Skills