← Back to GBLIN Protocol
Live on Base mainnet — MCP v0.1.0

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-server

Why 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.

Atomic 1-tx swap, any wallet

The contract has a native `sellGBLINForToken` function. No batched UserOp, no ERC-4337 dependency. EOA, smart account, EIP-7702 all work identically.

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 drops >20%, dynamic weights re-route toward USDC. Slippage buffer auto-scales from 2.5% to 4% 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+.

Claude Desktop`claude_desktop_config.json`
{
  "mcpServers": {
    "gblin": {
      "command": "npx",
      "args": ["-y", "@gblin-protocol/mcp-server"]
    }
  }
}
Windsurf / Cursor`~/.codeium/windsurf/mcp_config.json`
{
  "mcpServers": {
    "gblin": {
      "command": "npx",
      "args": ["-y", "@gblin-protocol/mcp-server"],
      "env": {
        "GBLIN_RPC_URL": "https://base-rpc.publicnode.com"
      }
    }
  }
}
Coinbase AgentKitTypeScript
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 5 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_treasury_state

Snapshot NAV in USD, basket composition, and Crash Shield status from on-chain reads.

quote_safe_swap

Preview buy or sell with the right minOut accounting for fees + dynamic slippage (2.5% normal / 4% during Crash Shield).

swap_gblin_to_usdc_jit

Generate 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_gblin

Convert USDC earnings back to GBLIN with MEV-safe minOut values. Returns two sequential steps (approve + buyGBLINWithToken).

analyze_treasury_health

Full balance report (GBLIN + USDC + ETH), gas runway, cooldown status, and rebalance recommendation based on the agent burn rate.

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:

// 1. 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",
//   target_contract: "0x38DcDB3A...",
//   calldata: "0x6a54df11...",  // sellGBLINForToken(...)
//   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.

FAQ

Why hold GBLIN instead of USDC?

USDC pays no yield and loses to inflation. GBLIN is a 45% cbBTC + 45% WETH + 10% USDC basket with an automated Crash Shield, designed to appreciate over time while remaining instantly swappable 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 `sellGBLINForToken` is a single atomic transaction — 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?

Not yet. The MCP server is free. We are planning a small set of x402-monetized HTTP endpoints (live NAV stream, strategy advisor) for v0.2 — those will be opt-in.

GBLIN for AI Agents — Treasury Standard on Base | GBLIN