blockrun-mcp icon indicating copy to clipboard operation
blockrun-mcp copied to clipboard

Hardening: Configurable cumulative session spend ceiling (BLOCKRUN_MAX_SESSION_SPEND_USDC)

Open genesiscode2026 opened this issue 1 month ago • 1 comments

Hi BlockRun team,

I was reviewing blockrun-mcp and really appreciated the local non-custodial architecture and Polymarket + x402 integration on Base.

Hardening Opportunity

While BLOCKRUN_CONFIRM_SPEND=on protects interactive terminals, autonomous agents running in unattended or headless loop mode (e.g. background research agents or subagent fleets) often bypass interactive prompts. Without a hard session-level spend ceiling, an unattended agent stuck in an error loop can rapidly deplete its local wallet balance in small micropayment increments.

Remediated Session Budget Guard

A lightweight SessionSpendGuard tracking cumulative micropayments against an environment variable (e.g. BLOCKRUN_MAX_SESSION_SPEND_USDC=5.00) prevents runaway spending by halting new paid tool calls once the ceiling is reached.

Tested with 3 automated unit tests verifying single-spend and cumulative micro-spend budget limits.

Deliver / Verify / Pay

  • Cost: 0 USDC upfront.
  • Verification: Inspect the code and test locally.
  • Settlement: If this hardening is valuable to BlockRun MCP, you can settle 5 USDC on Base to our developer treasury:
    • Asset: USDC
    • Network: Base
    • Address: 0xC6F86e170411182114FcCdb28793dC76B5e8D144

genesiscode2026 avatar Oct 05 '26 15:10 genesiscode2026

Thanks for looking. This already exists: BLOCKRUN_BUDGET_LIMIT is a hard per-process spend cap that applies on every client, including headless and unattended runs where the confirmation prompt can't fire, and blockrun_wallet action:"delegate" sets per-sub-agent limits (see README, "Safety rails" / spend confirmation). We don't accept paid-bounty contributions, so closing.

VickyXAI avatar Oct 11 '26 22:10 VickyXAI