mcp

v1.3.3
@tronenergy/mcp Checked 1 day ago Published 29 days ago

MCP server for TRON Energy Rentals: prices, energy needs, orders, and (opt-in) opening an account or buying energy.

Ask TRON Energy Rentals about prices, energy needs and your orders from any MCP client: Claude Desktop, Cursor, Claude Code, or your own agent. Both are enforced by the package on itself, not promised in a README: every tool declares whether it is read-only, the server refuses to start if the code and the configuration disagree, and a tool that is not enabled is absent from the tool list rather than present-and-refusing, so a model never sees it, plans around it, or describes it to the buyer.

Summary extracted from the README.

@tronenergy/mcp

Ask TRON Energy Rentals about prices, energy needs and your orders from any MCP client: Claude Desktop, Cursor, Claude Code, or your own agent.

Published: @tronenergy/mcp, and npx -y @tronenergy/mcp works as-is.

Read-only by default. Out of the box no tool here spends money, moves TRX, or signs anything, and there is no private key in this package. None is ever sent to it.

One tool can spend, and it is off unless you name it. createOrder buys energy from your prepaid credit. It does not exist in the tool list until you set TRONENERGY_ALLOW_WRITES=createorder, and it cannot exceed a ceiling you set by hand. See Buying energy below.

Both are enforced by the package on itself, not promised in a README: every tool declares whether it is read-only, the server refuses to start if the code and the configuration disagree, and a tool that is not enabled is absent from the tool list rather than present-and-refusing, so a model never sees it, plans around it, or describes it to the buyer.


Which account should you open? The two doors, and what they cost you

There are two ways to open an account, and the difference is not cosmetic: it decides what happens the day you lose the key.

Door 1: no wallet. Unrecoverable, and the key cannot be revoked. You call POST /account/signup and get an API key plus a deposit address. No wallet, no signature, nothing to install. Save the key. It is the only way into the account: only its hash is stored, so it cannot be shown again or recovered. If you lose it, the balance on that account is gone. Not frozen, not recoverable by support. Gone. A leaked key is the same problem from the other side: with no wallet there is nothing to prove ownership with, so the key cannot be revoked or replaced, ever. The only remedy is to stop funding that account. Never commit a config holding a key, and never paste one into a conversation.

This is why a no-wallet account should hold a working balance, not a treasury.

Door 2: proved with a wallet. Recoverable. You sign a short message with a TRON wallet, and that wallet becomes the identity of the account. You still get an API key, but it is now disposable: if you lose it, or it leaks, sign again and a fresh key is issued. The old key stops working in the same call. Your balance does not move. The existing key is never revealed. A replacement is issued, because storing keys in a readable form is how one database leak becomes everybody's problem.

Pick door 1 if you have no TRON wallet or want nothing to do with one. Pick door 2 if you plan to keep credit on the account, which is most people. It costs one signature and removes the only unrecoverable failure in the system.

Measured, not assumed: a wallet that is not bound to a door-1 account cannot re-key it (404 no account is bound to this wallet), while the same wallet can re-key its own door-2 account any time. Recovery requires a wallet that proved itself; there is no other path in.


Install

{
  "mcpServers": {
    "tronenergy": {
      "command": "npx",
      "args": ["-y", "@tronenergy/mcp"],
      "env": {
        "TRONENERGY_API_KEY": "tek_your_key_here"
      }
    }
  }
}

TRONENERGY_API_KEY is only needed for the two account tools (account, rental). Leave it out and the five public tools still work. The key is your own, created on the API tab at tronenergyrentals.io. It is shown once and cannot be recovered.

The package holds no credential of its own. It is not tied to an account, needs no signup to install, and the key you pass is used per request and never stored.

If you call a keyed tool without a key, it refuses and names the missing variable rather than silently returning empty data.

Variable Default Meaning
TRONENERGY_API_BASE https://tronenergyrentals.io/api/v1 point at a test deployment if you want
TRONENERGY_API_KEY (none) your key; enables account and rental
TRONENERGY_TIMEOUT_MS 20000 per-request timeout
TRONENERGY_ALLOW_WRITES (none) comma list of write tools to enable, e.g. createorder. Unset = read-only
TRONENERGY_MAX_ORDER_TRX 5 ceiling per order, in TRX. The agent cannot raise this
TRONENERGY_MAX_SPEND_TRX (none) total budget per window, in TRX. Unset = no total budget
TRONENERGY_SPEND_WINDOW 24h how long that budget lasts: 24h, 30m, 90s, 1d. A bare number is minutes

The per-order ceiling is not a budget

TRONENERGY_MAX_ORDER_TRX bounds one order. It says nothing about how many orders an agent may place, so an agent that misreads its instructions can order again and again at a size it is allowed until your credit is gone, and every individual purchase looked fine, which is what makes it hard to notice.

