Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

@codespar/sdk

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codespar/sdk

Commerce SDK for AI agents — sessions, managed auth, Complete Loop orchestration for Latin American APIs

Source
npmnpm
Version
0.2.2
Version published
Maintainers
1
Created
Source

@codespar/sdk

Commerce SDK for AI agents — sessions, managed auth, Complete Loop orchestration for Latin American commercial APIs.

Install

npm install @codespar/sdk

Usage

import { CodeSpar } from "@codespar/sdk";

const cs = new CodeSpar({ apiKey: "ak_..." });

const session = await cs.create("user_123", {
  preset: "brazilian",
  manageConnections: { waitForConnections: true },
});

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

// Direct tool execution
const charge = await session.execute("ZOOP_CREATE_CHARGE", {
  amount: 150.0,
  payment_type: "pix",
});

// Complete Loop
const loop = await session.loop({
  steps: [
    { server: "mcp-zoop", tool: "ZOOP_CREATE_CHARGE", params: { amount: 150, payment_type: "pix" } },
    { server: "mcp-nuvem-fiscal", tool: "NUVEMFISCAL_EMITIR_NFE", params: (prev) => ({ chargeId: prev[0].data }) },
    { server: "mcp-melhor-envio", tool: "MELHORENVIO_GENERATE_LABEL", params: {} },
    { server: "mcp-z-api", tool: "ZAPI_SEND_MESSAGE", params: { text: "Your order is on the way!" } },
  ],
  onStepComplete: (step, result) => console.log(`✓ ${step.tool}`),
  retryPolicy: { maxRetries: 3, backoff: "exponential" },
});

API

new CodeSpar(config)

OptionTypeDefaultDescription
apiKeystringCODESPAR_API_KEY envYour API key
baseUrlstringhttps://api.codespar.devAPI base URL
managedbooleantrueEnable managed billing/logging

cs.create(userId, config)

OptionTypeDescription
serversstring[]MCP servers to connect
presetstring"brazilian", "mexican", "argentinian", "colombian", "all"
manageConnections.waitForConnectionsbooleanBlock until all servers connected

Session Methods

MethodDescription
session.tools()Get all available tools
session.findTools(intent)Search tools by description
session.execute(tool, params)Execute a specific tool
session.send(message)Send natural language message
session.loop(config)Run Complete Loop workflow
session.authorize(serverId)Start OAuth flow for a server
session.connections()List connected servers
session.mcpMCP transport URL and headers
session.close()Close session

Need more?

For production workloads with governance, audit trails, policy engines, self-hosted runtimes, and enterprise commerce primitives (mandates, escrow, payment routing), see CodeSpar Enterprise.

License

MIT — codespar.dev

Keywords

ai-agent

FAQs

Package last updated on 19 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts