Use Bayarcash with Claude and other AI assistants (MCP)
The Bayarcash MCP server lets an AI assistant work with your Bayarcash account. MCP (Model Context Protocol) is the standard that Claude, Cursor and other AI apps use to connect to other systems. You ask in plain words, for example “Create a payment for RM 100”, and the assistant calls Bayarcash API v3 for you.
The server is open source: webimpianteam/bayarcash-mcp-server on GitHub. It is also listed on Smithery. It runs on your own computer.
What it can do
Section titled “What it can do”The server gives the assistant these tools:
| Tool | What it does |
|---|---|
create_payment_intent |
Creates a payment and returns its payment intent ID and payment link. |
get_payment_intent |
Gets the status of a payment by its payment intent ID. |
get_transaction |
Gets one transaction by its transaction ID. |
get_transaction_by_order |
Gets one transaction by its order number. |
list_transactions |
Lists transactions. Filters: status, payment channel, payer email, order number and reference number. |
get_portals |
Lists your portals. |
get_payment_channels |
Lists payment channels. |
get_fpx_banks |
Lists the FPX banks. |
To create a payment, the assistant needs an order number, amount, payer email, payer name, description and portal key. If you do not give them, it asks you, and it can show your portals so you can choose one.
Before you start
Section titled “Before you start”You need these before you install the server:
- Node.js on your computer, to run the server.
- An AI app that supports MCP, for example Claude Desktop, Claude Code or Cursor.
- Your Personal Access Token (PAT) and API Secret Key. See Find your API keys.
Install the server
Section titled “Install the server”The server runs from a copy of its GitHub repository. To install it:
- Clone the repository:
git clone https://github.com/webimpianteam/bayarcash-mcp-server.git - In the new
bayarcash-mcp-serverfolder, runnpm install. - Run
npm run build. This makes the filebuild/index.js. - Note the full path to
build/index.js. Your AI app needs it.
Connect your AI app
Section titled “Connect your AI app”The server reads its settings from these environment variables:
| Variable | What to enter |
|---|---|
BAYARCASH_API_TOKEN |
Your Personal Access Token (PAT). Required. |
BAYARCASH_API_SECRET_KEY |
Your API Secret Key. Required. |
BAYARCASH_SANDBOX |
true for the sandbox, false for production. It is true until you change it. |
For Claude Desktop, add the server to claude_desktop_config.json. Use the full path from step 4, and put in your own keys:
{ "mcpServers": { "bayarcash": { "command": "node", "args": ["/full/path/to/bayarcash-mcp-server/build/index.js"], "env": { "BAYARCASH_API_TOKEN": "your_token", "BAYARCASH_API_SECRET_KEY": "your_secret", "BAYARCASH_SANDBOX": "true" } } }}Then restart Claude Desktop. Other AI apps take the same command, path and variables in their MCP settings. For Claude Code, run claude mcp add bayarcash -e BAYARCASH_API_TOKEN=your_token -e BAYARCASH_API_SECRET_KEY=your_secret -e BAYARCASH_SANDBOX=true -- node /full/path/to/bayarcash-mcp-server/build/index.js.
- Start on the sandbox. The server uses the sandbox until you set
BAYARCASH_SANDBOXtofalse. Change to production, with live keys, only when a test payment works. - Read each payment before the assistant creates it. Check the amount, the payer and the portal. A payment link goes to a real customer.
- Keep your keys out of shared files. The settings file holds your token and secret key. Do not commit it to Git, and do not share it in a chat or a screenshot.
Common issues
The server stops with "Error: BAYARCASH_API_TOKEN and BAYARCASH_API_SECRET_KEY environment variables are required".
Your AI app did not pass the two keys to the server. Add BAYARCASH_API_TOKEN and BAYARCASH_API_SECRET_KEY to the env part of the server entry in its MCP settings, then restart the app.
The assistant says "Authentication failed. Check your API token and secret key."
The keys and the environment do not match. The server uses the sandbox until you set BAYARCASH_SANDBOX to false. Use sandbox keys with the sandbox and live keys with production. See Find your API keys.
The assistant created a payment with the wrong payment channel. Why?
The channel list in the server does not match the Bayarcash channel numbers for all channels. Leave the channel empty so your customer chooses on the Bayarcash page, or check the channel on the payment page before you send the link.
Was this article helpful?
Thanks for your feedback.
Sorry this didn't help. WhatsApp us and we'll sort it out with you.

