MetorialDocs

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

Sign-in methods

MethodTypeWhat a person provides
API Key + SecretAPI tokenapiKey and apiSecret
Username & PasswordCustom credentialssiteUrl, username and password
OAuth 2.0 (default)OAuthSigns 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 Key
  • apiSecret: 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/email
  • password: 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:

ScopeNameWhat it allows
allAllFull access to all ERPNext resources
openidOpenIDOpenID 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:

metorial-admin portals access list <portal-id> --type provider_template --search erpnext

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

metorial catalog search erpnext
metorial setup <catalog-item-id>

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.

metorial list erpnext
metorial client list
metorial install <client-identifier> <integration-id>

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 list erpnext
metorial tools <integration-id>
metorial call <integration-id> list_documents -d '{"doctype":"<doctype>"}'

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. Needs doctype and documentName.
  • count_documents: Count the number of ERPNext documents matching a given DocType and optional filters. Needs doctype.
  • get_report: Run an ERPNext report and retrieve its data. Needs reportName.
  • list_documents: List and search ERPNext documents of any DocType with filtering, field selection, sorting, and pagination. Needs doctype.
  • 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. Needs doctype and documentName.
  • update_document: Update an existing ERPNext document. Needs doctype, documentName and documentData.
  • submit_document: Submit a draft ERPNext document to finalize it. Needs doctype and documentName.
  • call_method: Call a whitelisted server-side method on the ERPNext/Frappe backend via the RPC API. Needs method.
  • create_document: Create a new ERPNext document of any DocType. Needs doctype and documentData.

Destructive tools (2)

  • cancel_document: Cancel a submitted ERPNext document. Needs doctype and documentName.
  • delete_document: Permanently delete an ERPNext document by its DocType and name. Needs doctype and documentName.

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