# mcp-niubiz

An MCP server for Peru's Niubiz acquirer. It opens a checkout session, authorizes the payment and reverses it the same day.

- MCP server · `type=mcp` · Claude Code, Codex, Cursor, GitHub Copilot, Windsurf (Devin Desktop), Cline, Zed, Gemini CLI · ★ 274
- Author: codespar
- License: MIT · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codespar/mcp-dev-latam/tree/HEAD/packages/payments/niubiz
- Updated: 2026-09-27
- HTML: https://affpapa.org/en/nevibecode/mcp/mcp-niubiz

## What it does

Four tools map onto Niubiz's standard ecommerce path. `get_security_token` fetches the bearer token and caches it for 20 minutes, so the other tools do not need it passed in. `create_session_token` builds the checkout with the amount and antifraud fields, `authorize_transaction` finishes the purchase, `reverse_transaction` voids it before the day ends.

Card numbers stay away from the server. The shopper enters them in Niubiz's own form, which hands back a `transactionToken`; authorization runs on that token. Your agent only ever handles the token.

Three credentials are mandatory: `NIUBIZ_USER`, `NIUBIZ_PASSWORD` and `NIUBIZ_MERCHANT_ID`. Without the merchant code the endpoints have nothing to target. `NIUBIZ_ENV` takes `sandbox` or `production` and starts on `sandbox`.

## Requirements
- Needs: Node.js (commands run via npx)
- Environment variables: `NIUBIZ_USER`, `NIUBIZ_PASSWORD`, `NIUBIZ_MERCHANT_ID`, `NIUBIZ_ENV` — keys and tokens: ask the human for the values, never commit them or put them in shared files.

## Install

### Claude Code (native platform)

**Platform CLI**
```bash
claude mcp add --env NIUBIZ_USER=<NIUBIZ_USER> --env NIUBIZ_PASSWORD=<NIUBIZ_PASSWORD> --env NIUBIZ_MERCHANT_ID=<NIUBIZ_MERCHANT_ID> --env NIUBIZ_ENV=<NIUBIZ_ENV> --transport stdio niubiz -- npx -y @codespar/mcp-niubiz
```
Replace <…> with your own values

### Codex

**Platform CLI**
```bash
codex mcp add niubiz --env NIUBIZ_USER=<NIUBIZ_USER> --env NIUBIZ_PASSWORD=<NIUBIZ_PASSWORD> --env NIUBIZ_MERCHANT_ID=<NIUBIZ_MERCHANT_ID> --env NIUBIZ_ENV=<NIUBIZ_ENV> -- npx -y @codespar/mcp-niubiz
```
Replace <…> with your own values

### Cursor

**Config file**
File `.cursor/mcp.json`:
```json
{
    "mcpServers": {
        "niubiz": {
            "command": "npx",
            "args": [
                "-y",
                "@codespar/mcp-niubiz"
            ],
            "env": {
                "NIUBIZ_USER": "<NIUBIZ_USER>",
                "NIUBIZ_PASSWORD": "<NIUBIZ_PASSWORD>",
                "NIUBIZ_MERCHANT_ID": "<NIUBIZ_MERCHANT_ID>",
                "NIUBIZ_ENV": "<NIUBIZ_ENV>"
            }
        }
    }
}
```
Replace <…> with your own values

### GitHub Copilot

**Config file**
File `.vscode/mcp.json`:
```json
{
    "servers": {
        "niubiz": {
            "type": "stdio",
            "command": "npx",
            "args": [
                "-y",
                "@codespar/mcp-niubiz"
            ],
            "env": {
                "NIUBIZ_USER": "<NIUBIZ_USER>",
                "NIUBIZ_PASSWORD": "<NIUBIZ_PASSWORD>",
                "NIUBIZ_MERCHANT_ID": "<NIUBIZ_MERCHANT_ID>",
                "NIUBIZ_ENV": "<NIUBIZ_ENV>"
            }
        }
    }
}
```
Replace <…> with your own values

### Gemini CLI

**Platform CLI**
```bash
gemini mcp add -e NIUBIZ_USER=<NIUBIZ_USER> -e NIUBIZ_PASSWORD=<NIUBIZ_PASSWORD> -e NIUBIZ_MERCHANT_ID=<NIUBIZ_MERCHANT_ID> -e NIUBIZ_ENV=<NIUBIZ_ENV> niubiz npx -y @codespar/mcp-niubiz
```
Replace <…> with your own values

## When to use it
- open a Niubiz checkout with an amount and antifraud data
- authorize a purchase using the checkout's `transactionToken`
- void an authorization on the same day
- test the payment path on sandbox first
- get a Niubiz security token without handling it by hand

## Example prompts
- Create a Niubiz session for 120.50 and show me the `transactionToken`
- Authorize the payment with that `transactionToken`
- Reverse the authorization we made today

## Similar
- [MCP Toolbox for Databases](https://affpapa.org/en/nevibecode/mcp/googleapis-mcp-toolbox-for-databases.md) — MCP server · ★ 16717
- [PostHog MCP Server](https://affpapa.org/en/nevibecode/mcp/posthog-mcp-server.md) — MCP server · ★ 40409
- [OpenWork MCP Gateway](https://affpapa.org/en/nevibecode/mcp/openwork-mcp-gateway.md) — MCP server · ★ 24242
- [Keploy](https://affpapa.org/en/nevibecode/mcp/keploy.md) — MCP server · ★ 18727
- [Nhost](https://affpapa.org/en/nevibecode/mcp/nhost.md) — MCP server · ★ 9366
- [basebalance.cloud — x402 RPC & MCP gateway](https://affpapa.org/en/nevibecode/mcp/basebalancecloud-x402-rpc-mcp-gateway.md) — MCP server · ★ 7506

From the same set: [codespar/mcp-dev-latam](https://affpapa.org/en/nevibecode/by/codespar/mcp-dev-latam.md) — 124 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
