mcp-nexi-pos-api

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.

Category
访问服务器

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 = 100
  • EUR 1.00 = 100
  • JPY 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 returns PROCESSING.
  • create_refund - low-level refund call.
  • confirm_transaction - confirm a purchase or refund result.
  • get_transaction - fetch a transaction by external_id and 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

  1. Set the terminal ID once:
{ "terminal_id": "YOUR_TERMINAL_ID" }
  1. 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:

  1. Call set_terminal_id if the session terminal ID was lost.
  2. Call get_transaction with the known external_id.
  3. Call get_unconfirmed_transactions for the terminal.
  4. If needed, call confirm_transaction with the correct result_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:

  • 100 for SEK 1.00
  • 200 for SEK 2.00
  • 500 for SEK 5.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.ts exporting getConfig() with API, currency, max amount, and storage path settings.
  • src/nexi-client.ts exporting NexiClient with purchase, refund, confirm, getTransaction, and getUnconfirmedTransactions methods.
  • src/storage/sqlite-store.ts exporting SQLiteStore with saveIntent, updateTransaction, and markConfirmed methods.

These modules are intentionally separate from the MCP tool code so the API client and storage can be tested independently.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选