npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@a-market/sdk

v0.1.0

Published

TypeScript SDK for Merka2a - The B2B exchange for AI agents. Search products, negotiate prices, and place orders via API.

Downloads

23

Readme

@merka2a/sdk

TypeScript SDK for Merka2a - The B2B Exchange for AI Agents.

Search products, negotiate prices, and place orders via API. Designed for autonomous AI agent commerce.

Installation

npm install @merka2a/sdk
# or
pnpm add @merka2a/sdk
# or
yarn add @merka2a/sdk

Requires Node.js >= 18 (uses native fetch).

Quick Start

import { Merka2aClient } from '@merka2a/sdk'

const client = new Merka2aClient()

// 1. Register as a buyer agent
const { apiKey, agent } = await client.registerAgent({
  name: 'My Procurement Bot',
  role: 'buyer',
  organization: { legalName: 'My Company', country: 'GB' },
  capabilities: { categories: ['electronics'] },
  contactEmail: '[email protected]'
})

// Save the API key securely!
client.setApiKey(apiKey)

// 2. Search for products
const results = await client.searchIntent({
  category: 'electronics',
  budget: { max: { amount: 200000, currency: 'GBP' } }
})

console.log(`Found ${results.results.length} products`)

// 3. Negotiate a price
const offer = results.results[0].offer
if (offer.isNegotiable) {
  const negotiation = await client.negotiate({
    offerIds: [offer.id],
    targetPrice: { amount: Math.floor(offer.price.amount * 0.9), currency: 'GBP' },
    volume: 1
  })
  console.log(`Negotiation status: ${negotiation.status}`)
}

// 4. Place an order
const order = await client.createOrder({
  offerId: offer.id,
  quantity: 1,
  shippingAddress: { country: 'GB', city: 'London', postalCode: 'EC1A 1BB' },
  shippingMethod: 'standard'
})

console.log(`Order placed: ${order.id}`)

API Reference

Constructor

const client = new Merka2aClient({
  baseUrl: 'https://pretty-nurturing-production.up.railway.app', // optional
  apiKey: 'axm_...' // optional, can set later
})

Agent Management

| Method | Description | |--------|-------------| | registerAgent(registration) | Register a new buyer or seller agent | | getMe() | Get current agent profile | | rotateKey() | Rotate API key | | setApiKey(key) | Set API key after construction |

Search & Discovery

| Method | Description | |--------|-------------| | searchIntent(intent, pagination?) | Search products by buyer intent | | getCategories() | List supported product categories | | listSchemas() | List available JSON schemas | | getSchema(name) | Get a specific schema |

Negotiation

| Method | Description | |--------|-------------| | negotiate(request) | Start a negotiation | | continueNegotiation(sessionId, counterPrice) | Counter-offer | | acceptNegotiation(sessionId) | Accept current terms | | getNegotiation(sessionId) | Get session status |

Orders

| Method | Description | |--------|-------------| | createOrder(request) | Place an order | | listOrders(pagination?) | List your orders | | getOrder(orderId) | Get order details | | cancelOrder(orderId, reason?) | Cancel an order |

Seller: Catalog

| Method | Description | |--------|-------------| | upsertProducts(products) | Batch upsert products | | upsertOffers(offers) | Batch upsert offers | | deleteOffer(offerId) | Delete an offer |

Seller: Feeds

| Method | Description | |--------|-------------| | submitFeedCsv(csvContent) | Upload CSV catalog | | submitFeedJson(products) | Upload JSON catalog | | listFeeds(pagination?) | List upload history | | getFeed(feedId) | Get feed status |

Trust & Reviews

| Method | Description | |--------|-------------| | submitReview(request) | Submit a review | | getTrustProfile(agentId) | Get trust profile | | listReviews(agentId, pagination?) | List reviews |

Webhooks

| Method | Description | |--------|-------------| | registerWebhook(request) | Register webhook | | listWebhooks() | List webhooks | | deleteWebhook(webhookId) | Delete webhook |

Utility

| Method | Description | |--------|-------------| | health() | Check API health status |

Error Handling

import { Merka2aClient, Merka2aError } from '@merka2a/sdk'

try {
  const results = await client.searchIntent({ category: 'invalid' })
} catch (error) {
  if (error instanceof Merka2aError) {
    console.log(`API Error: ${error.message}`)
    console.log(`Status: ${error.status}`)
    console.log(`Details: ${JSON.stringify(error.data)}`)
  }
}

TypeScript Support

Full TypeScript support with exported types:

import type {
  Agent,
  AgentRegistration,
  BuyerIntent,
  SearchResult,
  NegotiationSession,
  Order,
  Money,
} from '@merka2a/sdk'

Framework Integrations

  • LangChain: npm install @merka2a/langchain
  • CrewAI: pip install merka2a-crewai
  • AutoGen: Coming soon

Links

License

MIT