Getting Started

Start earning yield on agent USDC in under a minute. One SDK call, no config, no human required.

Prerequisites

Node.js

Node.js 18+ is required.

bash
node --version

Ethers v6

The SDK uses ethers v6 for blockchain interactions.

bash
npm install ethers@^6

Base RPC

Clicks Protocol runs on Base mainnet. Use this RPC endpoint:

bash
https://mainnet.base.org

Or use any Base-compatible RPC provider (Alchemy, Infura, etc.).

Install SDK

Install the Clicks Protocol SDK and ethers v6:

bash
npm install @clicks-protocol/sdk ethers@^6

Or with yarn:

bash
yarn add @clicks-protocol/sdk ethers@^6

Quick Start (3 Steps)

Step 1: Import and Initialize

Import the SDK and create a ClicksClient instance with a signer.

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

typescript
// One-call setup: registers agent, approves USDC, and splits first payment
await clicks.quickStart('1000', agentAddress);

// Result: 800 USDC → liquid (instant access)
//         200 USDC → earning 7-13% APY on Morpho

The method automatically splits payments 80% liquid / 20% yield by default.

Step 3: Receive Payments

For subsequent payments, use receivePayment.

typescript
// All future payments are automatically split 80/20
await clicks.receivePayment('500', agentAddress);

No additional setup needed. The agent is now earning yield on 20% of all incoming USDC.

MCP Server Setup

AI agents can discover and use Clicks via Model Context Protocol (MCP). The server provides 9 tools for autonomous operation.

bash
npx @clicks-protocol/mcp-server

Or install globally:

bash
npm install -g @clicks-protocol/mcp-server
CLICKS_PRIVATE_KEY=0x... clicks-mcp

Available Tools (9)

  • clicks_quick_start — One-call setup + first payment
  • clicks_receive_payment — Split incoming USDC payment
  • clicks_withdraw_yield — Withdraw principal + yield
  • clicks_register_agent — Register new agent
  • clicks_set_yield_pct — Set custom yield percentage
  • clicks_get_agent_info — Agent registration + balance info
  • clicks_simulate_split — Preview payment split
  • clicks_get_yield_info — Current APY + active protocol
  • clicks_get_referral_stats — Referral network stats

Check Yield Balance

Monitor an agent's yield balance and accumulated earnings.

typescript
// 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.

typescript
// 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 (9 tools)