Clearsale

Finance and commerce

MCP server for ClearSale, Brazilian fraud prevention, order risk scoring, device fingerprinting.

Your AI app calls the Clearsale MCP server, which does the finance and commerce work and sends the result back to the chat.

About Clearsale

Clearsale is a community MCP server from codespar, filed in our directory under finance and commerce. MCP server for ClearSale, Brazilian fraud prevention, order risk scoring, device fingerprinting.

Clearsale runs on your own machine: your AI app starts it with the command npx -y @codespar/mcp-clearsale@0.2.0-alpha.3 and talks to it over standard input and output. It needs CLEARSALE_API_KEY set before Clearsale starts.

Clearsale is listed in the official MCP registry as io.github.codespar/mcp-clearsale, version 0.2.0-alpha.3.

At a glance

Publisher
codespar (community)
Runs
Locally on your machine
Install from
Node.js package on npm: @codespar/mcp-clearsale
Written in
TypeScript
License
MIT
GitHub stars
278
Official MCP registry
io.github.codespar/mcp-clearsale

How to set up Clearsale

  1. Install Node.js on the machine that runs your AI app, because Clearsale starts with npx and downloads its package on first run.
  2. Create CLEARSALE_API_KEY for Clearsale in the connected service's own settings, scoped to the smallest permissions the job needs.
  3. Add Clearsale to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Clearsale tools to confirm the connection.
  5. Run one read-only task with Clearsale first, and keep your app asking before each tool call until the results look right.

Clearsale compared with similar servers

  • Clip by codespar has fewer GitHub stars than Clearsale (278 against 278); both are community servers, and both run locally.
  • Circle by codespar has fewer GitHub stars than Clearsale (278 against 278); both are community servers, and both run locally.
  • Cobre by codespar has fewer GitHub stars than Clearsale (278 against 278); both are community servers, and both run locally.

Before you connect Clearsale

  • Give Clearsale its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Clearsale tool call until you trust what it does with them.
  • Treat text that Clearsale fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Clearsale on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Clearsale

How marketing and sales teams put Clearsale to work, by company size. Pick the size closest to yours and start Clearsale on one use case.

Small business

  • A small business can ask Clearsale which products and customers drive margin, then plan promotions around them.
  • Owners can use Clearsale to check refunds, failed payments and churn reasons without opening three dashboards.
  • Clearsale runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Ecommerce teams can connect Clearsale to tie campaigns to orders and revenue, not just clicks.
  • Marketing and finance can use Clearsale to check spend against budget each week and move money to what's working.
  • Start Clearsale on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprises should keep Clearsale read-only for agents, with any money movement handled by people and existing approvals.
  • Large commerce teams can use Clearsale to answer revenue questions by channel and region with figures finance signs off on.
  • Clearsale is a community server, so have security review the code and pin a version before Clearsale touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Clearsale README

From codespar/mcp-dev-latam on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

@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)

Tool Purpose
send_order_for_analysis Submit an order to ClearSale for fraud analysis.
get_order_analysis Retrieve the current analysis state of an order previously sent to ClearSale.
update_order_status Notify ClearSale of the merchant's final decision on an order (APROVADO / CANCELADO / DEVOLVIDO).
list_orders List orders submitted to ClearSale with optional filters.
create_chargeback_notification Report a confirmed chargeback back to ClearSale.
get_order_score Fetch only the fraud score (numeric 0-100) for an order.
create_device_fingerprint_session Start a device fingerprint session.
get_device_fingerprint Retrieve captured device characteristics for a fingerprint session (OS, browser, timezone, canvas/WebGL has...
resolve_manual_review Manually resolve an order currently in EM_ANALISE by approving or declining it.
get_score_by_document Look up the risk score and historical signals associated with a Brazilian document (CPF or CNPJ).
get_score_by_contact Look up the risk score for a contact identifier (email or phone).
validate_document KYC: validate a CPF or CNPJ against Receita Federal.
validate_address KYC: validate a Brazilian postal address against the Correios database.
track_behavior_event Log a behavior signal (page view, login, signup, custom event) tied to a fingerprint session.
issue_challenge Issue an authentication challenge (OTP via SMS/email or KBA question) to a buyer.
validate_challenge_response Verify a buyer's response to a challenge issued via issue_challenge.
create_case Open a fraud investigation case (e.g.
update_case Update 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

Questions about Clearsale

What is the Clearsale MCP server?

MCP server for ClearSale, Brazilian fraud prevention, order risk scoring, device fingerprinting. Clearsale is maintained by codespar on GitHub at codespar/mcp-dev-latam, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Clearsale MCP server?

Add Clearsale to your AI app's MCP config with the command npx -y @codespar/mcp-clearsale@0.2.0-alpha.3. In Claude Code, run claude mcp add --transport stdio codespar-clearsale -- npx -y @codespar/mcp-clearsale@0.2.0-alpha.3. To run Clearsale this way you need Node.js installed.

Does Clearsale need an API key?

Yes. Clearsale expects CLEARSALE_API_KEY to be set. Create the key for Clearsale in the connected service's own settings, give it the smallest permissions the job needs, and keep it out of shared config files.

Is Clearsale an official MCP server?

No. Clearsale is a community server maintained by codespar. Community servers can be excellent; read the code and the open issues before you give Clearsale access to company data.

What license is Clearsale under?

Clearsale is released under the MIT license, according to its GitHub repository. The license covers the code of Clearsale; the service it connects to has its own terms.