Set up ERPNext in Metorial for Claude, ChatGPT and Cursor
Share ERPNext with your team in Claude, ChatGPT and Cursor through Metorial: OAuth or API key + secret sign-in, 12 tools (5 read-only).
To give your team ERPNext in Claude, ChatGPT, Cursor and other AI clients, an admin shares the ERPNext integration in a Metorial portal, and each person signs in to ERPNext with their own account. Agents can manage enterprise business processes across ERPNext's integrated ERP platform. The integration has 12 tools, 5 read-only, 5 write and 2 destructive, plus 1 trigger.
What you'll learn
- How an admin shares ERPNext in a portal and how each person connects
- The 2 OAuth scopes ERPNext can request, and what each one allows
- How to keep the 5 read-only tools and reject the other 7
Before you start
- A portal with at least one access group
- An account with ERPNext for each person who connects
- For the CLI steps: the Metorial CLI, signed in to your portal
Sign-in methods
| Method | Type | What a person provides |
|---|---|---|
| API Key + Secret | API token | apiKey and apiSecret |
| Username & Password | Custom credentials | siteUrl, username and password |
| OAuth 2.0 (default) | OAuth | Signs in to ERPNext after entering siteUrl |
The portal and metorial setup use OAuth 2.0 unless someone picks another method.
API Key + Secret
To connect, a person enters these values:
apiKey: ERPNext API KeyapiSecret: ERPNext API Secret
Username & Password
To connect, a person enters these values:
siteUrl: Full ERPNext site URL (e.g., https://yoursite.erpnext.com)username: ERPNext username/emailpassword: ERPNext password
OAuth 2.0
Before the sign-in, setup asks for:
siteUrl: Full ERPNext site URL (e.g., https://yoursite.erpnext.com)
People sign in to ERPNext and approve the scopes you allow. The integration can request:
| Scope | Name | What it allows |
|---|---|---|
all | All | Full access to all ERPNext resources |
openid | OpenID | OpenID Connect profile information |
Setup settings
Whichever method you pick, setup also asks for:
siteUrl: Full ERPNext site URL (e.g., https://yoursite.erpnext.com or https://your-self-hosted-domain.com)
Use your own ERPNext OAuth app
With your own OAuth app, people see your company's name on the ERPNext consent screen, and the client ID and secret belong to you.
Start the credentials in Metorial
In the dashboard, select Settings, then Organization Settings. Under Integrations and MCP, select Provider Auth, then Create Auth Credentials. Choose ERPNext and copy the Redirect URI.
Register the app with ERPNext
Create an OAuth app or client in ERPNext and add the redirect URI from Metorial as its redirect or callback URL.
Finish in Metorial
Copy the app's client ID and client secret. Back in Metorial, enter a Name, the Client ID and the Client Secret, review Scopes, and select Create. Then pick these credentials for the ERPNext integration.
Admin: share ERPNext in a portal
In the dashboard
Open Shared Resources
Open Workforce, choose the portal, and select Shared Resources under Access.
Share a new integration
Select Share a Resource, then New Integration, and choose ERPNext. Under Auth Method, keep OAuth 2.0 or pick another. For how members connect, choose Each person connects, so everyone signs in to ERPNext as themselves.
Limit the tools
Under Tool Filters, set the write and destructive groups to Reject if agents should only read from ERPNext.
Choose who gets it
Add the access groups that should see ERPNext. When a person asks for access from the portal, the request appears under Access Requests.
With the CLI
The CLI cannot create the per-user ERPNext integration. Once it exists, check which groups have it:
Employee: connect ERPNext
In the portal
Open ERPNext in the catalog
Sign in to your portal and open ERPNext. The status reads Available.
Authenticate
Under Quick setup, select Authenticate. An ERPNext sign-in tab opens. Sign in and approve the permissions listed.
Confirm
The status changes to Configured. If it later reads Needs reconnect, select Reconnect and sign in again.
With the CLI
catalog search prints the catalog item ID. metorial setup uses OAuth 2.0. To connect with API Key + Secret instead, find its ID with metorial catalog get <catalog-item-id> and add --auth-method <auth-method-id>.
Add it to your AI client
metorial install adds your ERPNext connection to a local MCP client such as Claude Code, Cursor or Codex. metorial list prints the integration ID and metorial client list the client identifiers.
For a client that takes a server URL, such as ChatGPT, metorial install custom <integration-id> creates an installation token and shows the endpoint details.
Make it read-only
Open the integration's Tool Filters and set the write and destructive groups to Reject. Agents keep the 5 read-only tools, such as get_report and get_document, and lose the 5 write tools, such as call_method or amend_document, and the 2 destructive tools, such as cancel_document or delete_document.
Employees see the result on the integration's page in the portal under Tool access. For the full walkthrough, see Tool permissions.
Check it worked
metorial tools lists the 12 tools, minus any you rejected. list_documents needs doctype, so replace the placeholders. It lists and search ERPNext documents of any DocType with filtering, field selection, sorting, and pagination.
To see every input a tool takes, run metorial schema <integration-id> <tool-key>.
Tools
Read-only tools (5)
get_document: Retrieve a single ERPNext document by its DocType and name. NeedsdoctypeanddocumentName.count_documents: Count the number of ERPNext documents matching a given DocType and optional filters. Needsdoctype.get_report: Run an ERPNext report and retrieve its data. NeedsreportName.list_documents: List and search ERPNext documents of any DocType with filtering, field selection, sorting, and pagination. Needsdoctype.get_current_user: Retrieve the authenticated ERPNext user identifier for the current connection.
Write tools (5)
amend_document: Amend a cancelled ERPNext document by creating a revised copy linked to the original. NeedsdoctypeanddocumentName.update_document: Update an existing ERPNext document. Needsdoctype,documentNameanddocumentData.submit_document: Submit a draft ERPNext document to finalize it. NeedsdoctypeanddocumentName.call_method: Call a whitelisted server-side method on the ERPNext/Frappe backend via the RPC API. Needsmethod.create_document: Create a new ERPNext document of any DocType. NeedsdoctypeanddocumentData.
Destructive tools (2)
cancel_document: Cancel a submitted ERPNext document. NeedsdoctypeanddocumentName.delete_document: Permanently delete an ERPNext document by its DocType and name. NeedsdoctypeanddocumentName.
Triggers
ERPNext has 1 trigger, which fire on events in ERPNext:
document_event: Triggers when an ERPNext document is created, updated, submitted, cancelled, deleted, or changed.
Next steps
- Claude Code, Cursor, Codex and ChatGPT: connect each client to your portal and use ERPNext there
- Create custom OAuth credentials: the Provider Auth screens in more detail
- Tool permissions: tool filters and what employees see
- ERPNext on metorial.com: the integration overview