ERPNext MCP服务器
ERPNext集成的模型上下文协议服务器
这是一个基于类型脚本的MCP服务器,提供与ERPNext/Frappe API的集成。它使AI助手能够通过模型上下文协议与ERPNext数据和功能进行交互。
特性
资源
- 通过以下方式访问ERPNext文档
erpnext://{doctype}/{name}尤里斯 - 用于结构化数据访问的JSON格式
工具
get_doctypes-获取所有可用DocType的列表get_doctype_fields-获取特定DocType的字段列表get_documents-获取特定doctype的文档列表get_document-按名称获取单个文档,包括所有子表create_document-在ERPNext中创建新文档update_document-更新ERPNext中的现有文档delete_document-永久删除文档submit_document-提交文档(将docstatus设置为1)cancel_document-取消已提交的文档(将docstatus设置为2)call_method-调用ERPNext/Frappe白名单服务器端API方法run_report-运行ERPNext报告
配置
服务器需要以下环境变量:
ERPNEXT_URL-ERPNext实例的基本URLERPNEXT_API_KEY(可选)-用于身份验证的API密钥ERPNEXT_API_SECRET(可选)-用于身份验证的API机密
发展
安装依赖项:
npm install构建服务器:
npm run build对于自动重建的开发:
npm run watch安装
要与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服务器通过stdio进行通信,调试可能具有挑战性。我们建议使用 MCP检查员,可作为包脚本使用:
npm run inspector检查器将提供一个URL,用于访问浏览器中的调试工具。
用法示例
获取客户列表
erpnext
get_documents
{
"doctype": "Customer"
}
获取客户详细信息
erpnext
erpnext://Customer/CUSTOMER001
创建新项目
erpnext
create_document
{
"doctype": "Item",
"data": {
"item_code": "ITEM001",
"item_name": "Test Item",
"item_group": "Products",
"stock_uom": "Nos"
}
}
获取项目字段
erpnext
get_doctype_fields
{
"doctype": "Item"
}
