这是一个基于 TypeScript 的 MCP 服务器,主要用于与 ERPNext/Frappe 接口集成。借助该服务器,AI 助手能够通过模型上下文协议(Model Context Protocol)与 ERPNext 的数据和功能进行交互。
本服务器可助力 AI 助手通过模型上下文协议与 ERPNext 交互,下面为你详细介绍其特性、配置、开发、安装及使用方法。
erpnext://{doctype}/{name} URI 访问 ERPNext 文档。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
需添加服务器配置:
~/Library/Application Support/Claude/claude_desktop_config.json%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"
}
}
}
}
将服务器配置添加到:
~/Library/Application Support/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json%APPDATA%/Code/User/globalStorage/saoudrizwan.claude-dev/settings/cline_mcp_settings.json由于 MCP 服务器通过标准输入/输出通信,调试可能具有挑战性。我们推荐使用 MCP 检查器,它作为包脚本可用:
npm run inspector
检查器会在浏览器中提供调试工具的 URL。
erpnext
authenticate_erpnext
{
"username": "your-username",
"password": "your-password"
}
erpnext
get_documents
{
"doctype": "Customer"
}
erpnext
create_document
{
"doctype": "Sales Invoice",
"data": {
"customer": "John Doe",
"amount": 100
}
}
erpnext
update_document
{
"doctype": "Sales Invoice",
"name": "INV-001",
"data": {
"amount": 150
}
}
erpnext
run_report
{
"report": "Sales Summary"
}
erpnext
get_doctype_fields
{
"doctype": "Sales Invoice"
}
erpnext
get_doctypes
服务器需要以下环境变量:
ERPNEXT_URL:ERPNext 实例的基础 URL。ERPNEXT_API_KEY (可选):API 密钥。ERPNEXT_API_SECRET (可选):API 秘密。