Skip to main content
Commerce orchestration for AI agents

Your agent decides where money goes.We make sure it gets there.

CodeSpar is the commerce stack your agent runs on. Policies, mandates, cross-border routing, escrow, reconciliation, audit. The infrastructure that turns a chatbot into something that can actually move money.

app.codespar.dev/router
LivePayment Router
tx_8f2a91 · agent.checkout
From$2,000USA · USD
ToR$ 10,260Brasil · BRL
Execution pipeline
01
Policy checkpending
02
Mandate verifypending
03
Route selectionpending
04
Execute via railpending
05
Audit & sealpending
USDCsettled in 1 min · cheapest route
− $56.30
6
Meta-tools
<1s
Route decision
100%
Audit trail
Zero
Raw keys exposed
Built for

Teams moving money on behalf of someone else.

Marketplaces
Paying sellers, splitting fees, holding escrow.
Fintechs
Issuing mandates, routing payouts, reconciling.
SaaS
Charging in local currency, issuing fiscal docs.
AI-native startups
Embedding commerce inside the agent conversation.
One platform. Two ways in.

Free tools to start.Orchestration when you scale.

Open Source

MCP Servers

Every LatAm API your agent needs, wrapped as an MCP server. npm install, configure env vars, your agent transacts. Free and MIT licensed.

Payments — Zoop, Asaas, PagSeguro, Stripe ACP, Pix
Fiscal — NF-e, NFS-e, NFC-e via Nuvem Fiscal, Focus NFe
Logistics — Melhor Envio, Correios, VTEX
Communication — Z-API, Evolution API, Zenvia
Banking — Stark Bank, Open Finance
ERP — Omie, Bling, Tiny
$ npm install @codespar/mcp-zoop
Enterprise

Commerce Orchestration

The Complete Loop. One agent, six APIs, zero human intervention. Policies, mandates, routing, escrow, audit — managed.

Complete Loop — cobrar → NF-e → despachar → notificar → ERP → conciliar
Payment Router — every rail, 12 currencies, cheapest route
Programmable Wallets — per-agent fund pools, mandate-gated debits
Policy Engine — per-agent budgets, deny-lists, time windows
HMAC Mandates — signed, time-limited, revocable
Escrow — milestone-based release, dispute resolution
Audit Trail — immutable hash chain, export-ready
Talk to us
Server catalog

Every rail. One catalog.Every API your agent needs to transact in LatAm.

Browse all servers
CodeSpar SDK

Give your AI agents
commerce superpowers

One SDK. Payments, invoices, shipping, notifications, ERP. Across Latin America. Five lines to run the Complete Loop.

agent-checkout/session.ts
session.ts×
mandate.ts
policy.ts
1import { codespar } from "@codespar/sdk";
2 
3// One session. Every commerce primitive.
4const session = await codespar.create({
5 preset: "brazilian",
6});
7 
8await session.send(
9 "Charge R$ 150 via Pix and issue the NF-e"
10);
11 
12// ✓ 58s · sealed · receipt rcp_8f2a91
TerminalRunning
$ npm run dev
session created · user_123 · brazilian preset
policy OK · mandate signed · route Pix
R$ 150,00 charged · NF-e 00421 issued
audit sealed · rcp_8f2a91 · 58s total
01

Session-first DX

One line to create a session. One line to send a message. Your agent gets payments, invoicing, shipping, messaging, ERP, and banking in a single call.

01
const session = await codespar.create(
  "user_123",
  { preset: "brazilian" }
);

const result = await session.send(
  "Charge R$150 via Pix and issue the NF-e"
);
02

6 Meta Tools, Not 99

A full commerce preset has 99 raw MCP tools. We compress them into 6 meta tools that route dynamically. Your agent sees clear categories, not noise.

02
codespar_discover   // products, services
codespar_checkout   // cart, payment
codespar_pay        // direct payment + policy
codespar_invoice    // NF-e, CFDI
codespar_ship       // labels, tracking
codespar_notify     // WhatsApp, email
03

Managed Auth

OAuth, API keys, token refresh, lifecycle management. Connect once per provider. The SDK handles credentials, refresh, and storage.

03
// API key auth
await session.authorize("asaas", {
  token: "..."
});

// OAuth2 flow
const url = codespar.authManager
  .getConnectUrl("stripe");
04

Framework Agnostic

Works with Claude, OpenAI, Vercel AI SDK, or any MCP client. Swap models based on cost or capability. Your tools and auth carry over.

04
// Claude Agent SDK
import { getTools } from "@codespar/claude-agent-sdk";

// OpenAI
import { getTools } from "@codespar/openai";

// Vercel AI SDK
import { getTools } from "@codespar/vercel-ai";

// Or use MCP directly
const { url, headers } = session.mcp;
MCP Generator

Point it at your code.Get an MCP server.

No OpenAPI spec. No hand-written schemas. CodeSpar reads your Express, Fastify, or Next.js codebase and generates a production-ready MCP server your agent can use immediately.