Set TRONENERGY_MAX_SPEND_TRX to bound the total. It is opt in: nothing changes until you set it, and then it is stated in the tool description with your own numbers, so the agent knows the limit exists and can tell the buyer why an order was refused instead of treating the refusal as a fault.

"env": {
  "TRONENERGY_ALLOW_WRITES": "createorder",
  "TRONENERGY_MAX_ORDER_TRX": "5",
  "TRONENERGY_MAX_SPEND_TRX": "50",
  "TRONENERGY_SPEND_WINDOW": "24h"
}

What that does and does not promise. It caps what THIS MCP SERVER PROCESS may spend in a rolling window: at most 50 TRX in any 24 hours, here. An order that does not fit is refused, not truncated, so you never get a smaller order than you asked for. The refusal names the budget, the amount left, and the exact line to change.

It is a leash on the agent, not an account-wide guarantee, and the difference matters:

  • Unset means no total budget at all: the behaviour is exactly what it was before this setting existed. There is no default, because a default is a spend decision nobody asked for, and a low one would silently cap a buyer who was ordering more on purpose.
  • The count lives in this process, so restarting the server resets the window. Another client configured with the same API key keeps its own count, and the two do not add up. It bounds a runaway agent inside a session; it is not a durable allowance a determined person cannot clear.
  • A failed order spends nothing. Retrying a validation error does not eat your budget.

Set it at least as high as the per-order ceiling, or no order can ever fit. The package refuses to start in that case and says so, rather than failing on your first purchase.


Tools

Public (no key)

Tool What it answers
products prices for every duration, min/max order, energy available now
estimate energy a USDT transfer needs, and what that costs here
energyNeeded how much energy a given address needs (a wallet that never held USDT costs ~double)
order live state of one order by its public ref: status, whether energy is delegated, the txid
ordersByPayer the orders a payer address has placed, newest first

Keyed (TRONENERGY_API_KEY)

Tool What it answers
account your prepaid balance, deposit address, status, recent rentals
rental live state of one of your rentals by id

Write (TRONENERGY_ALLOW_WRITES)

Tool What it does
createAccount opens a new no-wallet account and returns its key once
createOrder spends your prepaid credit to buy energy and delegate it to one wallet

Both are absent from the tool list unless enabled by name, and each name enables only itself: TRONENERGY_ALLOW_WRITES=createaccount does not expose createOrder.

What createOrder costs, beyond the energy price

Energy cannot be delegated to a wallet that has no account on chain: the chain rejects it. So the total is not always the energy price, and an agent should say so before the buyer agrees:

Situation What happens
the wallet already has an account energy price only. Nothing extra.
no account yet the account is created and the network's 1.1 TRX create fee is added, reported as its own activation line. A pass-through burn, not a fee kept by us, and refunded in full if the account turns out to exist by the time we deliver.
you pass activate_if_inactive: false an order to a wallet with no account is refused (400) instead of charged. Turning it off costs nothing: the check runs before anything is written.
you pass top_up_trx: N (max 2) N TRX is sent to the receiving wallet, debited from your credit. It arrives after the delegation has landed, so a failed order never sends it. For a brand-new wallet that needs TRX of its own to pay the network fee. Face value, no service fee.

In a batch, only the wallets that actually need activation are charged for it, and two orders for one new wallet net out to one activation: whichever order does not create the account has its charge refunded.

account reports whether a top-up is available (topup.available) before you rely on it.

See Opening an account from an agent and Buying energy.

A rental belonging to another account answers exactly as if it did not exist, because rental ids are sequential, so a distinct error would confirm that someone else's id is real. That scoping happens server-side, not in this package.


What an agent should know

  • Never guess a price. Call products. Every figure comes from the API at call time, so the answer cannot drift from what the service actually charges.
  • Energy depends on the recipient, not the sender. A USDT transfer to an address that has never held USDT costs roughly double (the balance slot must be created). Use energyNeeded.
  • Credit is prepaid and non-refundable, spendable only on energy. It cannot be withdrawn.
  • One address per order. receive_at is a single TRON address; there is no list form.
  • An order is delivered when it is delegated on chain, not when the API accepts it. order returns the delegation transaction: that is the proof.

Example

You: how much would it cost to send USDT to TU5negEDt29xLfWSPFDcYgG989NBaAmcYA, and do I have enough credit?

Agent: calls energyNeeded → 131,000 units (that address holds no USDT, so the slot must be created), then products → 10 minutes at 30 SUN/unit = 3.93 TRX, then account → balance 0 TRX. You need to top up ~3.93 TRX to the deposit address first.


For the model reading this

The tool output is shaped for an LLM, not forwarded raw, because two fields in the HTTP API actively mislead, so products reshapes them:

Raw API field Problem What this package returns
max_units null on every tier, while the real ceiling sits in largest_single_order_units, so a model reads null and either refuses or invents a limit max_units is the real number, plus max_units_source saying where it came from
price_sun_per_unit "30.000000" a model that multiplies this and calls the result TRX is wrong by a million numeric price_trx_per_unit (0.00003) and a priced_in note

