Cupom Center

io.github.experiens由 GitHub 账号 experiens 发布v0.1.0更新于 Nov 5, 2026

Conecta agentes de IA à API REST do Cupom Center com fluxos seguros de cupons.

已验证STDIO仅桌面开发者工具商业与电商

概览

AI 生成的概览

本地 MCP 服务器,将 AI 助手接入 Cupom Center REST API,用于发现、报价、核销、查询与撤销优惠券。

可以做什么
  • 发现符合条件的优惠券,并为多单元购物车自动挑选优惠券
  • 对单个或多个优惠券代码进行校验与报价,给出权威金额并创建临时预留
  • 基于 ISSUED 类型优惠创建、查询和撤销个人优惠码
  • 原子化核销单个或多个优惠券,并登记外部已确认的支付
  • 查询操作与凭证、撤销操作,并推荐应采用的集成流程
适用场景
适合在开发或运维对接 Cupom Center 的客户端集成时使用,让助手按“发现、报价、核销、支付、撤销”的正确顺序操作,而不是自行计算折扣。也适合核对或撤销已有的优惠券操作。
运行要求
通过 npm 包以 stdio 在本地运行,需要 Node.js 20 或更高版本。需要为正确项目和环境创建的 Cupom Center API 密钥,放在 CUPOM_API_KEY 中,并具备与所用工具匹配的权限(COUPON_READ、COUPON_ISSUE、COUPON_REDEEM、PAYMENT_WRITE)。需要访问 Cupom Center API 的网络;CUPOM_API_URL 与 CUPOM_API_TIMEOUT_MS 为可选项。
安装前请注意
API 密钥决定可访问的组织,应保护宿主配置文件或从系统凭据库读取密钥。核销、发码、登记支付和撤销会改变商业状态并消耗组织的 API 额度;不会自动重试,超时后不要改动输入重发。Cupom Center 只记录支付,不扣款也不退款,撤销不会在支付服务商处转移资金。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Cupom Center,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

Cupom Center MCP

Servidor MCP local que ajuda agentes de IA a integrar sistemas clientes à API REST do Cupom Center.

O servidor roda no computador do cliente por stdio. Ele não hospeda modelo de IA e não abre uma porta de rede: recebe chamadas MCP do host local e acessa https://api.cupom.center com a API key do projeto.

O que ele faz

Além de representar os endpoints REST como ferramentas MCP, o servidor ensina o agente a seguir o ciclo correto:

  1. descobrir cupons elegíveis sem reservar ou consumir;
  2. calcular o desconto e reservar uma quote temporária;
  3. confirmar o resgate com o mesmo contexto;
  4. registrar pagamento somente após confirmação externa;
  5. consultar e reconciliar a operação;
  6. reverter usos e budgets sem fingir que movimentou dinheiro.

recommend_integration_flow decide o fluxo sem chamar a API e sem consumir a franquia do Cupom Center. As demais ferramentas acessam a REST e estão sujeitas ao rate limit e à medição de consumo da organização.

Requisitos

  • Node.js 20 ou superior;
  • uma API key criada para o projeto e ambiente corretos no Cupom Center;
  • permissões compatíveis com as ferramentas usadas.
OperaçãoPermissão
Descoberta, consulta de operaçãoCOUPON_READ
Emissão, consulta e revogação de código individualCOUPON_ISSUE e COUPON_READ
Quote, resgate e reversãoCOUPON_REDEEM
Pagamento no resgate ou posteriorPAYMENT_WRITE

Organização, ambiente e projeto são sempre derivados da API key. O MCP não permite selecionar outro tenant por argumento.

Desenvolvimento local

bash
cd mcpbun installbun run build

Instalação publicada

Depois da publicação no npm, fixe uma versão no host MCP:

json
{  "mcpServers": {    "cupom-center": {      "command": "npx",      "args": ["-y", "@cupom_center/[email protected]"],      "env": {        "CUPOM_API_KEY": "cpm_..."      }    }  }}

As instruções de release, npm Trusted Publishing e MCP Registry estão em PUBLISHING.md.

Configure o host MCP para executar o arquivo compilado usando um caminho absoluto:

json
{  "mcpServers": {    "cupom-center": {      "command": "node",      "args": ["/caminho/absoluto/para/Cupom/mcp/dist/index.js"],      "env": {        "CUPOM_API_KEY": "cpm_...",        "CUPOM_API_URL": "https://api.cupom.center"      }    }  }}

CUPOM_API_URL é opcional e usa https://api.cupom.center por padrão. HTTP só é aceito para localhost, facilitando desenvolvimento sem permitir credenciais em conexões remotas inseguras.

CUPOM_API_TIMEOUT_MS é opcional, usa 20 segundos por padrão e aceita valores entre 1.000 e 120.000 ms.

O servidor pode iniciar sem uma API key para consultar o guia e executar recommend_integration_flow. As ferramentas que acessam a REST retornarão um erro de configuração até CUPOM_API_KEY ser definida.

Para produção, prefira que o instalador recupere a API key do cofre de credenciais do sistema operacional. Configurá-la diretamente no JSON do host é simples, mas exige proteger esse arquivo contra leitura, backup ou compartilhamento indevido.

