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

@powersun/mcp-client

v1.3.0

Published

TypeScript SDK for PowerSun.vip — TRON Energy & Bandwidth marketplace and DEX swap aggregator with 27 MCP tools. Register, buy energy, swap tokens, sell resources, earn passive income.

Readme

@powersun/mcp-client

TypeScript SDK for PowerSun.vip — the TRON Energy & Bandwidth marketplace and DEX swap aggregator with 27 MCP tools for AI agents.

Install

npm install @powersun/mcp-client

Quick Start

import { PowerSun } from '@powersun/mcp-client';

// Public access (market data, estimates)
const ps = new PowerSun();
const prices = await ps.market.getPrices();
const estimate = await ps.market.estimateCost({
  txCount: 10,
  txType: 'trc20_transfer',
  durationMinutes: 60,
});

// Authenticated access (buy energy, check balance)
const client = new PowerSun({ apiKey: 'ps_your_key_here' });
const balance = await client.buyer.getBalance();
const order = await client.buyer.buyEnergy({
  targetAddress: 'TYourAddressHere...',
  txCount: 5,
  durationMinutes: 60,
});

HTTP 402 Pay-per-use (No Registration)

import { PowerSun, PaymentRequiredError } from '@powersun/mcp-client';

const ps = new PowerSun(); // no API key

try {
  await ps.buyer.buyEnergy({
    targetAddress: 'TYourAddressHere...',
    txCount: 1,
    durationMinutes: 5,
  });
} catch (err) {
  if (err instanceof PaymentRequiredError) {
    // Send TRX to the deposit address
    console.log('Deposit address:', err.payment.depositAddress);
    console.log('Amount (TRX):', err.payment.requiredAmountTrx);

    // Poll for payment confirmation
    const status = await ps.paymentStatus(err.payment.intentId);
    console.log('Payment status:', status.status);
  }
}

Registration

const ps = new PowerSun();

// Step 1: Get challenge
const { challengeId, challenge } = await ps.register('TYourAddress...');

// Step 2: Sign challenge with TronLink / tronWeb
const signature = await tronWeb.trx.signMessageV2(challenge);

// Step 3: Verify and get API key
const { apiKey } = await ps.verify(challengeId, 'TYourAddress...', signature);

// Step 4: Use authenticated client
const client = new PowerSun({ apiKey });

Token Swap (SunSwap DEX)

const client = new PowerSun({ apiKey: 'ps_your_key_here' });

// Get swap quote (TRX → USDT)
const quote = await client.swap.getQuote({
  fromToken: 'TRX',
  toToken: 'USDT',
  amountIn: '10000000', // 10 TRX in SUN
  slippageBps: 100,     // 1% slippage
});

console.log('Expected output:', quote.quote.expectedAmountOut);
console.log('Energy cost:', quote.energy.costTrx, 'TRX');

// Sign the unsigned TX with tronWeb
const signedTx = await tronWeb.trx.sign(quote.unsignedTx);

// Broadcast with automatic energy delegation
const result = await client.buyer.broadcast({ txData: signedTx });

API Reference

new PowerSun(config?)

| Option | Type | Default | Description | |--------|------|---------|-------------| | apiKey | string | — | API key (ps_* format) | | baseUrl | string | https://powersun.vip | API base URL | | timeout | number | 30000 | Request timeout (ms) |

Market (public)

  • ps.market.getPrices() — Price tiers for all durations
  • ps.market.estimateCost(params) — Cost estimate
  • ps.market.getAvailableResources() — Available energy/bandwidth
  • ps.market.getOverview() — Full market snapshot

Buyer (auth recommended)

  • ps.buyer.buyEnergy(params) — Purchase energy (API key, 402, or x402)
  • ps.buyer.getBalance() — Account balance
  • ps.buyer.getOrderStatus(orderId) — Order details
  • ps.buyer.broadcast(params) — Broadcast pre-signed tx with auto Energy (API key, x402, or 402 pay-per-use)

Swap (auth recommended)

  • ps.swap.getQuote(params) — Get swap quote with unsigned TX for SunSwap DEX (API key, x402, or 402)

Registration (public)

  • ps.register(address) — Start registration
  • ps.verify(challengeId, address, signature) — Verify & get API key
  • ps.paymentStatus(intentId) — Check 402 payment status

Links

License

MIT