Getting Started
Start routing agent treasury in under a minute. One SDK call, no config, no human required.
Prerequisites
Node.js
Node.js 18+ is required.
node --versionEthers v6
The SDK uses ethers v6 for blockchain interactions.
npm install ethers@^6Base RPC
Clicks Protocol runs on Base mainnet. Use this RPC endpoint:
https://mainnet.base.orgOr use any Base-compatible RPC provider (Alchemy, Infura, etc.).
Install SDK
Install the Clicks Protocol SDK and ethers v6:
npm install @clicks-protocol/sdk ethers@^6Or with yarn:
yarn add @clicks-protocol/sdk ethers@^6Quick Start (3 Steps)
Step 1: Import and Initialize
Import the SDK and create a ClicksClient instance with a signer.
import { ClicksClient } from '@clicks-protocol/sdk';
// Create a signer (ethers v6)
const signer = new ethers.Wallet(privateKey, provider);
// Initialize ClicksClient
const clicks = new ClicksClient(signer);Step 2: Quick Start
Call quickStart with an amount and agent address.
// One-call setup: registers agent, approves USDC, and splits first payment
await clicks.quickStart('1000', agentAddress);
// Result: 800 USDC -> liquid working capital
// 200 USDC -> routed to yieldThe method automatically sets up the default 80% liquid / 20% yield treasury policy.
Step 3: Receive Payments
For subsequent payments, use receivePayment.
// All future payments are automatically split 80/20
await clicks.receivePayment('500', agentAddress);No additional setup needed. Incoming USDC now follows the same settlement policy automatically.
MCP Server Setup
AI agents can discover and use Clicks via Model Context Protocol (MCP). The server provides 11 tools for autonomous operation.
npx @clicks-protocol/mcp-serverOr install globally:
npm install -g @clicks-protocol/mcp-server
CLICKS_PRIVATE_KEY=0x... clicks-mcpAvailable Tools (11)
clicks_quick_start— One-call setup + first paymentclicks_register_referral— Explicit referral attribution with agent signatureclicks_receive_payment— Split incoming USDC paymentclicks_withdraw_yield— Withdraw principal + yieldclicks_register_agent— Register new agentclicks_set_yield_pct— Set custom yield percentageclicks_get_agent_info— Agent registration + balance infoclicks_simulate_split— Preview payment splitclicks_get_yield_info— Current APY + active protocolclicks_get_referral_stats— Referral network statsclicks_explain— Agent-to-agent protocol explanation
Check Yield Balance
Monitor the routed treasury position and accumulated earnings.
// Get agent info including deposited amount
const agentInfo = await clicks.getAgentInfo(agentAddress);
console.log(agentInfo);
// { isRegistered: true, deposited: 200000000n, yieldPct: 20n }
// Get current yield protocol and APY rates
const yieldInfo = await clicks.getYieldInfo();
console.log(yieldInfo);
// { activeProtocol: 'Morpho', morphoAPY: 950, aaveAPY: 700 }The getAgentInfo method works with a provider (no signer needed).
Withdraw Yield
Withdraw principal plus accumulated yield at any time. No lockup period.
// Withdraw all principal + yield for an agent
await clicks.withdrawYield(agentAddress);The full amount (principal + accrued yield) is returned to the agent's wallet in USDC.
Next Steps
Summary
- • Install SDK:
npm install @clicks-protocol/sdk ethers@^6 - • Initialize:
new ClicksClient(signer) - • Quick start:
clicks.quickStart('amount', agentAddress) - • Default split: 80% liquid, 20% earning 7-13% APY on Morpho
- • Check balance:
clicks.getAgentInfo(agentAddress) - • Withdraw anytime:
clicks.withdrawYield(agentAddress) - • MCP server:
npx @clicks-protocol/mcp-server(11 tools)