nomba-mcp 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/README.md +271 -844
  2. package/build/client.d.ts +1 -0
  3. package/build/client.js +43 -3
  4. package/build/client.js.map +1 -1
  5. package/build/index.js +15 -5
  6. package/build/index.js.map +1 -1
  7. package/build/redact.d.ts +10 -0
  8. package/build/redact.js +51 -0
  9. package/build/redact.js.map +1 -0
  10. package/build/spending-guard.d.ts +16 -0
  11. package/build/spending-guard.js +37 -0
  12. package/build/spending-guard.js.map +1 -0
  13. package/build/tools/accounts.js +11 -12
  14. package/build/tools/accounts.js.map +1 -1
  15. package/build/tools/airtime.d.ts +2 -1
  16. package/build/tools/airtime.js +9 -1
  17. package/build/tools/airtime.js.map +1 -1
  18. package/build/tools/bills/betting.d.ts +2 -1
  19. package/build/tools/bills/betting.js +6 -1
  20. package/build/tools/bills/betting.js.map +1 -1
  21. package/build/tools/bills/cable.d.ts +2 -1
  22. package/build/tools/bills/cable.js +7 -1
  23. package/build/tools/bills/cable.js.map +1 -1
  24. package/build/tools/bills/electricity.d.ts +2 -1
  25. package/build/tools/bills/electricity.js +7 -1
  26. package/build/tools/bills/electricity.js.map +1 -1
  27. package/build/tools/bills/index.d.ts +2 -1
  28. package/build/tools/bills/index.js +4 -4
  29. package/build/tools/bills/index.js.map +1 -1
  30. package/build/tools/checkout.d.ts +2 -1
  31. package/build/tools/checkout.js +23 -20
  32. package/build/tools/checkout.js.map +1 -1
  33. package/build/tools/sub-accounts.js +13 -16
  34. package/build/tools/sub-accounts.js.map +1 -1
  35. package/build/tools/transactions.js +12 -11
  36. package/build/tools/transactions.js.map +1 -1
  37. package/build/tools/transfers.d.ts +2 -1
  38. package/build/tools/transfers.js +13 -7
  39. package/build/tools/transfers.js.map +1 -1
  40. package/build/tools/virtual-accounts.js +17 -16
  41. package/build/tools/virtual-accounts.js.map +1 -1
  42. package/build/utils.d.ts +3 -0
  43. package/build/utils.js +28 -3
  44. package/build/utils.js.map +1 -1
  45. package/package.json +2 -2
