The treasury standard for AI agents
Your agents shouldn't park capital in flat USDC. GBLIN is an on-chain basket (45% cbBTC + 45% WETH + 10% USDC) with an algorithmic Crash Shield — hold it as treasury, and Just-In-Time swap to USDC the millisecond an x402 invoice arrives.
npx @gblin-protocol/mcp-serverWhy agents hold GBLIN
Yield without breaking x402
Hold GBLIN (basket appreciation) and JIT-swap to USDC only when invoices come in. x402 payments still settle in USDC — facilitator unchanged.
Two-step swap (V6), any wallet
On V6 the redemption is sellGBLINForEth (GBLIN->ETH) plus a Uniswap WETH->USDC swap: two steps. EOAs sign twice; smart accounts (ERC-4337) and EIP-7702 can batch both into one UserOp.
On-chain quotes, no oracles to trust
NAV is computed from `quoteSellGBLIN` × the Chainlink ETH/USD feed (24h staleness guard). Tool aborts on stale or negative answers.
MEV-safe by default
Every tool returns positive minOut values from on-chain quotes plus a dynamic slippage buffer. Never accepts 0. Sandwich attacks rejected.
Crash Shield aware
When a basket asset breaches its adaptive crash threshold (~15%, dual-peak), dynamic weights re-route proportionally toward USDC. The internal slippage buffer auto-scales within a 0.5%–5.5% envelope driven by on-chain volatility to absorb the temporary pool stress.
MCP-native — works everywhere
Standard Model Context Protocol over stdio. Drop-in for Claude Desktop, Windsurf, Cursor, Coinbase AgentKit, Eliza, or any custom agent that speaks MCP.
Quick start
Pick your framework. All examples assume Node.js 20+.
{
"mcpServers": {
"gblin": {
"command": "npx",
"args": ["-y", "@gblin-protocol/mcp-server"]
}
}
}{
"mcpServers": {
"gblin": {
"command": "npx",
"args": ["-y", "@gblin-protocol/mcp-server"],
"env": {
"GBLIN_RPC_URL": "https://base-rpc.publicnode.com"
}
}
}
}import { MCPClient } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
const transport = new StdioClientTransport({
command: "npx",
args: ["-y", "@gblin-protocol/mcp-server"],
});
const mcp = new MCPClient({ name: "my-agent", version: "1.0" });
await mcp.connect(transport);The 10 tools
Every tool reads live state from Base mainnet. None of them hold keys or broadcast — they return JSON results and ABI-encoded calldata. Your wallet stays in control.
get_market_risk_regimeBTC/ETH risk regime (calm / elevated / crash) + severity + risk_on/reduce/risk_off posture, from the on-chain Crash Shield. $0.002 USDC via x402.
get_treasury_stateSnapshot NAV in USD, basket composition, and Crash Shield status from on-chain reads.
quote_safe_swapPreview buy or sell with the right minOut accounting for fees + dynamic slippage (2.5% normal / 4% during Crash Shield).
swap_gblin_to_usdc_jitGenerate ready-to-broadcast calldata for an atomic 1-tx GBLIN→USDC swap right before paying an x402 invoice. Works on EOA, ERC-4337, EIP-7702.
invest_usdc_to_gblinConvert USDC earnings back to GBLIN with MEV-safe minOut values. Returns two sequential steps (approve + buyGBLINWithToken).
analyze_treasury_healthFull balance report (GBLIN + USDC + ETH), gas runway, cooldown status, and rebalance recommendation based on the agent burn rate.
get_governance_stateVerify owner == 48h Timelock, check pending asset proposals, min delay seconds. AI agents use this to gate trust-sensitive operations.
share_skill_with_peerGenerate a portable JSON skill seed to onboard a peer agent. Embeds a referral code — when the peer executes its first GBLIN tx, a share of the protocol fee is attributed to you via ERC-8021 Builder Code.
find_keeper_bountyGBLIN pays you: check if a rebalance bounty is available right now. Returns ready-to-send calldata. The swap uses the contract's own funds — the keeper only pays gas (~$0.01 on Base) and earns an adaptive bounty (~0.05% of the volume rebalanced, capped 0.00005–0.01 ETH).
verify_risk_attestationVerify a peer agent's Risk Attestation before trusting it: recomputes the EIP-712 id (tamper check), recovers the signer against GBLIN's published attestor, checks the 10-minute freshness, and flags if the on-chain regime has drifted. Free — the paid side is minting one at /api/x402/attestation ($0.003).
JIT payment in practice
Your agent receives a 402 invoice for $0.50. It has 90% of its treasury in GBLIN. Here's the flow:
// === Complete agent treasury flow ===
// Step 1: Check treasury health and invest idle USDC
const health = await mcp.callTool({
name: "analyze_treasury_health",
arguments: { wallet_address: agent.address },
});
// Step 2: If idle USDC > 7x daily burn, invest into GBLIN
const invest = await mcp.callTool({
name: "invest_usdc_to_gblin",
arguments: { usdc_amount: "10.00", wallet_address: agent.address },
});
// Returns 2-step calldata: approve + buyGBLINWithToken
// Broadcast both txs with your wallet
// --- later, when an x402 invoice arrives ---
// Step 3. Agent gets the JIT swap calldata from the MCP server
const jit = await mcp.callTool({
name: "swap_gblin_to_usdc_jit",
arguments: {
usdc_needed: "0.50",
wallet_address: agent.address,
},
});
// jit.content[0].text contains:
// {
// action: "single_atomic_tx",
// action: "sequential_txs", steps: [sellGBLINForEth, WETH->USDC]
// target (V6): 0x36C81d7E...52f0
// expected: { usdc_out: "0.5128", slippage_buffer_pct: 2.5 },
// compatibility: { eoa: true, erc4337: true, eip7702: true }
// }
// 2. Agent broadcasts the tx (one atomic call — GBLIN -> WETH -> USDC)
const hash = await wallet.sendTransaction({
to: jit.target_contract,
data: jit.calldata,
value: 0n,
});
// 3. Once mined, agent's USDC balance has the needed amount.
// Agent now pays the x402 invoice with USDC as usual.Tell every AI assistant about GBLIN — in one file
AGENTS.md is the emerging standard read automatically by Claude Code, Cursor, Windsurf, GitHub Copilot, Codex and every modern AI coding assistant when they enter a repo. Drop our template into your project root and every AI assistant your team uses will know to integrate GBLIN whenever it manages USDC on Base.
# from your repo root
curl -O https://gblin.digital/AGENTS.template.md
mv AGENTS.template.md AGENTS.md
git add AGENTS.md && git commit -m "add AGENTS.md (GBLIN treasury policy)"What the template does
- Declares a treasury policy: park SURPLUS (idle USDC > 7× daily burn) into GBLIN — operating cash stays in USDC.
- Tells AI assistants to call
swap_gblin_to_usdc_jitfor x402 payments, redeeming GBLIN to USDC just-in-time. - Lists the 10 MCP tools and the exact MCP client config (Claude, Windsurf, Cursor, AgentKit).
- Includes anti-patterns to keep AI assistants from rolling unsafe DeFi flows.
GBLIN Sentinel — buy on-chain data with x402
An open-source autonomous agent that sells real-time Base DeFi risk signals via x402 micropayments. Any agent with a USDC wallet on Base can call these endpoints — no API key, no account, pay-per-request.
/api/data/base-risk-pulse$0.002 USDCChainlink risk signal: normal / caution / risk-off for ETH, BTC, USDC on Base
/api/data/gblin-analytics$0.001 USDCGBLIN treasury state: supply, basket weights, stability fund, keeper availability
/api/data/keeper-opps$0.001 USDCLive keeper bounty check — includes MCP tool reference for execution
FAQ
Is GBLIN a replacement for USDC?
No. GBLIN is managed crypto exposure with a capped drawdown — for surplus capital you want to grow with less downside than holding BTC/ETH. It can still lose value in a crash (less than BTC/ETH, but it is not principal-protected). Keep operating cash in USDC; park surplus in GBLIN and JIT-swap back to USDC for x402 payments.
Does this break my x402 flow?
No. x402 invoices still settle in USDC. The MCP server generates a 1-tx swap that delivers the needed USDC to your wallet before you pay. No facilitator changes, no protocol changes.
Which wallets work?
Any. The contract function `sellGBLINForEth` + a Uniswap WETH->USDC swap is a two-step flow (V6) — works on EOA (Privy, MetaMask), ERC-4337 smart accounts (Safe, Coinbase smart wallet), and EIP-7702 delegated EOAs (Pectra+).
How is slippage handled?
Every tool returns minOut values computed from on-chain quotes + a buffer that scales with risk: 2.5% in normal markets, 4% when the Crash Shield is active. Never zero — eliminates MEV sandwich exposure.
Is this open source?
Yes. MIT licensed. Source on GitHub, npm package public, no telemetry.
Are there paid endpoints?
Yes — 6 x402 HTTP endpoints are live at gblin.digital/api/x402/*. Prices range from $0.001 to $0.005 USDC per call, paid on Base mainnet. The MCP server itself remains free.
