Frappe MCP Server
Manage your Frappe benches and sites directly from Claude.ai through natural language, enabling operations like restarting services, listing sites, running Python scripts, and viewing logs.
README
Frappe Bench & Site Manager — MCP Server
Manage your local Frappe benches and sites directly from Claude.ai (web + mobile).
Uses FastMCP over HTTP with an Ngrok static tunnel.
📱 Claude.ai → 🌐 Ngrok (permanent URL) → 🖥️ MCP Server (localhost:8000) → 🔧 Frappe Benches
Tools Available
| Tool | Category | What it does |
|---|---|---|
bench_restart |
Bench Ops | Restart supervisor/bench services |
list_sites |
Site Management | List benches, sites, apps, status |
frappe_api |
DocType Data | Authenticated REST API calls |
bench_execute |
Console | Run Python in Frappe context |
get_logs |
Logs | Fetch and filter site/bench log files |
get_config_overview |
Config | Show configured benches (no secrets exposed) |
Prerequisites
- Python 3.10+
- One or more Frappe benches already set up and working locally
- ngrok account (free tier works)
Step 1: Install dependencies
git clone <this-repo>
cd frappe-mcp
pip install -r requirements.txt
Step 2: Configure
cp config.example.json config.json
Edit config.json:
{
"benches": [
{
"id": "bench1",
"label": "Main Dev Bench",
"path": "/home/youruser/frappe-bench",
"bench_cmd": "/home/youruser/frappe-bench/env/bin/bench"
}
],
"site_credentials": {
"mysite.localhost": {
"api_key": "YOUR_API_KEY",
"api_secret": "YOUR_API_SECRET",
"port": 8000
}
}
}
Important: config.json is gitignored — never commit it.
Step 3: Get Frappe API Credentials
For each site you want to access via frappe_api or bench_execute:
- Open the Frappe site in your browser
- Go to Settings → API Access
- Click Generate Keys (for your admin user)
- Copy
api_keyandapi_secretintoconfig.json → site_credentials
Step 4: Start the MCP Server
python main.py
You should see:
🚀 Frappe MCP Server starting...
Benches configured : 1
Sites with creds : 1
Listening on : http://0.0.0.0:8000
MCP endpoint : http://0.0.0.0:8000/mcp
Audit log : mcp_audit.log
Step 5: Setup Ngrok (one-time)
Install ngrok
macOS (Homebrew):
brew install ngrok/ngrok/ngrok
Linux:
curl -sSL https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null
echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list
sudo apt update && sudo apt install ngrok
Or download directly: https://ngrok.com/download
Add your auth token
ngrok config add-authtoken YOUR_AUTHTOKEN
Get your token from: https://dashboard.ngrok.com/get-started/your-authtoken
Start tunnel with your free static domain
ngrok http 8000 --domain=yourname.ngrok-free.app
Get a free static domain: ngrok Dashboard → Cloud Edge → Domains → New Domain
Your permanent MCP URL becomes:
https://yourname.ngrok-free.app/mcp
Step 6: Connect to Claude.ai
- Open claude.ai → Settings → Integrations
- Click Add Integration
- Enter URL:
https://yourname.ngrok-free.app/mcp - Click Add — that's it
Works from your phone and laptop anywhere as long as your laptop is running.
Step 7: Auto-start on Boot (optional)
Linux (systemd)
Create /etc/systemd/system/frappe-mcp.service:
[Unit]
Description=Frappe MCP Server
After=network.target
[Service]
Type=simple
User=youruser
WorkingDirectory=/home/youruser/frappe-mcp
ExecStart=/usr/bin/python3 /home/youruser/frappe-mcp/main.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl enable frappe-mcp
sudo systemctl start frappe-mcp
macOS (launchd)
Create ~/Library/LaunchAgents/com.frappe.mcp.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.frappe.mcp</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/python3</string>
<string>/Users/youruser/frappe-mcp/main.py</string>
</array>
<key>WorkingDirectory</key>
<string>/Users/youruser/frappe-mcp</string>
<key>RunAtLoad</key>
<true/>
<key>KeepAlive</key>
<true/>
<key>StandardOutPath</key>
<string>/Users/youruser/frappe-mcp/mcp_stdout.log</string>
<key>StandardErrorPath</key>
<string>/Users/youruser/frappe-mcp/mcp_stderr.log</string>
</dict>
</plist>
launchctl load ~/Library/LaunchAgents/com.frappe.mcp.plist
Running Tests
python test_tools.py
No real Frappe bench needed — all tools are tested with a mock config.
Security Notes
config.jsonis never committed (gitignored)- API keys are never exposed in tool responses (
get_config_overviewshows"configured"/"missing"only) - All subprocess calls use
shell=False— no shell injection possible bench_executehas a two-tier security scanner: hard blocks and soft warnings- Blocked patterns (configurable):
DROP,TRUNCATE,os.system,exec(,eval(, etc. - Rate limit: 30 requests/minute per IP (configurable)
- All tool calls are appended to
mcp_audit.log
Example Claude Prompts
List all my Frappe sites and their status.
How many NGO records are on site1.localhost in bench1?
Show me the last 50 error log lines for site1.localhost — filter for "PermissionError".
Restart the web worker on bench1.
What's in the mGrant Settings module field for site1.localhost?
Show me all active Grants on site1.localhost with fields name, grant_name, grant_status.
File Structure
frappe-mcp/
├── main.py # FastMCP server + tool registration
├── config.py # Config loader + validator + singleton
├── security.py # Input sanitizer, command blocker, rate limiter
├── logger.py # Audit logger → mcp_audit.log
├── tools/
│ ├── bench_ops.py # bench_restart (+ Phase 2 stubs)
│ ├── site_manager.py # list_sites (+ Phase 2 stub)
│ ├── frappe_api.py # frappe_api (+ Phase 2 stub)
│ ├── executor.py # bench_execute
│ └── log_reader.py # get_logs
├── config.json # Your config (gitignored)
├── config.example.json # Template (committed)
├── requirements.txt
├── .gitignore
├── test_tools.py # Test suite (mock config, no bench needed)
└── README.md
Troubleshooting
config.json not found
→ Run cp config.example.json config.json and fill in your bench paths.
Bench path '/home/...' does not exist
→ The path in config.json → benches must be an existing directory.
bench command not found
→ Use the full path to the bench binary, e.g. /home/user/frappe-bench/env/bin/bench.
No credentials configured for site
→ Add api_key/api_secret for that site to config.json → site_credentials.
Authentication failed (401)
→ Regenerate API keys in the Frappe site: Settings → API Access.
Ngrok shows ERR_NGROK_3200
→ Your static domain may not be activated. Check ngrok Dashboard → Domains.
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。