Using ERPNext with Claude

Claude, our AI assistant, can work in ERPNext for you: look things up, run reports, prepare draft bills and journal entries, attach source documents, and send bills for approval. It does this through the "erpnext-api" skill, using your own ERPNext API key, so everything it prepares shows you as its owner. This page explains why that matters, the one-time setup, and how to use it well.

Why your own key

Until now Claude reached ERPNext only through the shared mcphub connector, which signs in as Administrator. That caused two problems:

With your own key, a bill Claude prepares for you is owned by you, and you can't approve it yourself. Claude can also only do what your own ERPNext roles allow.

What Claude can do in ERPNext

Claude only prepares drafts. Submitting, approving and cancelling remain people's decisions, made in ERPNext's workflow.

One-time setup

You need three things:

  1. Claude on your own computer. The skill works in the Claude desktop app (Code tab) or in Claude Code, on macOS, Linux or Windows (with WSL or Git Bash). Your key stays in a file on your computer.
  2. The skill. It's already set up for everyone in our Claude organisation, so there's nothing to install. If it doesn't show up for you, download erpnext-api.skill from the attachments on this page (paperclip icon, top right). Open it and click Save skill, or unzip it into ~/.claude/skills/.
  3. Your personal API key, saved in a private file on your computer:
    1. In a Claude chat, ask something like "Using ERPNext, which bills are awaiting approval?" The first time, Claude creates the file ~/.config/erpnext-api/credentials.env, with the key and secret left blank.
    2. Only a System Manager can make the key. At NFE that's the admin@nearlyfreeenergy.com account, so sign in with it yourself, or sit with whoever holds it (Aaron). Open your own user record (https://erpnext.nearlyfreeenergy.com/desk/user/<your email>) → Settings tab → API Access → Generate Keys.
    3. Copy the API Key and the API Secret. The secret is shown only once, in a pop-up.
    4. Open the file. On a Mac: Finder → Go → Go to Folder… → ~/.config/erpnext-api, then open credentials.env with TextEdit, or run code ~/.config/erpnext-api/credentials.env if you use VS Code. Paste the values straight after ERPNEXT_API_KEY= and ERPNEXT_API_SECRET=, with no spaces or quotes, and save.
    5. Tell Claude "done". It will confirm that ERPNext answers as you.

To revoke the key, click Generate Keys again on the same user record. The old secret stops working at once.

Keeping your key safe

How Claude handles changes

Tips for good results

Troubleshooting

What you see What to do
"No ERPNext API key found" Fill in ERPNEXT_API_KEY and ERPNEXT_API_SECRET in ~/.config/erpnext-api/credentials.env and save.
"File does not exist" when opening the file The .config folder is hidden. Use Finder → Go → Go to Folder…, and make sure you didn't copy a trailing full stop.
Error 401 The key or secret is wrong, or keys were generated again. Make a new pair and update the file.
Error 403, "does not have doctype access" Your ERPNext roles don't allow that action. For example, deleting a bill needs the admin, and approving needs Spending Approver.
Error 417 ERPNext rejected the data, for example an unknown field or a missing value. Claude reads the message and fixes the draft.
"Self approval is not allowed" Working as intended: someone else has to approve a bill you prepared.

For admins

Last reviewed: 29 October 2026 by Aaron Tushabe (skill set up for the whole organisation)


Revision #1
Created 2026-10-29 22:55:22 UTC by aaron.tushabe
Updated 2026-10-29 22:55:22 UTC by aaron.tushabe