基本能力
产品定位
Frappe MCP Server 是一个为 Frappe 框架设计的 MCP 服务器,旨在通过标准化接口向 AI 助手暴露 Frappe 的功能,特别关注文档操作和模式处理。
核心功能
- 文档操作(创建、读取、更新、删除、列表)
- 模式和元数据处理
- DocType 发现和探索
- 详细的 API 使用指令和示例
适用场景
- AI 助手与 Frappe 应用程序的交互
- 自动化文档管理
- 数据库操作和模式查询
工具列表
文档操作工具
create_document
: 在 Frappe 中创建新文档get_document
: 从 Frappe 检索文档update_document
: 更新 Frappe 中的现有文档delete_document
: 从 Frappe 删除文档list_documents
: 使用过滤器列出 Frappe 中的文档
模式操作工具
get_doctype_schema
: 获取 DocType 的完整模式,包括字段定义、验证和链接的 DocTypesget_field_options
: 获取 Link 或 Select 字段的可用选项
辅助工具
find_doctypes
: 在系统中查找匹配搜索词的 DocTypesget_module_list
: 获取系统中所有模块的列表get_doctypes_in_module
: 获取特定模块中的 DocTypes 列表check_doctype_exists
: 检查系统中是否存在 DocTypecheck_document_exists
: 检查文档是否存在get_document_count
: 获取匹配过滤器的文档计数get_naming_info
: 获取 DocType 的命名系列信息get_required_fields
: 获取 DocType 的必填字段列表get_api_instructions
: 获取使用 Frappe API 的详细指令
常见问题解答
- 错误处理: 服务器提供详细的错误消息,包括描述性消息、HTTP 状态代码、端点信息和来自 Frappe 服务器的其他详细信息。
- 最佳实践: 建议在创建或更新文档前检查 DocType 模式,使用分页和指定字段以提高性能,并在更新或删除前检查文档是否存在。
使用教程
使用依赖
- Node.js 18 或更高版本
- 运行的 Frappe 实例(版本 15 或更高)
- Frappe 的 API 密钥和密钥(可选但推荐)
安装教程
- 通过 npm 安装:
bash
npm install -g frappe-mcp-server
或者直接使用 npx 运行:
bash
npx frappe-mcp-server
配置
服务器可以通过环境变量配置:
- FRAPPE_URL
: Frappe 实例的 URL(默认:http://localhost:8000
)
- FRAPPE_API_KEY
: Frappe API 密钥
- FRAPPE_API_SECRET
: Frappe API 密钥
获取 API 凭证
- 转到 User > API Access > New API Key
- 选择要为其创建密钥的用户
- 点击“Generate Keys”
- 复制 API Key 和 API Secret
启动服务器
bash
npx frappe-mcp-server
或使用环境变量:
bash
FRAPPE_URL=https://your-frappe-instance.com FRAPPE_API_KEY=your_api_key FRAPPE_API_SECRET=your_api_secret npx frappe-mcp-server
调试方式
服务器启动后,可以通过日志和错误消息进行调试。确保所有环境变量正确设置,并且 Frappe 实例可访问。