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.
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:
The server includes comprehensive error handling, validation, and helpful responses to make it easier for AI assistants to work with Frappe.
npm install -g frappe-mcp-server
Alternatively, run directly with npx:
npx frappe-mcp-server
(no installation needed)
The server is configured using environment variables:
FRAPPE_URL
: The URL of your Frappe instance (default: http://localhost:8000
)FRAPPE_API_KEY
: Your Frappe API key (required)FRAPPE_API_SECRET
: Your Frappe API secret (required)Important: API key/secret authentication is the only supported authentication method. Both
FRAPPE_API_KEY
andFRAPPE_API_SECRET
must be provided for the server to function properly. Username/password authentication is not supported.
This MCP server only supports API key/secret authentication via the Frappe REST API. Username/password authentication is not supported.
To get API credentials from your Frappe instance:
If you encounter authentication errors:
FRAPPE_API_KEY
and FRAPPE_API_SECRET
environment variables are set correctlyThe server provides detailed error messages to help diagnose authentication issues.
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
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", // REQUIRED
"FRAPPE_API_SECRET": "your_api_secret" // REQUIRED
},
"disabled": false,
"alwaysAllow": []
}
}
}
Note: Both
FRAPPE_API_KEY
andFRAPPE_API_SECRET
environment variables are required. The server will start without them but most operations will fail with authentication errors.
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 filtersget_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 fieldget_frappe_usage_info
: Get combined information about a DocType or workflow, including schema metadata, static hints, and app-provided usage guidancefind_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 APIschema://{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 systemThe server provides comprehensive usage information by combining three sources:
static_hints/
directoryThis enhancement enables AI assistants to better understand Frappe modules, making them more effective at assisting users with Frappe-based applications.
For more details, see Usage Information Enhancement.
// 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",
},
});
// 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
});
// 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",
});
// Example of using the find_doctypes tool
const salesDocTypes = await useToolWithMcp("frappe", "find_doctypes", {
search_term: "Sales",
module: "Selling",
is_table: false,
});
// Example of using the get_required_fields tool
const requiredFields = await useToolWithMcp("frappe", "get_required_fields", {
doctype: "Sales Order",
});
// Example of using the get_api_instructions tool
const instructions = await useToolWithMcp("frappe", "get_api_instructions", {
category: "DOCUMENT_OPERATIONS",
operation: "CREATE",
});
// Example of using the get_frappe_usage_info tool
const salesOrderInfo = await useToolWithMcp("frappe", "get_frappe_usage_info", {
doctype: "Sales Order",
});
// Example of getting workflow information
const workflowInfo = await useToolWithMcp("frappe", "get_frappe_usage_info", {
workflow: "Quote to Sales Order Conversion",
});
The server provides detailed error messages with context to help diagnose issues:
Each error includes:
Check DocType Schema First: Before creating or updating documents, get the schema to understand required fields and validations.
Use Pagination: When listing documents, use limit
and limit_start
parameters to paginate results.
Specify Fields: Only request the fields you need to improve performance.
Validate Before Creating: Use get_required_fields
to ensure you have all required fields before creating a document.
Check Existence: Use check_document_exists
before updating or deleting to ensure the document exists.
ISC
Seamless access to top MCP servers powering the future of AI integration.