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

agentic-mcp-pay-client

v0.1.1

Published

Client SDK for paid MCP tools — auto-pay, budget controls, multi-protocol

Downloads

212

Readme

agentic-mcp-pay-client

Client SDK for paid MCP tools — auto-pay, budget controls, multi-protocol.

Drop-in wrapper for the MCP SDK Client that transparently handles PAYMENT_REQUIRED challenges. Your agent calls tools as usual; the client negotiates payment behind the scenes.

Install

npm install agentic-mcp-pay-client

Quick Start

import { PaidMcpClient } from "agentic-mcp-pay-client";

const client = new PaidMcpClient(
  { name: "my-agent", version: "1.0.0" },
  {
    walletPrivateKey: process.env.WALLET_KEY,
    budget: {
      maxPerCallCents: 1000,  // $10 max per tool call
      maxDailyCents: 10000,   // $100 daily cap
    },
  }
);

await client.connect(transport);

// Tools that require payment are handled automatically
const result = await client.callTool({
  name: "premium-search",
  arguments: { query: "market analysis" },
});

Budget Controls

Set spending limits to prevent runaway costs:

const client = new PaidMcpClient(
  { name: "my-agent", version: "1.0.0" },
  {
    walletPrivateKey: process.env.WALLET_KEY,
    budget: {
      maxPerCallCents: 500,   // reject any single call over $5
      maxDailyCents: 5000,    // stop after $50/day
    },
  }
);

Throws BudgetExceededError when a tool's price exceeds either limit.

Approval Callback

Require human approval before paying:

const client = new PaidMcpClient(
  { name: "my-agent", version: "1.0.0" },
  {
    walletPrivateKey: process.env.WALLET_KEY,
    onPaymentRequired: async (info) => {
      console.log(`Tool "${info.toolName}" costs ${info.amountCents}c (${info.protocol})`);
      return confirm("Approve?"); // return false to reject
    },
  }
);

Throws PaymentRejectedError when the callback returns false.

Spending Stats

const stats = client.getSpendingStats();
// { totalCents: 1500, todayCents: 500, callCount: 3 }

Supported Protocols

| Protocol | Credential Config Key | Description | | -------- | --------------------------- | ---------------------------- | | x402 | walletPrivateKey | HMAC-SHA256 signed challenges | | stripe | stripePaymentMethodId | Stripe payment method pass-through | | mpp | mppSessionToken | Micropayment protocol session token |

How It Works

  1. Your agent calls client.callTool() as normal.
  2. If the server returns PAYMENT_REQUIRED, the client parses the challenge.
  3. Budget limits are checked. The onPaymentRequired callback is called (if set).
  4. The appropriate signer produces a proof for the challenge's protocol.
  5. The tool call is retried with _payment: { nonce, proof, protocol } in arguments.
  6. The spend is recorded in the budget tracker.
  7. The successful result is returned to your agent — transparently.

Gateway

This client is designed to work with agentic-mcp-pay, the server-side payment gateway for MCP tools.

License

MIT