mcp-nexi-pos-api
An MCP server for Nexi POS payment operations, enabling creation of purchases and refunds, polling payment states, confirming transactions, and recovering unconfirmed transactions.
README
mcp-nexi-pos-api
MVP MCP server for Nexi POS payment operations.
It provides tools to create purchases and refunds, poll payment state, confirm transactions, and recover unconfirmed transactions.
Setup
From npm package
npm install -g mcp-nexi-pos-api
mcp-nexi-pos-api
From source
npm install
npm run build
npm start
Create a local .env file:
NEXI_POS_API_KEY_ID=your-api-key-id
NEXI_POS_API_KEY_SECRET=your-api-key-secret
NEXI_POS_BASE_URL=https://api.sandbox.npay.eu/pos/v1
NEXI_POS_DEFAULT_CURRENCY=SEK
NEXI_POS_MAX_AMOUNT_MINOR=500
NEXI_POS_USER_AGENT=mcp-nexi-pos-api/0.1.0
NEXI_POS_STORAGE_PATH=./data/nexi-pos.sqlite
Environment variables
| Variable | Description | Default |
|---|---|---|
NEXI_POS_API_KEY_ID |
Nexi Basic Auth username. | Required |
NEXI_POS_API_KEY_SECRET |
Nexi Basic Auth password. | Required |
NEXI_POS_BASE_URL |
Nexi POS API base URL. | https://api.sandbox.npay.eu/pos/v1 |
NEXI_POS_DEFAULT_CURRENCY |
Currency used when a tool omits currency. |
SEK |
NEXI_POS_MAX_AMOUNT_MINOR |
Safety limit in minor units. | 500 |
NEXI_POS_USER_AGENT |
User agent sent to Nexi. | mcp-nexi-pos-api/0.1.0 |
NEXI_POS_STORAGE_PATH |
SQLite file for local recovery state. | ./data/nexi-pos.sqlite |
Claude Desktop config
Example for a global npm install:
{
"mcpServers": {
"nexi-pos": {
"command": "mcp-nexi-pos-api",
"env": {
"NEXI_POS_API_KEY_ID": "your-api-key-id",
"NEXI_POS_API_KEY_SECRET": "your-api-key-secret",
"NEXI_POS_BASE_URL": "https://api.sandbox.npay.eu/pos/v1",
"NEXI_POS_DEFAULT_CURRENCY": "SEK",
"NEXI_POS_MAX_AMOUNT_MINOR": "500",
"NEXI_POS_STORAGE_PATH": "/absolute/path/to/data/nexi-pos.sqlite"
}
}
}
}
Example from source:
{
"mcpServers": {
"nexi-pos": {
"command": "node",
"args": ["/absolute/path/to/mcp-nexi-pos-api/dist/index.js"],
"env": {
"NEXI_POS_API_KEY_ID": "your-api-key-id",
"NEXI_POS_API_KEY_SECRET": "your-api-key-secret"
}
}
}
}
Amount format
All amounts are integers in ISO 4217 minor units. Do not send floating point values.
Examples:
SEK 1.00=100EUR 1.00=100JPY 1=1
The default max amount is 500, meaning SEK/EUR 5.00. Set NEXI_POS_MAX_AMOUNT_MINOR to a value that matches your test or production needs.
Tools
set_terminal_id- store a terminal ID for this MCP server session.get_session_terminal_id- show the current session terminal ID.clear_terminal_id- clear the session terminal ID.create_purchase- low-level purchase call.take_payment- high-level purchase helper that repeats while Nexi returnsPROCESSING.create_refund- low-level refund call.confirm_transaction- confirm a purchase or refund result.get_transaction- fetch a transaction byexternal_idand terminal.get_unconfirmed_transactions- list unconfirmed transactions for a terminal.
All tool responses use this JSON shape:
{
"ok": true,
"operation": "take_payment",
"terminal_id": "terminal-1",
"external_id": "order-123",
"state": "AWAITING_CONFIRM",
"result_code": "SUCCESS",
"result_description": "Approved",
"success": true,
"message": "Payment flow stopped at terminal/current state",
"transaction": {},
"raw": {}
}
ok means the MCP/API call was handled. It does not always mean the card payment succeeded. success is true only when result_code is SUCCESS.
Payment flow
- Set the terminal ID once:
{ "terminal_id": "YOUR_TERMINAL_ID" }
- Start a payment:
{
"external_id": "order-1001",
"requested_amount": 100,
"currency": "SEK"
}
For most clients, use take_payment. It calls Nexi purchase repeatedly while the state is PROCESSING, until the total timeout_seconds is reached or Nexi returns a later state such as AWAITING_CONFIRM, CONFIRMED, or COMMITTED.
If the timeout is reached while the transaction is still PROCESSING, the response includes external_id, terminal_id, and the latest state. You can later call get_transaction or call take_payment again with the same identifiers.
Confirmation
This MVP does not confirm by default.
When a transaction reaches AWAITING_CONFIRM, call confirm_transaction:
{
"external_id": "order-1001",
"result_code": "SUCCESS"
}
You can also let take_payment confirm automatically:
{
"external_id": "order-1002",
"requested_amount": 100,
"auto_confirm": true
}
Use auto_confirm only when your business flow is ready to accept the transaction result immediately.
SQLite storage and recovery
The server stores payment-relevant state in SQLite at NEXI_POS_STORAGE_PATH.
Stored data includes:
- external ID
- terminal ID
- transaction type
- currency
- requested amount
- state
- result code and description
- confirmation flag
- timestamps
- redacted raw transaction JSON
API credentials are never stored. Card-related fields should be redacted by the storage/client layer.
Recovery workflow after a restart:
- Call
set_terminal_idif the session terminal ID was lost. - Call
get_transactionwith the knownexternal_id. - Call
get_unconfirmed_transactionsfor the terminal. - If needed, call
confirm_transactionwith the correctresult_code.
SQLite improves recovery, but it is not a full production operations system. Keep your own order records and reconcile with Nexi when needed.
Simulator amount examples
Use small minor-unit amounts during simulator testing, for example:
100for SEK1.00200for SEK2.00500for SEK5.00
Keep NEXI_POS_MAX_AMOUNT_MINOR low in test environments to avoid accidental large payments.
Implementation notes for integration
The MCP tool layer expects these core modules to exist:
src/config.tsexportinggetConfig()with API, currency, max amount, and storage path settings.src/nexi-client.tsexportingNexiClientwithpurchase,refund,confirm,getTransaction, andgetUnconfirmedTransactionsmethods.src/storage/sqlite-store.tsexportingSQLiteStorewithsaveIntent,updateTransaction, andmarkConfirmedmethods.
These modules are intentionally separate from the MCP tool code so the API client and storage can be tested independently.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.