How the treasury works
Nebula runs a background rebalancing loop on a configurable interval (default: every 60 seconds). On each tick it compares your current liquid balance against your liquidity threshold and acts accordingly:- Liquid balance above threshold — the excess is deposited into the Blend lending pool to earn yield.
- Liquid balance below threshold — Blend deposits are withdrawn to top up your liquid balance back to the threshold.
- Liquid balance at threshold — no action is taken.
TREASURY_ASSET and can be either xlm (default) or usdc. When you use XLM as the treasury asset, Nebula automatically reserves a small buffer (XLM_FEE_BUFFER) in your liquid balance so you always have enough XLM to pay Stellar transaction fees.
Treasury rebalancing moves are not subject to your agent spending limits (
MAX_PER_CALL, MAX_PER_DAY, or your on-chain policy). The rebalancer manages your funds on your behalf and operates outside the spending control layer.Setting up the treasury
Check your current treasury status
Start by looking at what the treasury sees right now — your liquid balance, any existing Blend deposits, the current supply APY, and when the last rebalance ran:Example output:
Check current Blend rates
Before adjusting your threshold, review the current supply APY available in the Blend lending pool for your treasury asset:
blend_check_rates reads Blend pool data on testnet. Verify pool availability and rates separately before deploying to mainnet — pool compositions and APYs differ between networks.Set your liquidity threshold
Choose how much of your treasury asset to keep liquid and immediately available for agent payments. Anything above this amount will be automatically deposited into Blend:This sets a minimum liquid balance of 20 units of your treasury asset. The background rebalancer picks up the new value on its next run.
Trigger an immediate rebalance
You do not need to wait for the next background tick. Trigger a rebalance right now to deposit any excess immediately:Nebula calculates the difference between your current liquid balance and your threshold, then either deposits the excess to Blend or withdraws from Blend to cover a shortfall — whichever is needed.
Configuration reference
Set these environment variables in your MCP config to control treasury behaviour:| Variable | Default | Purpose |
|---|---|---|
TREASURY_ASSET | xlm | Asset to manage: xlm or usdc. |
LIQUIDITY_THRESHOLD | 10 | Minimum liquid balance to keep on hand before depositing excess to Blend. |
REBALANCE_INTERVAL_SECONDS | 60 | How often the background loop checks and rebalances (in seconds). |
XLM_FEE_BUFFER | 5 | XLM reserved for transaction fees when TREASURY_ASSET=xlm. This amount is always kept liquid and is not deposited. |
TREASURY_MAX_PER_REBALANCE | (unset) | Optional cap on how much can be moved in a single rebalance. Leave unset to move the full excess or deficit in one transaction. |
Example MCP config with treasury
Monitoring the treasury
After your first few rebalancing cycles, runget_treasury_status again to confirm funds are moving as expected:
Connect to Claude
Configure your MCP environment variables from scratch.
On-Chain Policy
Add cryptographic spending enforcement alongside your treasury setup.