Ferramentas

  • recommend_integration_flow
  • find_eligible_coupons
  • quote_single_coupon
  • quote_multiple_coupons
  • select_coupons_for_units
  • create_coupon_issuance
  • get_coupon_issuance
  • revoke_coupon_issuance
  • redeem_single_coupon
  • redeem_multiple_coupons
  • get_coupon_operation
  • record_operation_payment
  • reverse_operation

O recurso MCP cupom://integration-guide contém as regras de decisão compartilhadas pelo servidor.

Segurança e retries

  • O servidor nunca escreve a API key em logs ou respostas.
  • stdout é reservado exclusivamente ao protocolo MCP; diagnósticos usam stderr.
  • Requisições com efeito comercial não recebem retry automático.
  • Depois de timeout, não altere os dados e tente novamente às cegas.
  • Emissão usa Idempotency-Key; repetir a mesma chave exige o mesmo comando.
  • Resgates devem preservar carrinho, contexto, códigos, ordem, estratégia, quote e pagamento.
  • Cupom Center registra pagamentos confirmados pelo cliente, mas não cobra nem estorna dinheiro.
  • Reversões são integrais e liberam usos e budgets; o estorno financeiro continua sendo responsabilidade do provedor de pagamento do cliente.

O MCP não administra cupons, campanhas, organizações, membros ou API keys. Essas operações pertencem à superfície GraphQL autenticada do painel.

Validação

bash
bun run typecheckbun run build

O projeto evita testes unitários isolados. A validação de protocolo deve ser feita conectando o binário compilado a um cliente MCP ou ao MCP Inspector, e a validação da REST deve usar um ambiente/projeto de homologação.

来源:README.md,提交 8367e7d

工具

13

recommend_integration_flow

Recommend Cupom Center integration flow

Choose the correct Cupom Center workflow before making API calls. This tool is local, has no commercial effect, and consumes no Cupom Center API allowance. Use it whenever it is unclear whether to discover, quote, issue, redeem, record payment, inspect, or reverse.

输入参数business_goal必填payment_confirmedoperation_id_known

find_eligible_coupons

Find eligible coupons

Discover coupons whose configured rules match the known customer/cart context. This does not calculate final totals, reserve budget, or consume a coupon. Missing context intentionally excludes coupons that require that fact. public defaults to true.

输入参数contextpagination

quote_single_coupon

Calculate and reserve one coupon

Validate a known coupon code against the current cart, calculate authoritative totals, and create a temporary quote reservation. Use before redeeming or displaying a final discount. Do not use for catalog discovery.

输入参数cart_idcontext必填coupon_code必填

quote_multiple_coupons

Calculate and reserve multiple coupons

Validate and calculate 2–10 known coupon codes. code_order stacks sequentially in supplied order; highest_discount_per_product applies only the best coupon to each product. Every supplied code must be eligible and applied.

输入参数cart_idcontext必填selection必填coupon_codes必填

select_coupons_for_units

Select coupons per unit

Automatically select public coupons for 1–20 marketplace/store units. Use only when a cart is partitioned into units and the integration wants Cupom Center to choose by coverage or total discount. This is not for validating a known code.

输入参数mode必填units必填contextprioritymax_coupons_per_unit

create_coupon_issuance

Issue an individual coupon code

Create an individual code from an existing coupon configured with ISSUED distribution, typically for cart recovery, CRM, or individualized delivery. This never creates discount rules. Requires COUPON_ISSUE and a stable idempotency key.

输入参数cart必填subject必填metadatashippingcoupon_id必填valid_untilidempotency_key必填external_reference必填

get_coupon_issuance

Get coupon issuance

Read the current state and immutable commercial details of an individual issued code.

输入参数issuance_id必填

revoke_coupon_issuance

Revoke coupon issuance

Revoke one active individual issuance. This is idempotent but cannot reactivate a consumed or expired code. Use only when the individual code must no longer be accepted.

输入参数issuance_id必填

redeem_single_coupon

Redeem one coupon

Confirm one coupon as a commercial operation. Normally call after quote_single_coupon and send the same cart/context. Provide cart_id, context.user.id, or quote_id for correlation. Include payment only after external confirmation; Cupom Center does not charge money.

输入参数cart_idcontext必填paymentorder_idquote_idcoupon_code必填

redeem_multiple_coupons

Redeem multiple coupons

Atomically confirm 2–10 coupons previously calculated together. Preserve code order and selection strategy from the quote. Either all applicable uses/budgets confirm or none do.

输入参数cart_idcontext必填paymentorder_idquote_idselection必填coupon_codes必填

get_coupon_operation

Get coupon operation

Inspect a redemption operation, immutable receipts, current payment, and reversals. Use for reconciliation and as the first recovery step after a timeout when operation_id is known.

输入参数operation_id必填

record_operation_payment

Record confirmed operation payment

Record an integral payment that an external payment provider has already confirmed. This does not charge or capture money and does not consume coupons again. Requires PAYMENT_WRITE.

输入参数payment必填operation_id必填

reverse_operation

Cancel or refund a coupon operation

Fully reverse one coupon operation and release its usage counters and budgets. The backend classifies it as cancellation without payment or refund with confirmed payment. This does not move money at the payment provider and accepts no reason or partial amount.

输入参数operation_id必填

版本历史

1
  1. v0.1.0最新Nov 4, 2026

评分

已满足适用检查项的 90%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分
  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分