Frappe MCP Server
Allows AI assistants to interact with Frappe applications through the official REST API, enabling document CRUD operations, schema handling, and detailed API instructions.
README
Frappe MCP Server
A Model Context Protocol (MCP) server for Frappe Framework that exposes Frappe's functionality to AI assistants through the official REST API, with a focus on document CRUD operations, schema handling, and detailed API instructions.
Overview
This MCP server allows AI assistants to interact with Frappe applications through a standardized interface using the official Frappe REST API. It provides tools for:
- Document operations (create, read, update, delete, list)
- Schema and metadata handling
- DocType discovery and exploration
- Detailed API usage instructions and examples
The server includes comprehensive error handling, validation, and helpful responses to make it easier for AI assistants to work with Frappe.
Installation
Prerequisites
- Node.js 18 or higher
- A running Frappe instance (version 15 or higher)
- API key and secret from Frappe (optional but recommended)
Setup
- Install via npm:
npm install -g frappe-mcp-server
Alternatively, run directly with npx:
npx frappe-mcp-server
(no installation needed)
Configuration
The server can be configured using environment variables:
FRAPPE_URL: The URL of your Frappe instance (default:http://localhost:8000)FRAPPE_API_KEY: Your Frappe API keyFRAPPE_API_SECRET: Your Frappe API secret
Getting API Credentials
To get API credentials from your Frappe instance:
- Go to User > API Access > New API Key
- Select the user for whom you want to create the key
- Click "Generate Keys"
- Copy the API Key and API Secret
Usage
Starting the Server
npx frappe-mcp-server
Or with environment variables:
FRAPPE_URL=https://your-frappe-instance.com FRAPPE_API_KEY=your_api_key FRAPPE_API_SECRET=your_api_secret npx frappe-mcp-server
Integrating with AI Assistants
To use this MCP server with an AI assistant, you need to configure the assistant to connect to this server. The exact configuration depends on the AI assistant platform you're using.
For Claude, add the following to your MCP settings configuration file:
{
"mcpServers": {
"frappe": {
"command": "npx",
"args": ["frappe-mcp-server"], // Assumes frappe-mcp-server is in MCP server path
"env": {
"FRAPPE_URL": "https://your-frappe-instance.com",
"FRAPPE_API_KEY": "your_api_key",
"FRAPPE_API_SECRET": "your_api_secret"
},
"disabled": false,
"alwaysAllow": []
}
}
}
Available Tools
Document Operations
create_document: Create a new document in Frappeget_document: Retrieve a document from Frappeupdate_document: Update an existing document in Frappedelete_document: Delete a document from Frappelist_documents: List documents from Frappe with filters
Schema Operations
get_doctype_schema: Get the complete schema for a DocType including field definitions, validations, and linked DocTypesget_field_options: Get available options for a Link or Select field
Helper Tools
find_doctypes: Find DocTypes in the system matching a search termget_module_list: Get a list of all modules in the systemget_doctypes_in_module: Get a list of DocTypes in a specific modulecheck_doctype_exists: Check if a DocType exists in the systemcheck_document_exists: Check if a document existsget_document_count: Get a count of documents matching filtersget_naming_info: Get the naming series information for a DocTypeget_required_fields: Get a list of required fields for a DocTypeget_api_instructions: Get detailed instructions for using the Frappe API
Available Resources
Schema Resources
schema://{doctype}: Schema information for a DocTypeschema://{doctype}/{fieldname}/options: Available options for a Link or Select fieldschema://modules: List of all modules in the systemschema://doctypes: List of all DocTypes in the system
Examples
Creating a Document
// Example of using the create_document tool
const result = await useToolWithMcp("frappe", "create_document", {
doctype: "Customer",
values: {
customer_name: "John Doe",
customer_type: "Individual",
customer_group: "All Customer Groups",
territory: "All Territories",
},
});
Getting a Document
// Example of using the get_document tool
const customer = await useToolWithMcp("frappe", "get_document", {
doctype: "Customer",
name: "CUST-00001",
fields: ["customer_name", "customer_type", "email_id"], // Optional: specific fields
});
Listing Documents with Filters
// Example of using the list_documents tool with filters
const customers = await useToolWithMcp("frappe", "list_documents", {
doctype: "Customer",
filters: {
customer_type: "Individual",
territory: "United States",
},
fields: ["name", "customer_name", "email_id"],
limit: 10,
order_by: "creation desc",
});
Finding DocTypes
// Example of using the find_doctypes tool
const salesDocTypes = await useToolWithMcp("frappe", "find_doctypes", {
search_term: "Sales",
module: "Selling",
is_table: false,
});
Getting Required Fields
// Example of using the get_required_fields tool
const requiredFields = await useToolWithMcp("frappe", "get_required_fields", {
doctype: "Sales Order",
});
Getting API Instructions
// Example of using the get_api_instructions tool
const instructions = await useToolWithMcp("frappe", "get_api_instructions", {
category: "DOCUMENT_OPERATIONS",
operation: "CREATE",
});
Error Handling
The server provides detailed error messages with context to help diagnose issues:
- Missing required parameters
- Invalid field values
- Permission errors
- Network issues
- Server errors
Each error includes:
- A descriptive message
- HTTP status code (when applicable)
- Endpoint information
- Additional details from the Frappe server
Best Practices
-
Check DocType Schema First: Before creating or updating documents, get the schema to understand required fields and validations.
-
Use Pagination: When listing documents, use
limitandlimit_startparameters to paginate results. -
Specify Fields: Only request the fields you need to improve performance.
-
Validate Before Creating: Use
get_required_fieldsto ensure you have all required fields before creating a document. -
Check Existence: Use
check_document_existsbefore updating or deleting to ensure the document exists.
License
ISC
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。