mcpField
M
mcp-clearsale

mcp-clearsale

Local
github.com/codesparSecurity275Updated 4w ago

About mcp-clearsale

mcp-clearsale is an MCP server for ClearSale, a fraud prevention provider in Brazil. It targets Brazilian ecommerce merchants and exposes order risk scoring, device fingerprinting and KYC checks as tools. It follows an analyze, decide, feedback workflow.

Key features

  1. 01Order fraud analysis and risk scoring
  2. 02Device fingerprint sessions and behavior events
  3. 03CPF, CNPJ and address KYC validation
  4. 04Manual review resolution and chargeback reporting
  5. 05Fraud investigation case creation and updates

Use cases

  1. 01Submitting checkout orders for fraud analysis before shipment
  2. 02Deciding whether to approve, block or manually review an order
  3. 03Returning final decisions and chargebacks to refine the model

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"codespar-mcp-clearsale": {
"command": "npx",
"args": [
"-y",
"@codespar/mcp-clearsale"
],
"env": {
"CLEARSALE_API_KEY": "<CLEARSALE_API_KEY>",
"CLEARSALE_BASE_URL": "<CLEARSALE_BASE_URL>"
}
}
}
}
Run commandnpx -y @codespar/mcp-clearsale
Environment variables to set
CLEARSALE_API_KEYSecretClearSale API key / bearer token used in the Authorization header
CLEARSALE_BASE_URLClearSale API base URL. Defaults to https://api.clearsale.com.br (prod). Override per contract-issued staging URL.

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@codespar/mcp-clearsale0.2.0-alpha.3

Tools

18

Saved tool list · updated 2w ago

ParameterTypeRequiredDescription
idstringYesMerchant-side order id (must be unique and stable — used to correlate future status updates and chargebacks)
ipstringYesBuyer's IP address at order time (IPv4 or IPv6)
datestringYesOrder creation timestamp in ISO-8601 (e.g. 2026-04-21T14:32:00Z)
emailstringYesBuyer's email address
itemsarrayYesLine items: each with sku, name, category, quantity, unit_price.
paymentarrayYesOne or more payment methods used on this order (card, boleto, pix). Card details MUST be tokenized — never pass a raw PAN.
session_idstringNoOptional device fingerprint session_id from create_device_fingerprint_session. Dramatically improves decision quality.
total_itemsnumberYesNumber of items in the order
total_ordernumberYesTotal order amount in BRL (major units, e.g. 199.90)
customer_billingobjectYesBilling customer: name, document (CPF/CNPJ), birth_date, phone, and address fields (street, number, city, state, zip_code).
customer_shippingobjectYesShipping customer: name, document, phone, and address fields. Same schema as customer_billing.

Details

From the project README

@codespar/mcp-clearsale

MCP server for ClearSale — Brazilian fraud prevention.

ClearSale pioneered fraud analytics in Brazil (founded 2001, São Paulo) and remains the default antifraud layer for most major BR ecommerce. This is the first entry in the CodeSpar fraud category — no other server in the catalog does fraud scoring. Future entries (Konduto, Legiti, Sift, Cybersource) will follow the same analyze → decide → feedback shape.

Tools (18)

ToolPurpose
send_order_for_analysisSubmit an order to ClearSale for fraud analysis.
get_order_analysisRetrieve the current analysis state of an order previously sent to ClearSale.
update_order_statusNotify ClearSale of the merchant's final decision on an order (APROVADO / CANCELADO / DEVOLVIDO).
list_ordersList orders submitted to ClearSale with optional filters.
create_chargeback_notificationReport a confirmed chargeback back to ClearSale.
get_order_scoreFetch only the fraud score (numeric 0-100) for an order.
create_device_fingerprint_sessionStart a device fingerprint session.
get_device_fingerprintRetrieve captured device characteristics for a fingerprint session (OS, browser, timezone, canvas/WebGL has...
resolve_manual_reviewManually resolve an order currently in EM_ANALISE by approving or declining it.
get_score_by_documentLook up the risk score and historical signals associated with a Brazilian document (CPF or CNPJ).
get_score_by_contactLook up the risk score for a contact identifier (email or phone).
validate_documentKYC: validate a CPF or CNPJ against Receita Federal.
validate_addressKYC: validate a Brazilian postal address against the Correios database.
track_behavior_eventLog a behavior signal (page view, login, signup, custom event) tied to a fingerprint session.
issue_challengeIssue an authentication challenge (OTP via SMS/email or KBA question) to a buyer.
validate_challenge_responseVerify a buyer's response to a challenge issued via issue_challenge.
create_caseOpen a fraud investigation case (e.g.
update_caseUpdate an existing fraud investigation case — change status, add notes, reassign, or attach more orders.

Install

npm install @codespar/mcp-clearsale@alpha

Environment

CLEARSALE_API_KEY="..."    # Bearer token issued by ClearSale
CLEARSALE_BASE_URL="..."   # Optional. Defaults to https://api.clearsale.com.br. Override per contract-issued staging URL.

Authentication

Server-side Bearer token:

Authorization: Bearer <CLEARSALE_API_KEY>

ClearSale issues the token via the developer portal or through your commercial contract. There is no public sandbox — staging URLs are provisioned per contract; override CLEARSALE_BASE_URL to point at it.

Typical flow

  1. On page load, the merchant calls create_device_fingerprint_session and embeds ClearSale's browser JS using the returned session_token.
  2. At checkout, the merchant calls send_order_for_analysis with the same session_id plus full order, payment, items, and billing/shipping data.
  3. The response carries a decision: APROVADO (ship it), REPROVADO (block), or EM_ANALISE (poll get_order_analysis or wait for a webhook).
  4. Once the order lifecycle completes, call update_order_status with the final merchant decision — this is required for ongoing model quality.
  5. If a chargeback arrives later, call create_chargeback_notification so ClearSale can tune its model.

Run

# stdio (default — for Claude Desktop, Cursor, etc)
npx @codespar/mcp-clearsale

# HTTP (for server-to-server testing)
MCP_HTTP=true MCP_PORT=3000 npx @codespar/mcp-clearsale

Category

fraud — first server in this CodeSpar category. Fraud servers share a common shape (analyze → decide → feedback) distinct from payments, which makes cross-provider swaps (ClearSale ↔ Konduto ↔ Legiti) more straightforward than cross-acquirer swaps.

Enterprise

Need governance, budget limits, and audit trails for agent payments? CodeSpar Enterprise adds policy engine, payment routing, and compliance templates on top of these MCP servers.

License

MIT

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.