Frappe MCP Bridge
Allows AI agents to work with an ERPNext site through MCP, enabling reading and writing records, running reports, importing data, submitting or canceling documents, and executing maintenance tasks, all gated by Frappe/ERPNext permissions and MCP Bridge settings.
Allows AI agents to interact with a Frappe site through MCP, providing tools for reading records, running reports, correcting data, importing rows, running patches, and managing documents while honoring user permissions and configurable safety limits.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Frappe MCP BridgeList the last 5 Sales Orders with their grand totals."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Frappe MCP Bridge
Lets Claude Code and Codex (or any MCP client) work with a Frappe / ERPNext site over the Model Context Protocol. They can read records, run reports, correct data, import rows and run patches. Every call is gated by MCP Bridge Settings and recorded in MCP Bridge Log.
It works with Frappe v15 and v16. The app ships switched off and read only, with only the read capability ticked.
How it connects
There are two ways to connect. Both go through the same gate and write to the same log.
Native HTTP (recommended) | Local stdio bridge | |
What runs on your machine | Nothing | A small Python process from |
URL |
| Same site, via |
Sign-in | Each person's own Frappe login (OAuth), or | The API key pair, in a |
Extra lock | – |
|
The native endpoint is stateless Streamable HTTP: each POST carries its own credentials and gets plain JSON back.
1. Install on the site
bench get-app https://github.com/<you>/frappe_mcp_bridge
bench --site <site> install-app frappe_mcp_bridge
bench --site <site> migrate2. Choose how people sign in
OAuth (recommended). Tick Allow OAuth Sign-In in MCP Bridge Settings and save. Each person then connects with their own Frappe account: the client opens this site's login page, they sign in and press Allow, and every call runs as them, so the log shows who did what. There are no keys to hand out, and access is revoked by deleting their OAuth Bearer Token. This works for Claude Code, Codex, Claude Desktop and claude.ai (the last two need the site on https).
What saving that checkbox does:
v16: switches on the discovery and client-registration options in Frappe's own OAuth Settings.
v15: Frappe has no discovery of its own, so the app serves those documents itself.
On both, client registration goes through this app so that the http://localhost redirect Claude Code and Codex use is accepted. Frappe v16's own registration refuses it outside developer mode.
API keys. A single shared user and key pair, set up as below. This is what the stdio bridge uses. Untick Allow API Key Sign-In once everyone is on OAuth.
Create a user (e.g.
mcp@yourcompany.com) with only the roles it needs. MCP can never exceed that user's own Frappe permissions.Open MCP Bridge Settings (or the MCP Bridge workspace):
Set MCP User, add one of that user's roles to Allowed Roles (the default is System Manager), and save.
Click Generate API Keys. The secret is shown once, together with ready-to-paste Claude Code and Codex config.
Tick Enable MCP Access. Leave Read Only Mode on until you want writes, and then use Allow Writes For… (see below).
With shell access you can use bench commands instead:
bench --site <site> mcp-bridge-keys --user mcp@yourcompany.com # prints keys + client snippets
bench --site <site> mcp-bridge-enable # on, read only
bench --site <site> mcp-bridge-enable --allow-writes --minutes 30 # on, writes for 30 minutes
bench --site <site> mcp-bridge-enable --allow-writes # on, writes with no time limit
bench --site <site> mcp-bridge-disable # off
bench --site <site> mcp-bridge-status # what is allowed + recent calls3. Connect a client
With OAuth. Add the URL with no credentials. The client signs in on first use.
# Claude Code: then run /mcp, pick the server and choose Authenticate
claude mcp add --transport http prod https://erp.example.com/api/method/frappe_mcp_bridge.api.mcp.serve# Codex, ~/.codex/config.toml: then run `codex mcp login prod`
[mcp_servers.prod]
url = "https://erp.example.com/api/method/frappe_mcp_bridge.api.mcp.serve"claude.ai / Claude Desktop: Settings → Connectors → Add custom connector, with the same URL.
Redirect port changes: Frappe matches redirect URIs exactly. If a client later comes back on a different localhost port and the Allow step fails, clear its authentication (
/mcp→ Clear authentication in Claude Code) so it registers again.
With an API key, Claude Code:
claude mcp add --transport http prod \
https://erp.example.com/api/method/frappe_mcp_bridge.api.mcp.serve \
--header "Authorization: token <api_key>:<api_secret>"Or commit a .mcp.json that reads the secret from your environment:
{
"mcpServers": {
"prod": {
"type": "http",
"url": "https://erp.example.com/api/method/frappe_mcp_bridge.api.mcp.serve",
"headers": { "Authorization": "token ${FRAPPE_MCP_KEY}:${FRAPPE_MCP_SECRET}" }
}
}
}Codex with an API key (~/.codex/config.toml). Set the header value with export FRAPPE_MCP_AUTH='token <api_key>:<api_secret>'.
[mcp_servers.prod]
url = "https://erp.example.com/api/method/frappe_mcp_bridge.api.mcp.serve"
env_http_headers = { "Authorization" = "FRAPPE_MCP_AUTH" }Local stdio bridge: see mcp_server/README.md. Use it when you want the extra client-side read-only lock, or a client that only speaks stdio.
Once connected, ask Claude to call site_ping. It reports the user, the roles, and whether MCP is enabled and read only.
Safety model
Every call must pass all of these checks:
Lock | Where | What it does |
Frappe roles | the signed-in user | The floor. MCP never exceeds what that user can do in the desk. |
Enable MCP Access | MCP Bridge Settings | Master switch. Off means every tool call is refused. |
Sign-in methods | MCP Bridge Settings | Allow OAuth Sign-In and Allow API Key Sign-In, each switchable on its own. Turning one off refuses its tokens immediately. |
Read Only Mode | MCP Bridge Settings | Refuses every writing tool, whatever else is ticked. |
Write window | MCP Bridge Settings | Allow Writes For… turns Read Only Mode off for 15 minutes to 8 hours. Writes are refused the moment it ends, and the form ticks Read Only Mode back on within 5 minutes. |
Sensitive fields | MCP Bridge Settings | Masked values come back as |
Capabilities | MCP Bridge Settings |
|
Allowed Roles / IPs | MCP Bridge Settings | The caller must hold an allowed role, and optionally come from an allowed IP or CIDR range. |
Doctype allow/block lists | MCP Bridge Settings |
|
Limits | MCP Bridge Settings | Rows per read, documents per write batch, calls per hour. |
Dry run. Every writing tool takes
dry_run. The work really runs inside a savepoint and is rolled back, so the errors are the ones a live call would hit. Default To Dry Run makes that the default.run_patchis the exception: a patch commits as it goes, so its dry run only reports whether it would run and whether the module imports.Audit. Every call, including refusals, is logged in MCP Bridge Log: tool, user, client, IP, duration, outcome and (optionally) payloads. Secrets in payloads are redacted. Old rows are cleared daily according to Log Retention.
Sensitive fields
Everything a tool returns goes to an AI model. List fields that must never do so under Sensitive Fields: a document type plus fieldname, or just a fieldname for every document type (e.g. salary, bank_ac_no, passport_number).
Masked in every result. Their values come back as
•••in documents, child tables, lists, CSV exports, report rows, SQL results and before/after change reports.Indirect reveals are refused. Calls that would reveal a value some other way are refused: filtering, sorting or grouping on a masked field, using it inside an expression or alias, or naming it in SQL.
describe_sitelists the masked field names, so Claude can explain a•••instead of guessing.run_server_scriptis not covered. A script can read anything its user can, so keep Allow Server Script off on a site with masked fields.Server files are not covered. Masking applies to documents, not to logs or source files.
Server files
Tick Allow Server Files to let Claude read the code and logs on the server, and export your apps. It is off by default, and only a System Manager can use it, whatever Allowed Roles says.
Reach. Everything under the bench directory (
apps/,sites/,logs/,config/) and nothing outside it. A symlink cannot lead out.Always refused.
site_config.jsonandcommon_site_config.json,.envfiles, private keys and certificates (*.pem,*.key), Redis ACLs,.git, bench backups, and each site'sprivate/folder..env.exampleis allowed.Export.
export_appszips every installed app that Frappe does not maintain itself (anything whose publisher is not Frappe Technologies), or the apps you name. The zip leaves out.git,node_modules, virtualenvs and caches. It returns a download link that works in a browser or withcurlfor 60 minutes without signing in, so treat the link as a password. Switching off MCP access or Allow Server Files stops every open link. The zips are deleted within an hour of their link expiring.
Tools
Orientation:
site_ping,site_capabilities,describe_site,list_doctypes,get_doctype_schema,list_reportsRead:
get_document,get_single,list_documents,count_documents,export_records,run_report,run_sql(SELECT only),get_mcp_logs,get_error_logsWrite:
create_document,update_document,bulk_update_documents,import_records,submit_document,cancel_document,amend_document,delete_document,rename_documentMaintenance:
list_patches(one app or all),get_patch_log,run_patch,clear_cache,reload_doctype,force_set_values,run_scheduled_job,run_server_scriptServer files:
list_server_files,read_server_file,search_server_files,export_apps
Troubleshooting
Symptom | Cause |
| No credentials. Either add the API key header or let the client sign in with OAuth. |
| That sign-in method is unticked in MCP Bridge Settings. |
| The Allow Writes For time ran out. Open a new window. |
| The call would reveal a sensitive field. Ask without filtering or sorting on it. |
| Enable MCP Access is off. |
| Give the MCP user one of the Allowed Roles, or add its role to that list. |
| Untick it, or the tool is meant to be refused. |
| That capability is off. The message names the exact checkbox. |
| The doctype is on the built-in block list. |
| The file is on the built-in block list for server files. |
| The 60 minutes are up, or Allow Server Files was switched off. Run |
Development
Adding a tool takes three steps. The gate needs no change.
Add a handler in
frappe_mcp_bridge/mcp/handlers/with@tool(name, capability, writes=…, doctype_param=…).Add its long description to
frappe_mcp_bridge/mcp/descriptions.py.Add a thin wrapper in
mcp_server/src/frappe_mcp_bridge_client/tools/.
The native endpoint builds each tool's input schema from the handler's signature and type hints.
Tests. The suite runs against both Frappe versions. The tests swap in an in-memory settings doc and suppress commits, so they leave nothing behind on the site.
bench --site <site> set-config allow_tests true
bench --site <site> run-tests --app frappe_mcp_bridgeGitHub Actions (.github/workflows/ci.yml) runs ruff and the suite on Frappe v15 (Python 3.11) and v16 (Python 3.14) for every push and pull request.
License
mit
This server cannot be deployed
Maintenance
Related MCP Connectors
Build multi-tenant apps over MCP. Schemas, CRUD, deploys — access control enforced server-side.
Governed MCP gateway: one endpoint for your tools, with credential custody and audit log.
- GentkeyOAuthcom.gentkey
One MCP URL for all your connectors — scoped writes, enforced constraints, and a full audit trail.
Manage one WordPress site from any MCP client: read, search, propose reviewable changes, SEO data.
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceEnables ERPNext management, file operations, read-only database access, and ERPNext API integration through a standardized MCP server.4MIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive MCP server for ERPNext providing generic, doctype-agnostic access to any ERPNext document type with robust permission controls, audit logging, and enterprise-grade security.MIT
- AlicenseAqualityAmaintenanceConnects MCP clients to Frappe/ERPNext sites via REST API, enabling document CRUD, search, and remote method calls.7MIT
- AlicenseNot gradedqualityCmaintenanceAn MCP server for the Frappe Cloud control plane that lets agents manage sites, bench groups, servers, backups, deploys, logs, analytics, and billing. It provides read, write, and optional destructive tools for operating Frappe Cloud hosting infrastructure.MIT