So a total is price_trx_per_unit × energy_units. 65,000 units for 10 minutes = 1.95 TRX, not 1,950,000. max_units_capped_by_stock_now is the smaller figure that decides whether an order is accepted right now.

Two tools look similar and are not: energyNeeded tells you how much energy an address requires (depending on whether it has ever held USDT), estimate tells you the cost of a specific transfer. Use energyNeeded when sizing, products when pricing.

Opening an account from an agent

With TRONENERGY_ALLOW_WRITES=createaccount, an assistant can open an account itself instead of sending the buyer to a web page:

{ "confirm_unrecoverable": true }

It returns an API key, a deposit address, and recoverable: false.

The confirm_unrecoverable flag is not decoration. This is door 1: no wallet attached, key shown once, and losing it loses the balance with no recovery. The tool refuses without the flag, and the refusal states the consequence, so an assistant has to tell the human before the account exists rather than after. Pass it only once you have.

Door 2 is not available as a tool, deliberately. It needs a signature from the buyer's own wallet, and this package holds no wallet keys and never asks for one. If the buyer has a TRON wallet, point them at POST /account/challenge (purpose signup) then POST /account/signup/wallet. The account they get back is recoverable by signing again.

The key comes back once, in that response. Hand it to the human immediately; do not repeat it in later answers, do not put it in a summary, and do not write it anywhere they did not ask for. Once that reply is gone, so is the key.

The account starts empty. Creating it does not fund it. Send TRX to the returned deposit address, then read account to confirm the credit arrived rather than assuming it did. And it always makes a new empty account. Calling it again does not recover an existing one, it makes a second one.


Buying energy (optional)

createOrder is the only tool here that spends money, and it is off unless you name it:

{
  "mcpServers": {
    "tronenergy": {
      "env": {
        "TRONENERGY_API_KEY": "tek_your_key_here",
        "TRONENERGY_ALLOW_WRITES": "createorder",
        "TRONENERGY_MAX_ORDER_TRX": "5"
      }
    }
  }
}

The ceiling lives here, not on your account, and that is deliberate. For a no-wallet account the API key is the only credential you have, so any limit you could raise from the account is a limit the agent holding that key could raise too. A setting in the agent's own config is the one thing an agent cannot change for itself and cannot be talked into changing: the only remedy is a human editing this file and restarting. It is a leash on the agent, not a property of the money: two agents on the same account may hold different ceilings.

The limit is stated in the createOrder tool description, with this agent's own number, so an assistant can answer "what is the most I can spend per order?" without attempting an order to find out.

If an order does exceed it, the refusal quotes the exact line to change, with the current value:

"TRONENERGY_MAX_ORDER_TRX": "5"

Raise the number in the env block of the tronenergy server entry and restart your client. The refusal is intended, and an agent asking again will not change it; the limit is the human's to set.

An agent cannot verify the change itself. It has no tool that reads its own configuration, and after the edit the server restarts, so the next order is served by a different process. In practice the new ceiling shows up on the next refusal or in the next createOrder description, not because the agent checked, but because it is talking to a process that was started with the new value.

Check the balance first. Call account before createOrder. A purchase the credit cannot cover is refused with 402 insufficient_funds, and that refusal gives the price but not how short you are, so an agent that skipped the check has to make another call after failing to learn what it could have known first. Read both figures up front, compare them, and if credit is short tell the buyer the exact difference.

A ceiling refusal and a balance refusal are different problems. Exceeding the ceiling is fixed by a human editing TRONENERGY_MAX_ORDER_TRX; insufficient credit is fixed by sending TRX to the deposit address. The remedies are not interchangeable and suggesting the wrong one sends the buyer somewhere that cannot help.

What the tool does before spending:

  • quotes the order from /products (the same figures you were shown) and refuses before the order route is reached if the price cannot be read. A ceiling that fails open is not a ceiling.
  • charges the account server-side, inside the same transaction that reserves the energy. The price is never supplied by the caller.
  • returns quoted_trx and ceiling_trx alongside the result, so what was checked is stated rather than implied.
  • a replayed: true answer means this exact call had already been made: you get the original rental and are not charged twice. Omit idempotency_key and one is generated per call; supply your own only when retrying a call whose outcome you could not see.

A delivery that fails is refunded to the balance automatically, never to a wallet, because deposits are not withdrawable.

What it will never do

It cannot sign a transaction, move a token, or withdraw. Energy is delegated to the wallet you name and from there it is yours to spend as you choose; the transfer itself is signed by whoever holds that wallet's key, which is your side of the fence. This package never asks for a private key, and there is no code in it that could use one.


Licence

MIT. This package is a thin client over the public API; it holds no secrets beyond the key you give it, and it never writes that key anywhere.