Lfwin Payment Mcp

by litsen

168 downloads
Not rated
GitHub

About

LFWin Payment MCP Server 是一个面向 AI Agent 的支付能力服务,通过标准 MCP 协议,将创建支付订单、查询支付状态、发起退款、查询退款状态等能力开放给 Cursor、Cline、Claude Desktop、企业智能助手和自研 Agent 应用。

Details

Author
litsen
Downloads
168
Categories
AI

- Create unified checkout payment orders with pay URL and QR code
- Query payment order status by platform order number
- Initiate refunds against completed payment orders
- Query refund status by platform order and merchant refund number
- Provides both Python and Node.js implementations with identical tools

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Lfwin Payment Mcp
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Install the Node.js version via npx -y @litsen/lfwin-payment-mcp or the Python version via pip install git+https://github.com/litsen/lfwin-payment-mcp.git. Configure environment variables PAYMENT_API_KEY and PAYMENT_SIGN_KEY, then add a stdio MCP server entry in your client (Cursor, Cline, etc.) pointing to the appropriate command.

create_payment_order

Create a cashier payment order. Amount is in yuan and merchant_order_no is the merchant's own unique order number. After success, display pay_qrcode_markdown, the returned image content block, pay_qrcode_image data URL, or pay_qrcode_base64 with pay_qrcode_mime_type as the QR code. If QR rendering fails, show pay_url/qrcode as the fallback payment link. Save order_no/query_order_no when present. If order_no is null, save merchant_order_no plus order_time and use both for query_payment_order polling.

query_payment_order

Query payment order status. Prefer platform order_no/orderid when create_payment_order returned it. If order_no is null, pass merchant_order_no plus order_time returned by create_payment_order. Pass either order_no or the merchant pair.

refund_payment_order

Create a refund request by platform order_no/orderid. mch_refund_no is the merchant refund number and must be unique per refund. Successful submission means accepted/processing, not final refund success; call query_refund_status to confirm.

query_refund_status

Query refund status by platform order_no/orderid. Pass mch_refund_no when available to locate a specific partial refund. Only REFUNDED is final success; REFUNDING/PROCESSING means query again later.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "lfwin payment mcp": {
            "lfwin-payment-mcp": {
                "command": "npx",
                "args": [
                    "-y",
                    "@litsen/lfwin-payment-mcp"
                ]
            }
        }
    }
}

McpServers

{
    "lfwin-payment-mcp": {
        "command": "npx",
        "args": [
            "-y",
            "@litsen/lfwin-payment-mcp"
        ]
    }
}

LFWin 支付 MCP Server - AI原生支付网关(收银台/退款/查单)

LFWin Payment MCP Server 是一个面向 AI Agent 的支付能力服务,通过标准 MCP 协议,将创建支付订单、查询支付状态、发起退款、查询退款状态等能力开放给 Cursor、Cline、Claude Desktop、企业智能助手和自研 Agent 应用。 项目同时保留两种实现: - Python 版:位于 payment_mcp/,适合已有 Python 环境的用户。 - Node.js 版:位于 node-mcp/,适合通过 npx 快速启动,推荐给普通 MCP 使用者。 两种实现提供相同的 MCP 工具能力,用户可以按自己的环境选择安装方式。 获取支付权限或密钥,请联系服务商客服。

功能

- create_payment_order:创建统一收银台支付订单 - query_payment_order:查询支付订单状态 - refund_payment_order:发起退款 - query_refund_status:查询退款状态 创建支付订单时只会调用统一收银台接口生成一次订单,并返回支付链接和二维码图片: - pay_url:统一收银台支付跳转链接 - qrcode:同 pay_url,用于兼容需要扫码内容的调用方 - pay_qrcode_image:基于 pay_url 生成的二维码 PNG 图片 data:image/png;base64,... 地址 - pay_qrcode_markdown:可直接展示的 Markdown 图片文本

环境变量

两种实现都需要以下环境变量: ``env PAYMENT_API_KEY=your_api_key_here PAYMENT_SIGN_KEY=your_sign_key_here ` 通常只需要配置 PAYMENT_API_KEYPAYMENT_SIGN_KEY

安装方式一:Node.js 版

推荐普通用户使用 Node.js 版。发布到 npm 后,可以直接通过
npx 启动: `bash npx -y @litsen/lfwin-payment-mcp ` Cursor 配置示例: `json { "mcpServers": { "payment-mcp": { "type": "stdio", "command": "npx", "args": ["-y", "@litsen/lfwin-payment-mcp"], "env": { "PAYMENT_API_KEY": "your_api_key_here", "PAYMENT_SIGN_KEY": "your_sign_key_here" } } } } ` 本地源码调试 Node.js 版: `bash cd node-mcp npm install npm run build node dist/index.js ` 更多说明见 node-mcp/README.md

安装方式二:Python 版

如果你已经有 Python 3.12 或更高版本,也可以使用 Python 版。 从 GitHub 安装:
`bash pip install git+https://github.com/litsen/lfwin-payment-mcp.git ` 安装完成后会得到 MCP 启动命令: `bash payment-mcp ` Cursor 配置示例: `json { "mcpServers": { "payment-mcp": { "type": "stdio", "command": "cmd", "args": ["/c", "payment-mcp"], "env": { "PAYMENT_API_KEY": "your_api_key_here", "PAYMENT_SIGN_KEY": "your_sign_key_here" } } } } ` 源码开发时也可以这样运行: `bash pip install -r requirements.txt python -m payment_mcp.mcp_stdio `

Cline 配置

Node.js 版:
`json { "mcpServers": { "payment-mcp": { "command": "npx", "args": ["-y", "@litsen/lfwin-payment-mcp"], "env": { "PAYMENT_API_KEY": "your_api_key_here", "PAYMENT_SIGN_KEY": "your_sign_key_here" }, "disabled": false } } } ` Python 版: `json { "mcpServers": { "payment-mcp": { "command": "cmd", "args": ["/c", "payment-mcp"], "env": { "PAYMENT_API_KEY": "your_api_key_here", "PAYMENT_SIGN_KEY": "your_sign_key_here" }, "disabled": false } } } `

工具参数

create_payment_order

创建支付订单。 参数: -
merchant_order_no:商户订单号,必须唯一 - amount:支付金额,单位为元 - currency:币种,默认 CNY - channel:支付渠道,默认 comm - subject:订单说明 - notify_url:异步通知地址,可选 返回结果中的 pay_qrcode_markdown 可以直接让 AI 输出给用户,用于扫码支付。

query_payment_order

查询支付订单状态。 参数: -
order_no:平台订单号

refund_payment_order

发起退款。 参数: -
order_no:平台订单号 - refund_amount:退款金额,单位为元 - reason:退款原因 - mch_refund_no:商户退款单号,必须唯一

query_refund_status

查询退款状态。 参数: -
order_no:平台订单号 - mch_refund_no:商户退款单号,可选

发布

Python 版构建 wheel 包:
`bash pip install build python -m build ` Node.js 版发布 npm 包: `bash cd node-mcp npm login npm publish --access public `

安全说明

- 不要把真实的
PAYMENT_API_KEYPAYMENT_SIGN_KEY 提交到 GitHub。 - 建议通过环境变量、IDE Secret 或服务器密钥管理系统注入密钥。 - 本项目默认使用 stdio` 方式作为本地 MCP 服务运行。 - 如果要部署成远程 MCP 服务,请自行增加认证、租户隔离、访问控制和 Origin 校验。

演示示例

如Cursor安装后,可选择启用哪些能力 image 智能体调用时会自动生成对应的支付订单,可引导用户扫码完成支付 发起支付: image 发起退款: image
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.