Interactive DemoScanning
src/routes/users.tsExpress
import express from "express";
const app = express();
/** Get user by ID */
app.get("/api/users/:id", getUser);
/** Create a new user */
app.post("/api/users", createUser);
/** Update profile */
app.put("/api/users/:id", updateUser);
/** List all orders */
app.get("/api/orders", listOrders);
/** Delete user */
app.delete("/api/users/:id", deleteUser);
Generated MCP Tools0 tools
Ready
The Complete Loop

From intent to ledger.One function call.

Your agent says it once. CodeSpar orchestrates all six providers, confirms every result, and seals the transaction in an immutable ledger. No callbacks, no cron jobs, no reconciliation spreadsheet.

01
Charge
R$ 150 · Pix
02
Invoice
NF-e 00421
03
Ship
Melhor Envio
04
Notify
WhatsApp delivered
05
Sync ERP
Omie synced
06
Reconcile
Ledger sealed
agent-checkout.ts
const result = await session.send(
  "Charge R$ 150 via Pix, issue the NF-e, dispatch with Melhor Envio,
   notify on WhatsApp, and post it all to Omie."
);
Running…receipt: rcp_8f2a91
How it works

Five guardrails. One command.

Every payment your agent initiates passes through five governance layers. Programmable, signed, and audit-ready by construction.

01Policy

Per-agent budgets, deny-lists, time windows. Your CFO writes the rules.

02Mandate

HMAC-signed tokens with TTL, amount caps, purpose. Revocable instantly.

03Route

Cheapest rail every time. Cost-optimized across providers and currencies.

04Execute

Idempotency keys, rollback plans, no orphan transactions.

05Audit

Immutable hash chain. Tamper-evident. SIEM and auditor exports built in.

Featured use case

Autonomous fulfillment for LatAm marketplaces.

An agent watches the order stream, charges the buyer on the cheapest local rail, issues the fiscal doc, prints a Melhor Envio label, notifies the buyer on WhatsApp, and reconciles it all into the ERP. End-to-end, unattended, audit-sealed.

See more use cases
The loop · order #8421Live
01
Charge
02
Invoice
03
Dispatch
04
Notify
05
Sync ERP
06
Reconcile
✓ Loop sealed · 58srcp_8f2a91
Early builders

Teams shipping agents that actually move money.

We were quoted R$ 200k to build cross-border FX routing in-house. CodeSpar handled USDC, Pix and Wire in one afternoon. The ROI was not even close.
Ricardo Nakamura
Co-founder at a multi-currency SaaS
Curitiba · BR
We had three engineers gluing Pix, Stripe and our ERP together. CodeSpar collapsed that into one SDK call. Our agent closes the loop end-to-end now.
Camila Ferreira
CTO at a cross-border marketplace
São Paulo · BR
The mandate system alone was worth the migration. Our CFO finally signed off on letting agents move money because she can see — and revoke — every policy in real time.
Diego Restrepo
Head of Payments at a LatAm fintech
Bogotá · CO
FAQ

Your questions, answered.

Yes. The SDK and MCP servers are live on npm today. The orchestration layer — policies, mandates, routing, escrow, audit — runs in dev environments with early builders and is hardened for regulated use. Active roadmap is published on GitHub.

The MCP servers and the SDK are free and MIT-licensed — install from npm, configure env vars, and transact. The orchestration layer (mandates, policy engine, audit ledger) is per-transaction pricing for teams that want it managed. See /pricing.

Brazil is fully covered today — Pix, NF-e, Melhor Envio, Z-API / Evolution, Omie / Bling, Stark Bank, Open Finance. Mexico, Argentina, and Colombia are rolling out next. USD and USDC supported globally via Circle and Stripe.

Stripe ACP is one rail. A raw MCP server is one integration. CodeSpar bundles dozens of rails and APIs behind one SDK, with policies, signed mandates, and an immutable audit ledger — the pieces an agent actually needs to move money safely. The servers themselves are swappable and MIT.

Yes. First-class adapters for Claude Agent SDK, OpenAI, and Vercel AI SDK. Anything else that speaks MCP works out of the box — sessions, tools, and credentials carry over when you swap models.

Policies prevent most mistakes before they happen: spend limits, deny-lists, time windows, per-agent budgets. Mandates are HMAC-signed and revocable in one call. Every decision — check, route, execute, fail — is written to an immutable hash chain. High-risk ops (prod deploys, migrations) always require human approval.

The MCP servers and SDK are self-hostable today — they are npm packages, you run them. The managed orchestration layer is hosted by default; self-hosted enterprise deployments are on the roadmap.

We believe the tools that move money should be auditable.

Every MCP server, every tool — MIT licensed and published on npm. Every line of code is public. Every wrapper is tested. Every integration is production-ready. codespar.dev/open-source

Explore

Your agent is ready to run the business.Is your stack?

Start free on open source. Upgrade when you need the orchestration layer.