package/README.md CHANGED
@@ -1,65 +1,82 @@
1
- # Nomba MCP
2
-
3
- A [Model Context Protocol (MCP)](https://modelcontextprotocol.io) server that connects Claude to the [Nomba](https://nomba.com) banking and payments API. This gives Claude the ability to check account balances, send money, generate payment links, manage virtual accounts, buy airtime, pay utility bills, and more -- all through natural language.
4
-
5
- ## Table of Contents
6
-
7
- - [How It Works](#how-it-works)
8
- - [Prerequisites](#prerequisites)
9
- - [Installation](#installation)
10
- - [Configuration](#configuration)
11
- - [Environment Variables](#environment-variables)
12
- - [Claude Desktop](#claude-desktop)
13
- - [Claude Code](#claude-code)
14
- - [Architecture](#architecture)
15
- - [Tools Reference](#tools-reference)
16
- - [Accounts & Terminals](#accounts--terminals)
17
- - [Sub-Accounts](#sub-accounts)
18
- - [Transfers](#transfers)
19
- - [Online Checkout](#online-checkout)
20
- - [Virtual Accounts](#virtual-accounts)
21
- - [Transactions](#transactions)
22
- - [Bills & Utilities](#bills--utilities)
23
- - [Airtime & Data](#airtime--data)
24
- - [Resources](#resources)
25
- - [Example Prompts](#example-prompts)
26
- - [Development](#development)
27
- - [Troubleshooting](#troubleshooting)
28
-
29
- ---
30
-
31
- ## How It Works
32
-
33
- This server acts as a bridge between Claude and the Nomba API. It runs as a local process that communicates with Claude over stdio (standard input/output) using the MCP protocol. When you ask Claude something like "What's my Nomba balance?", Claude calls the appropriate tool on this server, which makes the authenticated API request to Nomba and returns the result.
1
+ # nomba-mcp
34
2
 
35
- ```
36
- You <-> Claude <-> MCP Server (this project) <-> Nomba API
37
- ```
3
+ [![npm version](https://img.shields.io/npm/v/nomba-mcp.svg)](https://www.npmjs.com/package/nomba-mcp)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
+
6
+ An MCP (Model Context Protocol) server for the [Nomba API](https://developer.nomba.com). Connect any MCP-compatible AI assistant to your Nomba business account to check balances, send money, generate payment links, manage virtual accounts, buy airtime, pay utility bills, and more.
7
+
8
+ Works with any MCP client including Claude Desktop, Claude Code, Cursor, Windsurf, Cline, and other MCP-compatible tools.
9
+
10
+ Built on Nomba's v1 API with OAuth2 authentication, this server provides 41 tools covering accounts, sub-accounts, terminals, transfers, online checkout, virtual accounts, transactions, bills (electricity, cable TV, betting), and airtime/data.
11
+
12
+ > **Note:** The server defaults to the **sandbox** environment. All transactions in sandbox mode use test data and do not move real money. Set `NOMBA_BASE_URL=https://api.nomba.com` only when you are ready to go live.
38
13
 
39
- Authentication is handled automatically. The server obtains an OAuth2 access token on the first request and refreshes it transparently before expiry.
14
+ ## Features
15
+
16
+ - **Accounts & Terminals** - View parent account details, check balance, list/assign/unassign POS terminals
17
+ - **Sub-Accounts** - Create, list, update, suspend, and reactivate child accounts with independent balances
18
+ - **Transfers** - Bank list lookup, account validation, bank transfers, internal transfers between Nomba accounts
19
+ - **Online Checkout** - Payment links, tokenized card charges, refunds, transaction status, cancellation
20
+ - **Virtual Accounts** - Create, update, expire, and list virtual bank accounts for receiving payments
21
+ - **Transactions** - Transaction history, filtering by type/date, single transaction details, status requery
22
+ - **Bills - Electricity** - List providers, validate meter numbers, purchase tokens (prepaid/postpaid)
23
+ - **Bills - Cable TV** - List providers, validate smartcards, pay subscriptions (DSTV, GOtv, Startimes)
24
+ - **Bills - Betting** - List providers, fund betting accounts
25
+ - **Airtime & Data** - Buy airtime, list data plans, purchase data bundles (MTN, Airtel, Glo, 9mobile)
26
+
27
+ ## Security
28
+
29
+ The server includes built-in security safeguards for financial operations:
30
+
31
+ - **Spending limits** - Configurable per-transaction maximum and session spending cap
32
+ - **Duplicate detection** - Blocks identical transactions (same amount + recipient) within 60 seconds
33
+ - **PII redaction** - BVN, bank account numbers, and card tokens are masked before being returned to the AI
34
+ - **Log redaction** - Sensitive fields (account numbers, phone numbers, emails) are masked in log output
35
+ - **HTTPS enforcement** - Refuses to start with non-HTTPS base URLs unless explicitly overridden
36
+ - **Production safeguard** - Requires explicit opt-in to use the production API
37
+ - **Tool annotations** - All tools are annotated with `destructiveHint`/`readOnlyHint` so MCP clients can enforce confirmation dialogs on financial operations
38
+ - **Path traversal protection** - Strict validation on all ID fields used in API paths
40
39
 
41
40
  ## Prerequisites
42
41
 
43
- - **Node.js 18+** (uses native `fetch`)
44
- - **Nomba API credentials** -- obtain these from your [Nomba Developer Dashboard](https://developer.nomba.com):
45
- - Client ID
46
- - Client Secret
47
- - Parent Account ID (UUID)
42
+ You need **Nomba API credentials** from the [Nomba Developer Dashboard](https://developer.nomba.com):
43
+
44
+ 1. **Client ID** - your API client ID
45
+ 2. **Client Secret** - your API client secret
46
+ 3. **Account ID** - your parent account ID (UUID format)
47
+
48
+ Authentication is handled automatically. The server obtains an OAuth2 access token on the first request and refreshes it transparently using the refresh token endpoint.
48
49
 
49
50
  ## Installation
50
51
 
51
- No build step required. Just configure your MCP client with `npx`:
52
+ ### Using npx (recommended)
52
53
 
53
54
  ```bash
54
55
  npx nomba-mcp
55
56
  ```
56
57
 
57
- Or install globally:
58
+ Also available as `@nomba-inc/mcp-server`:
59
+
60
+ ```bash
61
+ npx @nomba-inc/mcp-server
62
+ ```
63
+
64
+ ### Global install
58
65
 
59
66
  ```bash
60
67
  npm install -g nomba-mcp
61
68
  ```
62
69
 
70
+ ### Build from source
71
+
72
+ ```bash
73
+ git clone https://github.com/samaxbytez/nomba-mcp.git
74
+ cd nomba-mcp
75
+ npm install
76
+ npm run build
77
+ node build/index.js
78
+ ```
79
+
63
80
  ## Configuration
64
81
 
65
82
  ### Environment Variables
@@ -70,15 +87,14 @@ npm install -g nomba-mcp
70
87
  | `NOMBA_CLIENT_SECRET` | Yes | -- | Your client secret from the Nomba developer dashboard |
71
88
  | `NOMBA_ACCOUNT_ID` | Yes | -- | Your parent account ID (UUID format) |
72
89
  | `NOMBA_BASE_URL` | No | `https://sandbox.nomba.com` | API base URL. Set to `https://api.nomba.com` for production |
73
-
74
- > **Important:** The server defaults to the **sandbox** environment. All transactions in sandbox mode use test data and do not move real money. Set `NOMBA_BASE_URL=https://api.nomba.com` only when you are ready to go live.
90
+ | `NOMBA_MAX_TRANSACTION` | No | `100000` | Maximum amount (NGN) allowed per transaction |
91
+ | `NOMBA_SESSION_SPENDING_CAP` | No | `500000` | Maximum cumulative spending (NGN) per session |
92
+ | `NOMBA_PRODUCTION_CONFIRMED` | No | -- | Must be `true` when using `api.nomba.com` |
93
+ | `NOMBA_ALLOW_INSECURE` | No | -- | Set to `true` to allow non-HTTPS URLs (local dev only) |
75
94
 
76
95
  ### Claude Desktop
77
96
 
78
- Add the following to your Claude Desktop configuration file:
79
-
80
- - **macOS:** `~/Library/Application Support/Claude/claude_desktop_config.json`
81
- - **Windows:** `%APPDATA%\Claude\claude_desktop_config.json`
97
+ Add to your Claude Desktop config (`~/Library/Application Support/Claude/claude_desktop_config.json`):
82
98
 
83
99
  ```json
84
100
  {
@@ -89,19 +105,16 @@ Add the following to your Claude Desktop configuration file:
89
105
  "env": {
90
106
  "NOMBA_CLIENT_ID": "your_client_id",
91
107
  "NOMBA_CLIENT_SECRET": "your_client_secret",
92
- "NOMBA_ACCOUNT_ID": "your_account_id",
93
- "NOMBA_BASE_URL": "https://api.nomba.com"
108
+ "NOMBA_ACCOUNT_ID": "your_account_id"
94
109
  }
95
110
  }
96
111
  }
97
112
  }
98
113
  ```
99
114
 
100
- Restart Claude Desktop after saving. The Nomba tools will appear in the tools menu (hammer icon).
101
-
102
115
  ### Claude Code
103
116
 
104
- Add a `.mcp.json` file to your project root (or use global settings):
117
+ Add to your project's `.mcp.json`:
105
118
 
106
119
  ```json
107
120
  {
@@ -112,872 +125,286 @@ Add a `.mcp.json` file to your project root (or use global settings):
112
125
  "env": {
113
126
  "NOMBA_CLIENT_ID": "your_client_id",
114
127
  "NOMBA_CLIENT_SECRET": "your_client_secret",
115
- "NOMBA_ACCOUNT_ID": "your_account_id",
116
- "NOMBA_BASE_URL": "https://api.nomba.com"
128
+ "NOMBA_ACCOUNT_ID": "your_account_id"
117
129
  }
118
130
  }
119
131
  }
120
132
  }
121
133
  ```
122
134
 
123
- ---
135
+ ### Cursor / Windsurf
124
136
 
125
- ## Architecture
137
+ Add to your MCP settings (Settings > MCP Servers):
126
138
 
139
+ ```json
140
+ {
141
+ "nomba": {
142
+ "command": "npx",
143
+ "args": ["-y", "nomba-mcp"],
144
+ "env": {
145
+ "NOMBA_CLIENT_ID": "your_client_id",
146
+ "NOMBA_CLIENT_SECRET": "your_client_secret",
147
+ "NOMBA_ACCOUNT_ID": "your_account_id"
148
+ }
149
+ }
150
+ }
127
151
  ```
128
- src/
129
- ├── index.ts # Entry point: validates env vars, creates server, connects stdio
130
- ├── client.ts # NombaClient: OAuth2 token management + HTTP request wrapper
131
- ├── utils.ts # Shared helpers: jsonResponse, errorResponse, logToolCall, buildParams
132
- ├── tools/
133
- │ ├── accounts.ts # Parent account details, balance, terminals, terminal assign/unassign
134
- │ ├── sub-accounts.ts # Sub-account CRUD, balance, suspend, reactivate
135
- │ ├── transfers.ts # Bank list, account lookup, bank/internal transfers
136
- │ ├── checkout.ts # Payment links, tokenized cards, refunds
137
- │ ├── virtual-accounts.ts # Virtual account CRUD + listing
138
- │ ├── transactions.ts # Transaction history, details, filtering, status requery
139
- │ ├── bills/
140
- │ │ ├── index.ts # Re-exports all bill tool registrations
141
- │ │ ├── electricity.ts # Electricity providers, meter lookup, token purchase
142
- │ │ ├── betting.ts # Betting providers, account funding
143
- │ │ └── cable.ts # Cable TV providers, smartcard lookup, subscription payment
144
- │ └── airtime.ts # Airtime + data bundles
145
- ├── resources/
146
- │ └── bank-list.ts # Cached bank code list (MCP resource, 24h TTL)
147
- └── **/*.test.ts # 36 tests (Vitest) — co-located with source files
148
- ```
149
-
150
- **Key design decisions:**
151
-
152
- - **Automatic authentication** -- The `NombaClient` class handles the full OAuth2 lifecycle. Tokens are obtained on the first API call and refreshed 60 seconds before expiry. A promise lock prevents concurrent refresh requests when multiple tools execute in parallel.
153
- - **401 auto-retry** -- If a request fails with a 401, the server clears the stale token, re-authenticates, and retries once. This handles token revocation gracefully without infinite loops.
154
- - **Structured error handling** -- API errors are parsed into `NombaApiError` with status, code, and description. Every tool catches errors and returns them with `isError: true`, so Claude can report the failure and suggest next steps rather than crashing. Raw API bodies are never leaked.
155
- - **Audit logging** -- Every tool invocation is logged to stderr via `logToolCall()` with timestamp, tool name, and parameters (long values are truncated).
156
- - **Tool name prefixing** -- All tools are prefixed with `nomba_` to avoid collisions with other MCP servers that may be running simultaneously.
157
- - **Stdio transport** -- The server communicates over stdin/stdout using JSON-RPC. All logging uses `console.error` to avoid corrupting the protocol stream.
158
-
159
- ---
160
-
161
- ## Tools Reference
162
-
163
- ### Accounts & Terminals
164
-
165
- #### `nomba_get_parent_account`
166
-
167
- Fetch the parent account details for the authenticated Nomba business.
168
-
169
- | Parameter | Type | Required | Description |
170
- |-----------|------|----------|-------------|
171
- | *(none)* | -- | -- | No parameters required |
172
-
173
- **Returns:** Account ID, name, type, status, BVN, and linked bank accounts.
174
-
175
- **API Endpoint:** `GET /v1/accounts/parent`
176
-
177
- ---
178
-
179
- #### `nomba_get_parent_balance`
180
-
181
- Fetch the current balance of the parent Nomba business account.
182
-
183
- | Parameter | Type | Required | Description |
184
- |-----------|------|----------|-------------|
185
- | *(none)* | -- | -- | No parameters required |
186
-
187
- **Returns:** Available balance in NGN.
188
-
189
- **API Endpoint:** `GET /v1/accounts/parent/balance`
190
-
191
- ---
192
-
193
- #### `nomba_list_terminals`
194
-
195
- List all POS terminals assigned to the parent Nomba account.
196
-
197
- | Parameter | Type | Required | Description |
198
- |-----------|------|----------|-------------|
199
- | *(none)* | -- | -- | No parameters required |
200
-
201
- **Returns:** Terminal IDs, serial numbers, and labels.
202
-
203
- **API Endpoint:** `GET /v1/accounts/terminals`
204
-
205
- ---
206
-
207
- #### `nomba_assign_terminal`
208
-
209
- Assign a POS terminal to the parent Nomba account.
210
-
211
- | Parameter | Type | Required | Description |
212
- |-----------|------|----------|-------------|
213
- | `terminalId` | string | Yes | The terminal ID to assign |
214
- | `serialNumber` | string | Yes | The terminal serial number |
215
-
216
- **Returns:** Assignment confirmation.
217
-
218
- **API Endpoint:** `POST /v1/terminals/assign`
219
-
220
- ---
221
-
222
- #### `nomba_unassign_terminal`
223
-
224
- Unassign a POS terminal from the parent Nomba account.
225
-
226
- | Parameter | Type | Required | Description |
227
- |-----------|------|----------|-------------|
228
- | `terminalId` | string | Yes | The terminal ID to unassign |
229
-
230
- **Returns:** Unassignment confirmation.
231
-
232
- **API Endpoint:** `POST /v1/terminals/unassign`
233
-
234
- ---
235
-
236
- ### Sub-Accounts
237
-
238
- Sub-accounts are child accounts under your parent Nomba account. They can have their own balances and make transactions independently.
239
-
240
- #### `nomba_create_sub_account`
241
-
242
- Create a new sub-account under the parent Nomba account.
243
-
244
- | Parameter | Type | Required | Description |
245
- |-----------|------|----------|-------------|
246
- | `accountName` | string | Yes | Name for the sub-account |
247
- | `email` | string | No | Email address for the sub-account holder |
248
- | `phoneNumber` | string | No | Phone number for the sub-account holder |
249
-
250
- **Returns:** New sub-account details including account ID.
251
-
252
- **API Endpoint:** `POST /v1/accounts`
253
-
254
- ---
255
-
256
- #### `nomba_list_sub_accounts`
257
-
258
- List all sub-accounts under the parent Nomba account.
259
-
260
- | Parameter | Type | Required | Description |
261
- |-----------|------|----------|-------------|
262
- | `limit` | number | No | Results per page (max 50) |
263
- | `cursor` | string | No | Pagination cursor from a previous response |
264
-
265
- **Returns:** Array of sub-accounts with pagination cursor.
266
-
267
- **API Endpoint:** `GET /v1/accounts`
268
-
269
- ---
270
-
271
- #### `nomba_get_sub_account`
272
-
273
- Fetch details of a specific sub-account.
274
-
275
- | Parameter | Type | Required | Description |
276
- |-----------|------|----------|-------------|
277
- | `accountId` | string | Yes | The sub-account ID |
278
-
279
- **Returns:** Sub-account details including name, status, and metadata.
280
-
281
- **API Endpoint:** `GET /v1/accounts/{accountId}`
282
-
283
- ---
284
-
285
- #### `nomba_get_sub_account_balance`
286
-
287
- Fetch the current balance of a specific sub-account.
288
-
289
- | Parameter | Type | Required | Description |
290
- |-----------|------|----------|-------------|
291
- | `accountId` | string | Yes | The sub-account ID |
292
-
293
- **Returns:** Available balance in NGN.
294
-
295
- **API Endpoint:** `GET /v1/accounts/{accountId}/balance`
296
-
297
- ---
298
-
299
- #### `nomba_update_sub_account`
300
-
301
- Update the details of an existing sub-account.
302
-
303
- | Parameter | Type | Required | Description |
304
- |-----------|------|----------|-------------|
305
- | `accountId` | string | Yes | The sub-account ID to update |
306
- | `accountName` | string | No | New account name |
307
- | `email` | string | No | New email address |
308
- | `phoneNumber` | string | No | New phone number |
309
-
310
- **Returns:** Updated sub-account details.
311
-
312
- **API Endpoint:** `PUT /v1/accounts/{accountId}`
313
-
314
- ---
315
-
316
- #### `nomba_suspend_sub_account`
317
-
318
- Suspend a sub-account. Suspended accounts cannot make or receive transactions.
319
-
320
- | Parameter | Type | Required | Description |
321
- |-----------|------|----------|-------------|
322
- | `accountId` | string | Yes | The sub-account ID to suspend |
323
-
324
- **Returns:** Suspension confirmation.
325
-
326
- **API Endpoint:** `PUT /v1/accounts/{accountId}/suspend`
327
-
328
- > **Warning:** Suspended accounts are blocked from all transactions until reactivated.
329
-
330
- ---
331
-
332
- #### `nomba_reactivate_sub_account`
333
-
334
- Reactivate a previously suspended sub-account.
335
-
336
- | Parameter | Type | Required | Description |
337
- |-----------|------|----------|-------------|
338
- | `accountId` | string | Yes | The sub-account ID to reactivate |
339
-
340
- **Returns:** Reactivation confirmation.
341
-
342
- **API Endpoint:** `PUT /v1/accounts/{accountId}/reactivate`
343
-
344
- ---
345
-
346
- ### Transfers
347
-
348
- #### `nomba_list_banks`
349
-
350
- Fetch the list of all Nigerian bank codes and names. Call this first to get the correct `bankCode` before making transfers.
351
-
352
- | Parameter | Type | Required | Description |
353
- |-----------|------|----------|-------------|
354
- | *(none)* | -- | -- | No parameters required |
355
-
356
- **Returns:** Array of `{ code, name }` objects for all Nigerian banks.
357
-
358
- **API Endpoint:** `GET /v1/transfers/banks`
359
-
360
- ---
361
-
362
- #### `nomba_lookup_bank_account`
363
-
364
- Validate a bank account by looking up the account holder's name. Always call this before initiating a transfer to confirm the recipient.
365
-
366
- | Parameter | Type | Required | Description |
367
- |-----------|------|----------|-------------|
368
- | `accountNumber` | string | Yes | 10-digit Nigerian bank account number |
369
- | `bankCode` | string | Yes | Bank code from `nomba_list_banks` |
370
-
371
- **Returns:** Account holder name, account number, and bank details.
372
-
373
- **API Endpoint:** `POST /v1/transfers/bank-account-lookup`
374
-
375
- ---
376
-
377
- #### `nomba_transfer_to_bank`
378
-
379
- Transfer funds from the Nomba account to an external Nigerian bank account.
380
-
381
- | Parameter | Type | Required | Description |
382
- |-----------|------|----------|-------------|
383
- | `amount` | number | Yes | Amount in Naira (must be positive) |
384
- | `accountNumber` | string | Yes | Recipient 10-digit bank account number |
385
- | `bankCode` | string | Yes | Recipient bank code |
386
- | `narration` | string | No | Transfer description/narration |
387
-
388
- **Returns:** Transaction ID, status, and transfer details.
389
-
390
- **API Endpoint:** `POST /v1/transfers/to-banks`
391
-
392
- > **Tip:** Always call `nomba_lookup_bank_account` first to verify the recipient before transferring.
393
-
394
- ---
395
-
396
- #### `nomba_transfer_between_accounts`
397
-
398
- Transfer funds between two Nomba accounts (e.g., parent to sub-account).
399
-
400
- | Parameter | Type | Required | Description |
401
- |-----------|------|----------|-------------|
402
- | `amount` | number | Yes | Amount in Naira (must be positive) |
403
- | `destinationAccountId` | string | Yes | Destination Nomba account ID (UUID) |
404
- | `narration` | string | No | Transfer description/narration |
405
-
406
- **Returns:** Transaction ID and transfer status.
407
-
408
- **API Endpoint:** `POST /v1/transfers/between-accounts`
409
-
410
- ---
411
-
412
- ### Online Checkout
413
-
414
- #### `nomba_create_checkout_order`
415
-
416
- Create a checkout payment order and get a hosted payment link. The customer can pay via card, bank transfer, or USSD.
417
-
418
- | Parameter | Type | Required | Description |
419
- |-----------|------|----------|-------------|
420
- | `amount` | number | Yes | Payment amount in Naira |
421
- | `customerEmail` | string | Yes | Customer's email address |
422
- | `callbackUrl` | string | Yes | URL to redirect the customer to after payment |
423
- | `orderReference` | string | No | Your unique order reference/ID |
424
- | `customerId` | string | No | Your internal customer identifier |
425
- | `tokenizeCard` | boolean | No | Save the customer's card for future charges |
426
-
427
- **Returns:** A `checkoutLink` URL for the customer and an `orderReference`.
428
-
429
- **API Endpoint:** `POST /v1/checkout/order`
430
-
431
- ---
432
-
433
- #### `nomba_charge_tokenized_card`
434
-
435
- Charge a previously saved/tokenized card. Use this for recurring payments or returning customers.
436
-
437
- | Parameter | Type | Required | Description |
438
- |-----------|------|----------|-------------|
439
- | `amount` | number | Yes | Amount in Naira to charge |
440
- | `tokenizedCardId` | string | Yes | Tokenized card ID from a previous checkout |
441
- | `customerEmail` | string | Yes | Customer's email address |
442
-
443
- **Returns:** Transaction details and charge status.
444
-
445
- **API Endpoint:** `POST /v1/checkout/charge-tokenized-card`
446
-
447
- ---
448
-
449
- #### `nomba_refund_transaction`
450
-
451
- Process a full or partial refund for a completed checkout transaction.
452
-
453
- | Parameter | Type | Required | Description |
454
- |-----------|------|----------|-------------|
455
- | `transactionId` | string | Yes | The transaction ID to refund |
456
- | `amount` | number | No | Amount to refund in Naira. Omit for full refund |
457
-
458
- **Returns:** Refund confirmation and status.
459
-
460
- **API Endpoint:** `POST /v1/checkout/refund`
461
-
462
- ---
463
-
464
- #### `nomba_get_checkout_transaction`
465
-
466
- Retrieve the details and status of a checkout transaction.
467
-
468
- | Parameter | Type | Required | Description |
469
- |-----------|------|----------|-------------|
470
- | `orderReference` | string | Yes | The order reference from checkout creation |
471
-
472
- **Returns:** Full transaction details including payment status, amount, and timestamps.
473
-
474
- **API Endpoint:** `GET /v1/checkout/order/{orderReference}`
475
-
476
- ---
477
-
478
- #### `nomba_cancel_transaction`
479
-
480
- Cancel an incomplete/pending checkout transaction. Only works for transactions that have not been completed.
481
-
482
- | Parameter | Type | Required | Description |
483
- |-----------|------|----------|-------------|
484
- | `orderReference` | string | Yes | The order reference of the transaction to cancel |
485
-
486
- **Returns:** Cancellation confirmation.
487
-
488
- **API Endpoint:** `POST /v1/checkout/cancel-transaction`
489
-
490
- ---
491
-
492
- ### Virtual Accounts
493
-
494
- Virtual accounts are temporary or permanent bank accounts created under your parent Nomba account. They are useful for receiving payments from specific customers or for specific purposes.
495
152
 
496
- #### `nomba_create_virtual_account`
153
+ ### Any MCP Client
497
154
 
498
- Create a new virtual bank account.
155
+ Set the environment variables and run:
499
156
 
500
- | Parameter | Type | Required | Description |
501
- |-----------|------|----------|-------------|
502
- | `accountName` | string | Yes | Name for the account holder (8-64 characters) |
503
- | `accountRef` | string | No | Your unique reference for this account (16-64 characters) |
504
-
505
- **Returns:** Account details including bank name, account number, and account name.
506
-
507
- **API Endpoint:** `POST /v1/accounts/virtual`
508
-
509
- ---
510
-
511
- #### `nomba_get_virtual_account`
512
-
513
- Fetch details of a specific virtual account.
514
-
515
- | Parameter | Type | Required | Description |
516
- |-----------|------|----------|-------------|
517
- | `accountId` | string | Yes | The virtual account ID (UUID) |
518
-
519
- **Returns:** Account name, bank details, status, and balance.
520
-
521
- **API Endpoint:** `GET /v1/accounts/virtual/{accountId}`
522
-
523
- ---
524
-
525
- #### `nomba_update_virtual_account`
526
-
527
- Update an existing virtual account's details.
528
-
529
- | Parameter | Type | Required | Description |
530
- |-----------|------|----------|-------------|
531
- | `accountId` | string | Yes | The virtual account ID (UUID) to update |
532
- | `accountName` | string | No | New account name (8-64 characters) |
533
- | `callbackUrl` | string | No | Webhook URL for payment notifications |
534
-
535
- **Returns:** Updated account details.
536
-
537
- **API Endpoint:** `PATCH /v1/accounts/virtual/{accountId}`
538
-
539
- ---
540
-
541
- #### `nomba_expire_virtual_account`
542
-
543
- Expire/deactivate a virtual account so it can no longer receive payments.
544
-
545
- | Parameter | Type | Required | Description |
546
- |-----------|------|----------|-------------|
547
- | `accountId` | string | Yes | The virtual account ID (UUID) to expire |
548
-
549
- **Returns:** Expiration confirmation.
550
-
551
- **API Endpoint:** `POST /v1/accounts/virtual/{accountId}/expire`
552
-
553
- > **Warning:** This action cannot be undone. The account will permanently stop accepting payments.
554
-
555
- ---
556
-
557
- #### `nomba_list_virtual_accounts`
558
-
559
- List all virtual accounts under the parent Nomba account.
560
-
561
- | Parameter | Type | Required | Description |
562
- |-----------|------|----------|-------------|
563
- | `limit` | number | No | Results per page (max 50) |
564
- | `cursor` | string | No | Pagination cursor from a previous response |
565
-
566
- **Returns:** Array of virtual accounts with a pagination cursor for the next page.
567
-
568
- **API Endpoint:** `GET /v1/accounts/virtual`
569
-
570
- ---
571
-
572
- ### Transactions
573
-
574
- #### `nomba_list_bank_transactions`
575
-
576
- Fetch bank transaction history for the parent account with optional date filtering and pagination.
577
-
578
- | Parameter | Type | Required | Description |
579
- |-----------|------|----------|-------------|
580
- | `limit` | number | No | Results per page (max 50) |
581
- | `cursor` | string | No | Pagination cursor from a previous response |
582
- | `dateFrom` | string | No | Start date in UTC (e.g., `2024-01-01T00:00:00Z`) |
583
- | `dateTo` | string | No | End date in UTC (e.g., `2024-12-31T23:59:59Z`) |
584
-
585
- **Returns:** Array of transactions with amounts, types (CREDIT/DEBIT), statuses, wallet balances, and metadata.
586
-
587
- **API Endpoint:** `GET /v1/transactions/bank`
588
-
589
- ---
590
-
591
- #### `nomba_requery_transaction`
592
-
593
- Check the status of a specific transaction using its session ID. Useful for verifying if a transfer or payment was successful.
594
-
595
- | Parameter | Type | Required | Description |
596
- |-----------|------|----------|-------------|
597
- | `sessionId` | string | Yes | The session ID of the transaction |
598
-
599
- **Returns:** Transaction status and details.
600
-
601
- **API Endpoint:** `POST /v1/transactions/accounts`
602
-
603
- ---
604
-
605
- #### `nomba_get_transaction`
606
-
607
- Fetch details of a single transaction by its transaction ID.
608
-
609
- | Parameter | Type | Required | Description |
610
- |-----------|------|----------|-------------|
611
- | `transactionId` | string | Yes | The transaction ID to look up |
612
-
613
- **Returns:** Full transaction details including amount, type, status, and metadata.
614
-
615
- **API Endpoint:** `GET /v1/transactions/{transactionId}`
616
-
617
- ---
618
-
619
- #### `nomba_filter_transactions`
620
-
621
- Filter transactions on the parent account with advanced filters. Supports filtering by type, date range, and pagination.
622
-
623
- | Parameter | Type | Required | Description |
624
- |-----------|------|----------|-------------|
625
- | `type` | string | No | Filter by transaction type: `CREDIT` or `DEBIT` |
626
- | `limit` | number | No | Results per page (max 50) |
627
- | `cursor` | string | No | Pagination cursor from a previous response |
628
- | `dateFrom` | string | No | Start date in UTC (e.g., `2024-01-01T00:00:00Z`) |
629
- | `dateTo` | string | No | End date in UTC (e.g., `2024-12-31T23:59:59Z`) |
630
-
631
- **Returns:** Filtered array of transactions with pagination cursor.
632
-
633
- **API Endpoint:** `GET /v1/transactions/filter`
634
-
635
- ---
636
-
637
- ### Bills & Utilities
638
-
639
- #### Electricity
640
-
641
- ##### `nomba_get_electricity_providers`
642
-
643
- Fetch available electricity distribution companies (DisCos).
644
-
645
- | Parameter | Type | Required | Description |
646
- |-----------|------|----------|-------------|
647
- | *(none)* | -- | -- | No parameters required |
648
-
649
- **Returns:** List of providers with codes and names.
650
-
651
- **API Endpoint:** `GET /v1/bills/electricity/providers`
652
-
653
- ---
654
-
655
- ##### `nomba_lookup_electricity_customer`
656
-
657
- Validate an electricity meter number and get the customer's name.
658
-
659
- | Parameter | Type | Required | Description |
660
- |-----------|------|----------|-------------|
661
- | `meterNumber` | string | Yes | The electricity meter number |
662
- | `providerCode` | string | Yes | Provider code from `nomba_get_electricity_providers` |
663
- | `meterType` | string | Yes | `"prepaid"` or `"postpaid"` |
664
-
665
- **Returns:** Customer name and meter validation details.
666
-
667
- **API Endpoint:** `POST /v1/bills/electricity/customer-lookup`
668
-
669
- ---
670
-
671
- ##### `nomba_buy_electricity`
672
-
673
- Purchase electricity tokens (prepaid) or pay an electricity bill (postpaid).
674
-
675
- | Parameter | Type | Required | Description |
676
- |-----------|------|----------|-------------|
677
- | `meterNumber` | string | Yes | The electricity meter number |
678
- | `providerCode` | string | Yes | Electricity provider code |
679
- | `meterType` | string | Yes | `"prepaid"` or `"postpaid"` |
680
- | `amount` | number | Yes | Amount in Naira |
681
-
682
- **Returns:** Purchase confirmation and token details (for prepaid).
683
-
684
- **API Endpoint:** `POST /v1/bills/electricity/pay`
685
-
686
- > **Tip:** Always call `nomba_lookup_electricity_customer` first to verify the meter details.
687
-
688
- ---
689
-
690
- #### Betting
691
-
692
- ##### `nomba_get_betting_providers`
693
-
694
- Fetch available betting platforms.
695
-
696
- | Parameter | Type | Required | Description |
697
- |-----------|------|----------|-------------|
698
- | *(none)* | -- | -- | No parameters required |
699
-
700
- **Returns:** List of betting providers with codes.
701
-
702
- **API Endpoint:** `GET /v1/bills/betting/providers`
703
-
704
- ---
705
-
706
- ##### `nomba_fund_betting_account`
707
-
708
- Fund a customer's betting account.
709
-
710
- | Parameter | Type | Required | Description |
711
- |-----------|------|----------|-------------|
712
- | `customerId` | string | Yes | Customer's betting account ID/username |
713
- | `providerCode` | string | Yes | Betting provider code |
714
- | `amount` | number | Yes | Amount in Naira |
715
-
716
- **Returns:** Funding confirmation and transaction details.
717
-
718
- **API Endpoint:** `POST /v1/bills/betting/pay`
719
-
720
- ---
721
-
722
- #### Cable TV
723
-
724
- ##### `nomba_get_cable_providers`
725
-
726
- Fetch available cable TV providers (DSTV, GOtv, Startimes, etc.).
727
-
728
- | Parameter | Type | Required | Description |
729
- |-----------|------|----------|-------------|
730
- | *(none)* | -- | -- | No parameters required |
731
-
732
- **Returns:** List of cable TV providers with codes.
733
-
734
- **API Endpoint:** `GET /v1/bills/cabletv/providers`
735
-
736
- ---
737
-
738
- ##### `nomba_lookup_cable_customer`
739
-
740
- Validate a cable TV smartcard/IUC number and get the customer's name.
741
-
742
- | Parameter | Type | Required | Description |
743
- |-----------|------|----------|-------------|
744
- | `smartcardNumber` | string | Yes | The smartcard or IUC number |
745
- | `providerCode` | string | Yes | Cable TV provider code |
746
-
747
- **Returns:** Customer name and smartcard validation details.
748
-
749
- **API Endpoint:** `POST /v1/bills/cabletv/customer-lookup`
750
-
751
- ---
752
-
753
- ##### `nomba_pay_cable_subscription`
754
-
755
- Pay for a cable TV subscription.
756
-
757
- | Parameter | Type | Required | Description |
758
- |-----------|------|----------|-------------|
759
- | `smartcardNumber` | string | Yes | The smartcard or IUC number |
760
- | `providerCode` | string | Yes | Cable TV provider code |
761
- | `productCode` | string | Yes | Subscription plan/bouquet code |
762
- | `amount` | number | Yes | Amount in Naira |
763
-
764
- **Returns:** Payment confirmation and subscription details.
765
-
766
- **API Endpoint:** `POST /v1/bills/cabletv/pay`
767
-
768
- > **Tip:** Always call `nomba_lookup_cable_customer` first to verify the smartcard number.
769
-
770
- ---
771
-
772
- ### Airtime & Data
773
-
774
- #### `nomba_buy_airtime`
775
-
776
- Purchase airtime/credit for a Nigerian phone number. Supports MTN, Airtel, Glo, and 9mobile.
777
-
778
- | Parameter | Type | Required | Description |
779
- |-----------|------|----------|-------------|
780
- | `phoneNumber` | string | Yes | Nigerian phone number (e.g., `08012345678` or `2348012345678`) |
781
- | `amount` | number | Yes | Amount of airtime in Naira |
782
- | `network` | string | No | Network provider (`MTN`, `AIRTEL`, `GLO`, `9MOBILE`). Auto-detected if omitted |
783
-
784
- **Returns:** Airtime purchase confirmation.
785
-
786
- **API Endpoint:** `POST /v1/bills/airtime/pay`
787
-
788
- ---
789
-
790
- #### `nomba_list_data_plans`
791
-
792
- Fetch available data bundle plans for a network provider.
793
-
794
- | Parameter | Type | Required | Description |
795
- |-----------|------|----------|-------------|
796
- | `network` | string | Yes | Network provider (`MTN`, `AIRTEL`, `GLO`, `9MOBILE`) |
797
-
798
- **Returns:** List of plans with names, data amounts, prices, and plan codes.
799
-
800
- **API Endpoint:** `GET /v1/bills/data/plans`
801
-
802
- ---
803
-
804
- #### `nomba_buy_data`
157
+ ```bash
158
+ NOMBA_CLIENT_ID=your_id NOMBA_CLIENT_SECRET=your_secret NOMBA_ACCOUNT_ID=your_account npx nomba-mcp
159
+ ```
805
160
 
806
- Purchase a data bundle for a Nigerian phone number.
161
+ The server communicates over stdio using the standard MCP transport, so it works with any client that supports the MCP protocol.
807
162
 
808
- | Parameter | Type | Required | Description |
809
- |-----------|------|----------|-------------|
810
- | `phoneNumber` | string | Yes | Nigerian phone number (e.g., `08012345678` or `2348012345678`) |
811
- | `dataPlanCode` | string | Yes | Data plan code from `nomba_list_data_plans` |
812
- | `network` | string | Yes | Network provider (`MTN`, `AIRTEL`, `GLO`, `9MOBILE`) |
163
+ ## Architecture
813
164
 
814
- **Returns:** Data purchase confirmation.
165
+ ```
166
+ nomba-mcp/
167
+ ├── src/
168
+ │ ├── index.ts # Entry point, server setup, spending guard config
169
+ │ ├── client.ts # Nomba API client (OAuth2 token + refresh management)
170
+ │ ├── utils.ts # Shared utilities (jsonResponse, logToolCall, safeId)
171
+ │ ├── redact.ts # Response field filtering (BVN, account numbers, card tokens)
172
+ │ ├── spending-guard.ts # Transaction limits, session caps, duplicate detection
173
+ │ ├── resources/
174
+ │ │ └── bank-list.ts # Cached bank code list (MCP resource, 24h TTL)
175
+ │ └── tools/
176
+ │ ├── accounts.ts # Parent account details, balance, terminals
177
+ │ ├── sub-accounts.ts # Sub-account CRUD, balance, suspend, reactivate
178
+ │ ├── transfers.ts # Bank list, account lookup, bank/internal transfers
179
+ │ ├── checkout.ts # Payment links, tokenized cards, refunds
180
+ │ ├── virtual-accounts.ts # Virtual account CRUD and listing
181
+ │ ├── transactions.ts # Transaction history, details, filtering, requery
182
+ │ ├── airtime.ts # Airtime and data bundles
183
+ │ └── bills/
184
+ │ ├── index.ts # Hub re-exporting all bill tool registrations
185
+ │ ├── electricity.ts # Electricity providers, meter lookup, token purchase
186
+ │ ├── cable.ts # Cable TV providers, smartcard lookup, subscriptions
187
+ │ └── betting.ts # Betting providers, account funding
188
+ ├── package.json
189
+ ├── tsconfig.json
190
+ └── README.md
191
+ ```
815
192
 
816
- **API Endpoint:** `POST /v1/bills/data/pay`
193
+ **Design decisions:**
194
+ - Uses OAuth2 Client Credentials with automatic token refresh via `/v1/auth/token/refresh` and 401 auto-retry
195
+ - A promise lock prevents concurrent token refresh when multiple tools execute in parallel
196
+ - Financial tools are guarded by a shared `SpendingGuard` instance with configurable limits
197
+ - Sensitive data (BVN, bank account numbers, card tokens) is redacted from API responses before reaching the AI
198
+ - Bills are split into sub-files (electricity, cable, betting) with a hub for clean organization
199
+ - Bank list is exposed as an MCP resource with 24h cache TTL
200
+ - All tools annotated with MCP `destructiveHint`/`readOnlyHint` for client-side confirmation enforcement
201
+ - Tool names prefixed with `nomba_` to avoid collisions with other MCP servers
817
202
 
818
- > **Tip:** Always call `nomba_list_data_plans` first to get available plans and their codes.
203
+ ## Tools Reference
819
204
 
820
- ---
205
+ ### Accounts & Terminals (5 tools)
206
+
207
+ | Tool | Description | API Endpoint |
208
+ |------|-------------|-------------|
209
+ | `nomba_get_parent_account` | Get parent account details (ID, name, type, status, linked banks) | `GET /v1/accounts/parent` |
210
+ | `nomba_get_parent_balance` | Get current balance of parent account (NGN) | `GET /v1/accounts/parent/balance` |
211
+ | `nomba_list_terminals` | List all POS terminals assigned to the account | `GET /v1/accounts/terminals` |
212
+ | `nomba_assign_terminal` | Assign a POS terminal by ID and serial number | `POST /v1/terminals/assign` |
213
+ | `nomba_unassign_terminal` | Unassign a POS terminal | `POST /v1/terminals/unassign` |
214
+
215
+ ### Sub-Accounts (7 tools)
216
+
217
+ | Tool | Description | API Endpoint |
218
+ |------|-------------|-------------|
219
+ | `nomba_create_sub_account` | Create a new sub-account with name, optional email/phone | `POST /v1/accounts` |
220
+ | `nomba_list_sub_accounts` | List all sub-accounts with pagination | `GET /v1/accounts` |
221
+ | `nomba_get_sub_account` | Get details of a specific sub-account | `GET /v1/accounts/{accountId}` |
222
+ | `nomba_get_sub_account_balance` | Get current balance of a sub-account | `GET /v1/accounts/{accountId}/balance` |
223
+ | `nomba_update_sub_account` | Update sub-account name, email, or phone | `PUT /v1/accounts/{accountId}` |
224
+ | `nomba_suspend_sub_account` | Suspend a sub-account (blocks all transactions) | `PUT /v1/accounts/{accountId}/suspend` |
225
+ | `nomba_reactivate_sub_account` | Reactivate a previously suspended sub-account | `PUT /v1/accounts/{accountId}/reactivate` |
226
+
227
+ ### Transfers (4 tools)
228
+
229
+ | Tool | Description | API Endpoint |
230
+ |------|-------------|-------------|
231
+ | `nomba_list_banks` | Fetch all Nigerian bank codes and names | `GET /v1/transfers/banks` |
232
+ | `nomba_lookup_bank_account` | Validate account number and get holder name (call before transfers) | `POST /v1/transfers/bank-account-lookup` |
233
+ | `nomba_transfer_to_bank` | Transfer funds to an external Nigerian bank account | `POST /v1/transfers/to-banks` |
234
+ | `nomba_transfer_between_accounts` | Transfer funds between Nomba accounts (e.g., parent to sub-account) | `POST /v1/transfers/between-accounts` |
235
+
236
+ ### Online Checkout (5 tools)
237
+
238
+ | Tool | Description | API Endpoint |
239
+ |------|-------------|-------------|
240
+ | `nomba_create_checkout_order` | Create payment link (card, bank transfer, or USSD) | `POST /v1/checkout/order` |
241
+ | `nomba_charge_tokenized_card` | Charge a previously saved card for recurring payments | `POST /v1/checkout/charge-tokenized-card` |
242
+ | `nomba_refund_transaction` | Process full or partial refund for a checkout transaction | `POST /v1/checkout/refund` |
243
+ | `nomba_get_checkout_transaction` | Get checkout transaction details and status | `GET /v1/checkout/order/{orderReference}` |
244
+ | `nomba_cancel_transaction` | Cancel an incomplete/pending checkout transaction | `POST /v1/checkout/cancel-transaction` |
245
+
246
+ ### Virtual Accounts (5 tools)
247
+
248
+ | Tool | Description | API Endpoint |
249
+ |------|-------------|-------------|
250
+ | `nomba_create_virtual_account` | Create a new virtual bank account | `POST /v1/accounts/virtual` |
251
+ | `nomba_get_virtual_account` | Get virtual account details and balance | `GET /v1/accounts/virtual/{accountId}` |
252
+ | `nomba_update_virtual_account` | Update account name or callback URL | `PATCH /v1/accounts/virtual/{accountId}` |
253
+ | `nomba_expire_virtual_account` | Permanently deactivate a virtual account | `POST /v1/accounts/virtual/{accountId}/expire` |
254
+ | `nomba_list_virtual_accounts` | List all virtual accounts with pagination | `GET /v1/accounts/virtual` |
255
+
256
+ ### Transactions (4 tools)
257
+
258
+ | Tool | Description | API Endpoint |
259
+ |------|-------------|-------------|
260
+ | `nomba_list_bank_transactions` | List transaction history with optional date filtering | `GET /v1/transactions/bank` |
261
+ | `nomba_requery_transaction` | Check transaction status by session ID | `POST /v1/transactions/accounts` |
262
+ | `nomba_get_transaction` | Get full details of a single transaction | `GET /v1/transactions/{transactionId}` |
263
+ | `nomba_filter_transactions` | Filter transactions by type (CREDIT/DEBIT), date range | `GET /v1/transactions/filter` |
264
+
265
+ ### Bills - Electricity (3 tools)
266
+
267
+ | Tool | Description | API Endpoint |
268
+ |------|-------------|-------------|
269
+ | `nomba_get_electricity_providers` | List available electricity distribution companies | `GET /v1/bills/electricity/providers` |
270
+ | `nomba_lookup_electricity_customer` | Validate meter number and get customer name | `POST /v1/bills/electricity/customer-lookup` |
271
+ | `nomba_buy_electricity` | Purchase electricity tokens (prepaid) or pay bill (postpaid) | `POST /v1/bills/electricity/pay` |
272
+
273
+ ### Bills - Cable TV (3 tools)
274
+
275
+ | Tool | Description | API Endpoint |
276
+ |------|-------------|-------------|
277
+ | `nomba_get_cable_providers` | List available cable TV providers (DSTV, GOtv, Startimes) | `GET /v1/bills/cabletv/providers` |
278
+ | `nomba_lookup_cable_customer` | Validate smartcard/IUC number and get customer name | `POST /v1/bills/cabletv/customer-lookup` |
279
+ | `nomba_pay_cable_subscription` | Pay for a cable TV subscription | `POST /v1/bills/cabletv/pay` |
280
+
281
+ ### Bills - Betting (2 tools)
282
+
283
+ | Tool | Description | API Endpoint |
284
+ |------|-------------|-------------|
285
+ | `nomba_get_betting_providers` | List available betting platforms | `GET /v1/bills/betting/providers` |
286
+ | `nomba_fund_betting_account` | Fund a customer's betting account | `POST /v1/bills/betting/pay` |
287
+
288
+ ### Airtime & Data (3 tools)
289
+
290
+ | Tool | Description | API Endpoint |
291
+ |------|-------------|-------------|
292
+ | `nomba_buy_airtime` | Purchase airtime for a Nigerian phone number (MTN, Airtel, Glo, 9mobile) | `POST /v1/bills/airtime/pay` |
293
+ | `nomba_list_data_plans` | List available data plans for a network provider | `GET /v1/bills/data/plans` |
294
+ | `nomba_buy_data` | Purchase a data bundle for a phone number | `POST /v1/bills/data/pay` |
821
295
 
822
296
  ## Resources
823
297
 
824
- The server exposes one MCP resource:
825
-
826
298
  ### `nomba://banks`
827
299
 
828
- A cached list of all Nigerian bank codes and names in JSON format. This data changes infrequently, so the server fetches it once and caches it in memory for 24 hours before re-fetching.
829
-
830
- Clients can read this resource instead of calling the `nomba_list_banks` tool when they need to reference bank codes without making an API call each time.
831
-
832
- ---
300
+ A cached list of all Nigerian bank codes and names in JSON format. Fetched once and cached for 24 hours. Clients can read this resource instead of calling `nomba_list_banks` to avoid repeat API calls.
833
301
 
834
302
  ## Example Prompts
835
303
 
836
- Here are example prompts you can use with Claude once the server is connected:
837
-
838
- **Account Management:**
839
304
  - "What's my Nomba account balance?"
840
- - "Show me my account details"
841
- - "List all my POS terminals"
842
-
843
- **Sub-Accounts:**
844
- - "Create a sub-account called 'Lagos Branch'"
845
305
  - "List all my sub-accounts"
846
- - "What's the balance on sub-account abc-123?"
847
- - "Suspend sub-account abc-123"
848
-
849
- **Terminals:**
850
- - "Assign terminal TID123 with serial number SN456"
851
- - "Unassign terminal TID123"
852
-
853
- **Transfers:**
854
- - "What's the bank code for GTBank?"
855
- - "Look up account 0123456789 at GTBank"
856
- - "Transfer 5000 Naira to account 0123456789 at Access Bank with narration 'Payment for services'"
857
-
858
- **Payments:**
306
+ - "Transfer 5000 Naira to account 0123456789 at GTBank"
307
+ - "Look up account 0123456789 at Access Bank"
859
308
  - "Create a payment link for 10,000 Naira for customer@email.com"
860
- - "Check the status of order reference ABC123"
861
- - "Refund transaction XYZ456"
862
-
863
- **Virtual Accounts:**
864
- - "Create a virtual account named 'John Doe Payments'"
865
- - "List all my virtual accounts"
866
- - "Expire virtual account abc-def-123"
867
-
868
- **Transactions:**
869
309
  - "Show me my last 10 transactions"
870
310
  - "Show me all credit transactions from January 2024"
871
- - "Get the details of transaction TXN123"
872
- - "Check the status of transaction session ABC123"
873
-
874
- **Bills:**
875
- - "List electricity providers"
876
- - "Buy 5000 Naira electricity for meter 12345678 on Ikeja Electric prepaid"
877
- - "List cable TV providers"
878
- - "Pay DSTV subscription for smartcard 10234567890"
879
-
880
- **Airtime & Data:**
311
+ - "Create a virtual account named 'John Doe Payments'"
881
312
  - "Buy 1000 Naira airtime for 08012345678"
882
313
  - "What MTN data plans are available?"
883
- - "Buy the 1GB MTN data plan for 08012345678"
884
-
885
- ---
314
+ - "Buy 5000 Naira electricity for meter 12345678 on Ikeja Electric prepaid"
315
+ - "List cable TV providers"
886
316
 
887
317
  ## Development
888
318
 
319
+ ### Build
320
+
889
321
  ```bash
890
- git clone <repo-url>
891
- cd nomba-mcp
892
- npm install
893
322
  npm run build
894
323
  ```
895
324
 
896
- ### Scripts
325
+ ### Run tests
897
326
 
898
- | Command | Description |
899
- |---------|-------------|
900
- | `npm run build` | Compile TypeScript to `build/` and make entry point executable |
901
- | `npm run dev` | Watch mode -- recompile on file changes |
902
- | `npm start` | Run the compiled server |
903
- | `npm test` | Run all tests (Vitest) |
904
- | `npm run test:watch` | Run tests in watch mode |
905
- | `npm run lint` | Lint source files (ESLint) |
906
- | `npm run format` | Format source files (Prettier) |
907
- | `npm run type-check` | Type-check without emitting files |
327
+ ```bash
328
+ npm test
329
+ ```
908
330
 
909
- ### Testing
331
+ ### Watch mode
910
332
 
911
- The project includes 36 tests covering:
333
+ ```bash
334
+ npm run test:watch
335
+ ```
912
336
 
913
- - **`src/utils.test.ts`** -- Utility functions (jsonResponse, errorResponse, buildParams, logToolCall)
914
- - **`src/client.test.ts`** -- OAuth2 token lifecycle, 401 auto-retry, error parsing, HTTP methods
915
- - **`src/tools/tools.test.ts`** -- Representative tool handler tests, registration counts, cache TTL
337
+ ### Lint
916
338
 
917
339
  ```bash
918
- npm test
340
+ npm run lint
919
341
  ```
920
342
 
921
- ### CI
343
+ ### Format
922
344
 
923
- GitHub Actions runs lint, type-check, tests, and build on every push/PR across Node 18, 20, and 22.
345
+ ```bash
346
+ npm run format
347
+ ```
924
348
 
925
349
  ### Testing with MCP Inspector
926
350
 
927
- The [MCP Inspector](https://github.com/modelcontextprotocol/inspector) provides a browser-based UI for testing tools interactively:
928
-
929
351
  ```bash
930
- NOMBA_CLIENT_ID=your_id \
931
- NOMBA_CLIENT_SECRET=your_secret \
932
- NOMBA_ACCOUNT_ID=your_account_id \
352
+ NOMBA_CLIENT_ID=your_id NOMBA_CLIENT_SECRET=your_secret NOMBA_ACCOUNT_ID=your_account_id \
933
353
  npx @modelcontextprotocol/inspector node build/index.js
934
354
  ```
935
355
 
936
- This opens a browser where you can see all registered tools, invoke them with parameters, and inspect the responses.
937
-
938
- ### Adding New Tools
939
-
940
- 1. Create or edit a file in `src/tools/`
941
- 2. Follow the existing pattern using `server.registerTool()`
942
- 3. Import and call the registration function in `src/index.ts`
943
- 4. Run `npm run build` to compile
356
+ ### Adding new tools
944
357
 
945
- ---
358
+ 1. Create a new file in `src/tools/` or add to an existing category
359
+ 2. Follow the pattern: `registerXxxTools(server, client)` or `registerXxxTools(server, client, guard)` for financial tools
360
+ 3. Import and call the register function in `src/index.ts`
361
+ 4. Add `annotations` with appropriate `readOnlyHint`/`destructiveHint` values
362
+ 5. Add tests in `src/tools/tools.test.ts`
363
+ 6. Update this README
946
364
 
947
365
  ## Troubleshooting
948
366
 
949
367
  ### "Missing required environment variables"
950
368
 
951
- The server exits with this message if `NOMBA_CLIENT_ID`, `NOMBA_CLIENT_SECRET`, or `NOMBA_ACCOUNT_ID` are not set. Make sure they are configured in your Claude Desktop/Code MCP server config under the `env` key.
369
+ Ensure `NOMBA_CLIENT_ID`, `NOMBA_CLIENT_SECRET`, and `NOMBA_ACCOUNT_ID` are set in your MCP server config under the `env` key.
370
+
371
+ ### "NOMBA_BASE_URL must use HTTPS"
372
+
373
+ The server requires HTTPS by default. For local development, set `NOMBA_ALLOW_INSECURE=true`.
374
+
375
+ ### "Base URL points to production"
376
+
377
+ Set `NOMBA_PRODUCTION_CONFIRMED=true` to confirm you intend to use the production API.
952
378
 
953
379
  ### "Token issue failed (401)"
954
380
 
955
- Your client credentials are invalid. Verify your `NOMBA_CLIENT_ID` and `NOMBA_CLIENT_SECRET` on the [Nomba Developer Dashboard](https://developer.nomba.com). Also ensure your `NOMBA_ACCOUNT_ID` matches the parent account associated with those credentials.
381
+ Your client credentials are invalid. Verify your `NOMBA_CLIENT_ID` and `NOMBA_CLIENT_SECRET` on the [Nomba Developer Dashboard](https://developer.nomba.com).
956
382
 
957
383
  ### "Token issue failed (403)"
958
384
 
959
- Your account may not have the required permissions. Check your Nomba dashboard for API access settings.
385
+ Your account may not have the required API permissions. Check your Nomba dashboard for access settings.
960
386
 
961
- ### Tools not appearing in Claude
387
+ ### "Nomba API ... failed (429)"
962
388
 
963
- - **Claude Desktop:** Restart the application after updating `claude_desktop_config.json`
964
- - **Claude Code:** Restart the MCP server or reload your settings
965
- - Verify your config uses `"command": "npx"` with `"args": ["-y", "nomba-mcp"]`
389
+ You've hit the rate limit (default 15 POST requests per second). Wait a moment and retry.
966
390
 
967
- ### "Nomba API ... failed (429)"
391
+ ### "Amount exceeds per-transaction limit"
968
392
 
969
- You've hit the rate limit. The Nomba API uses a fixed-window rate limit strategy (default 75 requests/second). Wait a moment and retry.
393
+ The transaction exceeds `NOMBA_MAX_TRANSACTION` (default 100,000 NGN). Increase the limit via the environment variable if needed.
394
+
395
+ ### "Session spending cap exceeded"
396
+
397
+ Cumulative spending has exceeded `NOMBA_SESSION_SPENDING_CAP` (default 500,000 NGN). Restart the server to reset the session counter, or increase the cap.
970
398
 
971
399
  ### Sandbox vs Production
972
400
 
973
- The server defaults to the sandbox environment (`https://sandbox.nomba.com`). Sandbox transactions use test data and do not affect real accounts or move real money. To switch to production:
401
+ The server defaults to sandbox (`https://sandbox.nomba.com`). To use production, set both `NOMBA_BASE_URL=https://api.nomba.com` and `NOMBA_PRODUCTION_CONFIRMED=true`.
974
402
 
975
- ```json
976
- "NOMBA_BASE_URL": "https://api.nomba.com"
977
- ```
403
+ ### Tools not appearing
978
404
 
979
- ---
405
+ - Restart your MCP client after updating config
406
+ - Verify your config uses `"command": "npx"` with `"args": ["-y", "nomba-mcp"]`
980
407
 
981
408
  ## License
982
409
 
983
- [MIT](LICENSE)
410
+ MIT