ai_mcp

ai_mcp

Universal dynamic MCP server for Frappe & ERPNext v16, exposing 36 tools, resources, prompts, SSE transport, and real-time webhooks to manage 816+ DocTypes.

Category
访问服务器

README

🤖 AI MCP - Universal Dynamic MCP Server for Frappe & ERPNext v16

ai_mcp is a native Frappe application that packages an enterprise-grade dynamic Model Context Protocol (MCP) server for Frappe and ERPNext v16. It exposes 36 dynamic tools, FastMCP Resources, pre-built Prompts, Server-Sent Events (SSE) transport, and real-time Document Event Webhooks across all 816+ system DocTypes.


🌟 Enterprise Features

  1. Single-Site & Multi-Site Single Install
    • Seamlessly installs on any Frappe site with standard bench install-app ai_mcp. Auto-initializes AI MCP Settings and exports fixtures out of the box.
  2. Built-in Bench CLI Command
    • Run the server for any site directly via bench --site <site-name> mcp-server --transport [stdio|sse].
  3. 816+ DocTypes Dynamic Operations
    • Query, fetch, create, update, bulk-update, and delete documents dynamically across all modules (Accounts, Stock, Selling, Buying, Manufacturing, Projects, Custom).
  4. Role-Based Tool Permission Matrix
    • Restricts high-risk tools (run_sql_query, delete_document, create_custom_field, bulk_update_documents) to System Manager or AI Admin roles or explicit frappe.has_permission() checks.
  5. Rate-Limiting & Payload Truncation Guardrails
    • Redis-backed rate limiting (default 60 req/min) and automatic response payload truncation (default 100KB limit).
  6. Asynchronous Non-Blocking Audit Logging
    • Offloads audit logging to background queues (frappe.enqueue) to eliminate DB write overhead during tool execution.
  7. FastMCP Resources & Prompts
    • Dynamic resources (frappe://system-health/{site}, frappe://kpi-summary/{site}, frappe://doctypes/{site}) and AI business prompts (financial_summary_prompt, stock_reorder_prompt, procurement_audit_prompt).
  8. Real-Time Document Webhooks
    • Document event triggers (Purchase Order, Material Request) sending real-time webhooks to AI agents upon document submission.

🚀 Installation & Setup

1. Install App on Any Site

cd ~/frappe-bench
bench get-app ai_mcp # or local path / git repository
bench --site site1.local install-app ai_mcp

2. Launch MCP Server for Any Site

Stdio Mode:

bench --site site1.local mcp-server

SSE Streaming Mode:

bench --site site1.local mcp-server --transport sse --port 8000

🌐 REST API & SSE Endpoints

Endpoint Method Description
/api/method/ai_mcp.api.execute_tool POST Execute any MCP tool over HTTP REST API.
/api/method/ai_mcp.api.list_available_tools GET List available tools and docstrings.
/api/method/ai_mcp.api.sse_endpoint GET/POST Get SSE connection URLs and streaming headers.

🛠️ Complete MCP Tools Reference (36 Tools)

Tool Category Function Name Description
Discovery & Schema list_doctypes List active DocTypes filtered by module or search keyword.
get_doctype_meta Fetch complete schema definition, fieldtypes, and child tables.
get_doctype_relations Map incoming/outgoing Link fields and child tables (ER-diagram).
Schema Building create_custom_field Create custom field dynamically with custom_ prefix (Restricted).
add_property_setter Adjust standard field properties without editing core files.
Universal CRUD list_documents Query & list documents for any DocType with filters/sorting.
get_document Fetch full record details for any document.
create_document Insert new document record for any DocType.
update_document Update fields on existing record.
bulk_update_documents Bulk update multiple records in a single transaction (Restricted).
delete_document Delete record for any DocType (Restricted).
import_csv_data Parse & import base64-encoded CSV dataset.
Automation Bots check_low_stock_and_reorder Scan low stock items and auto-create draft Material Requests.
diagnose_and_clean_errors Group Error Logs by method and optionally purge old logs.
find_duplicate_records Detect duplicate column values for any DocType safely.
auto_approve_workflow Auto-apply 'Approve' action on Workflow-enabled documents.
KPIs & Finance get_kpi_summary Compute receivables, monthly sales, pending orders, item count.
get_currency_exchange_rate Get live/historical exchange rate between currencies.
Communications send_email_notification Send email via queue or log to Communication DocType.
attach_file Attach base64 file or URL to any document record.
Transactions commit_transaction Commit current DB transaction.
rollback_transaction Roll back current DB transaction.
PDF & Printing generate_print_pdf Render PDF/HTML preview for any document record.
Search & Auth global_search Keyword search across global index.
check_user_permission Check user read/write/create/delete permissions.
search_link_options Autocomplete options for Link fields.
Methods & Background call_whitelisted_method Execute any @frappe.whitelist() backend method.
enqueue_background_job Enqueue background job to RQ workers with Redis fallback.
Lifecycle & Reports submit_document Submit submittable document (docstatus 0 ➔ 1).
cancel_document Cancel submitted document (docstatus 1 ➔ 2).
apply_workflow_action Advance document state via Workflow action.
execute_report Run built-in Frappe/ERPNext report.
export_report_to_excel Export report directly to Excel (.xlsx) file.
get_system_health_status Check DB status, error logs, installed apps, scheduler.
get_document_count Get total record count for any DocType.
run_sql_query Read-only SQL SELECT queries with injection guardrails (Restricted).

mcp-erpnext

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选