{
  "markdown": "<p align=\"center\">\n  <img src=\"assets/logo.svg\" width=\"200\" alt=\"Clicks Protocol Logo\">\n  <h1 align=\"center\">Clicks Protocol ⚡</h1>\n  <p align=\"center\">Agent commerce settlement routing for USDC flows on Base.</p>\n</p>\n\n<p align=\"center\">\n  <a href=\"README-CN.md\">中文文档</a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@clicks-protocol/sdk\"><img src=\"https://img.shields.io/npm/v/@clicks-protocol/sdk?color=00FF9B&label=sdk\" alt=\"npm\"></a>\n  <a href=\"https://basescan.org/address/0x23bb0Ea69b2BD2e527D5DbA6093155A6E1D0C0a3\"><img src=\"https://img.shields.io/badge/Base%20Mainnet-live-00FF9B\" alt=\"Base Mainnet\"></a>\n  <a href=\"#\"><img src=\"https://img.shields.io/badge/tests-227%20passing-00FF9B\" alt=\"Tests\"></a>\n  <a href=\"LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue\" alt=\"License\"></a>\n  <a href=\"https://clicksprotocol.xyz/mcp/server.json\"><img src=\"https://img.shields.io/badge/MCP%20metadata-valid-00FF9B\" alt=\"MCP metadata\"></a>\n  <a href=\"https://discord.gg/FfmJGUcxfe\"><img src=\"https://img.shields.io/badge/Discord-join-5865F2\" alt=\"Discord\"></a>\n  <a href=\"https://clawhub.ai/protogenosone/clicks-protocol\"><img src=\"https://img.shields.io/badge/ClawHub-40%2B%20downloads-00FF9B\" alt=\"ClawHub\"></a>\n</p>\n\n<p align=\"center\">\n  <a href=\"https://clicksprotocol.xyz\">Website</a> ·\n  <a href=\"https://x.com/ClicksProtocol\">Twitter</a> ·\n  <a href=\"https://discord.gg/FfmJGUcxfe\">Discord</a> ·\n  <a href=\"https://clicksprotocol.medium.com\">Medium</a> ·\n  <a href=\"https://substack.com/@clicksprotocol\">Substack</a> ·\n  <a href=\"https://reddit.com/user/clicksprotocol/\">Reddit</a> ·\n  <a href=\"https://api.clicksprotocol.xyz/lab\">Treasury Lab</a> ·\n  <a href=\"https://mcpservers.org\">mcpservers.org</a>\n</p>\n\n---\n\n<p align=\"center\">\n  <img src=\"demo.gif\" alt=\"Clicks Protocol Quick Start Demo\" width=\"700\">\n</p>\n\n---\n\n## One call. Yield starts.\n\n```typescript\nimport { ClicksClient } from '@clicks-protocol/sdk';\n\nconst clicks = new ClicksClient(signer);\nawait clicks.quickStart('100', agentAddress);\n// 80 USDC → agent wallet (instant)\n// 20 USDC → treasury yield route\n```\n\nThat's it. No config. No dashboard. No human required.\n\n---\n\n## What Clicks does\n\nEvery USDC payment your agent receives gets auto-split:\n\n```\nPayment in\n    ├── 80% → Agent Wallet (liquid, instant)\n    └── 20% → DeFi Yield (Aave V3 or Morpho, auto-routed to best APY)\n                 │\n                 └── Withdraw anytime → Agent gets principal + yield (minus 2% fee on yield only)\n```\n\n- **No lockup.** Withdraw anytime.\n- **No manual steps.** Fully autonomous.\n- **2% fee on yield only.** Never on principal.\n- **Auto-rebalances** between Aave V3 and Morpho for best APY.\n\n---\n\n## Install\n\n```bash\nnpm install @clicks-protocol/sdk ethers@^6\n```\n\n---\n\n## x402 + Coinbase Agentic Wallets\n\nClicks is designed to sit after x402-style payment flows on Base.\n\nx402 handles authorization and payment. Clicks routes USDC after receipt:\n\n```typescript\nimport { ClicksClient } from '@clicks-protocol/sdk';\nimport { CoinbaseWalletSDK } from '@coinbase/wallet-sdk';\n\nconst wallet = new CoinbaseWalletSDK({ appName: 'YourAgent' });\nconst signer = wallet.makeWeb3Provider().getSigner();\n\nconst clicks = new ClicksClient(signer);\nawait clicks.quickStart('1000', agentAddress);\n\n// Your agent now has a settlement policy\n// 80% liquid for operations\n// 20% routed through treasury yield\n```\n\n- Same chain (Base), same USDC contract\n- 80% liquid for operations\n- 20% routed through treasury yield\n- No lockup, withdraw anytime\n\n---\n\n## SDK\n\n### Quick Start (recommended)\n\nOne call: registers agent, approves USDC, splits first payment.\n\n```typescript\nconst result = await clicks.quickStart('100', agentAddress);\n// result.registered → true (skips if already done)\n// result.approved   → true (skips if allowance sufficient)\n// result.paymentSplit → true\n```\n\n### Individual operations\n\n```typescript\n// Register\nawait clicks.registerAgent(agentAddress);\n\n// Approve USDC spending\nawait clicks.approveUSDC('max');\n\n// Receive payment (auto-splits)\nawait clicks.receivePayment('500', agentAddress);\n\n// Check yield info\nconst info = await clicks.getYieldInfo();\n// { activeProtocol: 'Morpho', aaveAPY: 700, morphoAPY: 950, ... }\n\n// Withdraw everything\nawait clicks.withdrawYield(agentAddress);\n\n// Custom yield split (5-50%)\nawait clicks.setOperatorYieldPct(30); // 30% to yield, 70% liquid\n```\n\n### Read-only (no signer needed)\n\n```typescript\nconst clicks = new ClicksClient(provider); // provider, not signer\n\nconst agent = await clicks.getAgentInfo(agentAddress);\n// { isRegistered: true, deposited: 1000000n, yieldPct: 20n }\n\nconst split = await clicks.simulateSplit('100', agentAddress);\n// { liquid: 80000000n, toYield: 20000000n }\n```\n\n---\n\n## MCP Server\n\nAI agents can discover and use Clicks via [MCP](https://modelcontextprotocol.io):\n\n```bash\nnpm install @clicks-protocol/mcp-server\nCLICKS_PRIVATE_KEY=0x... clicks-mcp\n```\n\n16 tools available: `clicks_quick_start`, `clicks_register_referral`, `clicks_get_agent_info`, `clicks_simulate_split`, `clicks_get_yield_info`, `clicks_get_referral_stats`, `clicks_verify_receipt`, `clicks_get_settlement_status`, `clicks_reconcile_settlement`, `clicks_replay_policy`, `clicks_get_receipt_trail`, `clicks_receive_payment`, `clicks_withdraw_yield`, `clicks_register_agent`, `clicks_set_yield_pct`, `clicks_explain`\n\nWorks with Claude, Cursor, LangChain, and any MCP-compatible client.\n\n---\n\n## Referral Network\n\nReferral contracts exist on-chain. Treat them as a separate attribution layer from the current SDK `quickStart()` helper.\n\n| Level | Share of protocol fee |\n|-------|----------------------|\n| L1 (direct referral) | 40% |\n| L2 | 20% |\n| L3 | 10% |\n| Treasury | 30% |\n\nThe referred agent pays **nothing extra**. Rewards come from the 2% protocol fee once referral attribution has been registered through a dedicated flow.\n\nRecommended flow:\n\n```typescript\nconst deadline = BigInt(Math.floor(Date.now() / 1000) + 3600);\nconst signature = await clicks.signReferralApproval(agentAddress, referrerAddress, deadline);\n\nconst result = await clicks.quickStartWithReferral(\n  '100',\n  agentAddress,\n  referrerAddress,\n  deadline,\n  signature,\n);\n```\n\nImportant:\n- `quickStart()` handles treasury setup.\n- `registerReferralWithSig()` handles explicit attribution.\n- `quickStartWithReferral()` is a convenience wrapper over those two steps, not an atomic one-shot contract call.\n\n**Economics per $10k deposit at 7% APY:**\n\n| Your tree | Passive income/year |\n|-----------|-------------------|\n| 10 agents | $56 |\n| 100 agents | $560 |\n| 1,000 agents | $9,800 |\n| 10,000 agents | $98,000 |\n\n---\n\n## Agent Teams\n\nForm squads, hit TVL milestones, earn bonus yield:\n\n| Tier | TVL threshold | Bonus yield |\n|------|--------------|-------------|\n| 🥉 Bronze | $50k | +0.20% |\n| 🥈 Silver | $250k | +0.50% |\n| 🥇 Gold | $1M | +1.00% |\n| 💎 Diamond | $5M | +2.00% |\n\n---\n\n## Contracts (Base Mainnet)\n\n| Contract | Address |\n|----------|---------|\n| ClicksRegistry | [`0x23bb...0C0a3`](https://basescan.org/address/0x23bb0Ea69b2BD2e527D5DbA6093155A6E1D0C0a3) |\n| ClicksSplitterV4 | [`0xB7E0...f3C8`](https://basescan.org/address/0xB7E0016d543bD443ED2A6f23d5008400255bf3C8) |\n| ClicksYieldRouter | [`0x0531...EECD`](https://basescan.org/address/0x053167a233d18E05Bc65a8d5F3F8808782a3EECD) |\n| ClicksFeeV2 | [`0x8C4E...0fb5`](https://basescan.org/address/0x8C4E07bBF0BDc3949eA133D636601D8ba17e0fb5) |\n| ClicksReferral | [`0x1E5A...4ccC`](https://basescan.org/address/0x1E5Ab896D3b3A542C5E91852e221b2D849944ccC) |\n| Safe Multisig (Owner) | [`0xaD82...D6A9`](https://basescan.org/address/0xaD8228fE91Ef7f900406D3689E21BD29d5B1D6A9) |\n| USDC | [`0x8335...913`](https://basescan.org/address/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) |\n\nAll contracts verified on Basescan. Owned by Gnosis Safe multisig — single-key compromise is not possible.\n\n## ERC-8004 Trustless Agent\n\nClicks is registered on the [ERC-8004 Identity Registry on Base](https://basescan.org/token/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432?a=45074) as **agentId 45074**. On-chain reputation accrues per completed agent job. Attestors who follow the [Clicks Attestor Schema V1](https://clicksprotocol.xyz/strategy/ATTESTOR-SCHEMA-V1.md) become eligible for the reputation-aware fee multiplier (shipping in V5).\n\n- Manifest: [`/.well-known/agent-registration.json`](https://clicksprotocol.xyz/.well-known/agent-registration.json)\n- Schema V1: [clicksprotocol.xyz/strategy/ATTESTOR-SCHEMA-V1.md](https://clicksprotocol.xyz/strategy/ATTESTOR-SCHEMA-V1.md)\n\n---\n\n## Architecture\n\n```\nclicks-protocol/\n├── contracts/           Solidity (^0.8.20)\n│   ├── ClicksSplitterV4    Splits payments, manages yield %\n│   ├── ClicksYieldRouter   Routes to best APY (Aave/Morpho)\n│   ├── ClicksFeeV2           2% fee collection on yield\n│   ├── ClicksRegistry      Agent ↔ Operator mapping\n│   └── ClicksReferral      Multi-level referral system\n├── sdk/                 TypeScript SDK\n├── mcp-server/          MCP Server (16 tools)\n├── site/                Landing page + llms.txt + agent.json\n└── test/                227 tests (Hardhat)\n```\n\n---\n\n## Agent Discovery\n\n- **llms.txt:** [`clicksprotocol.xyz/llms.txt`](https://clicksprotocol.xyz/llms.txt) — full protocol docs for LLMs\n- **agent.json:** [`clicksprotocol.xyz/.well-known/agent.json`](https://clicksprotocol.xyz/.well-known/agent.json) — agent manifest\n- **MCP:** `@clicks-protocol/mcp-server` — tool discovery for MCP clients\n\n---\n\n## Connect Your AI Agent\n\nThe Clicks MCP server is live at `https://mcp.clicksprotocol.xyz/mcp` — connect any MCP-compatible client in seconds.\n\n### Claude Desktop\n\nAdd to your `claude_desktop_config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"clicks-protocol\": {\n      \"url\": \"https://mcp.clicksprotocol.xyz/mcp\"\n    }\n  }\n}\n```\n\n### OpenClaw\n\n```bash\nopenclaw mcp set clicks-protocol --url https://mcp.clicksprotocol.xyz/mcp\n```\n\n### Codex CLI\n\nAdd to `.codex/config.json`:\n\n```json\n{\n  \"mcpServers\": {\n    \"clicks-protocol\": {\n      \"type\": \"url\",\n      \"url\": \"https://mcp.clicksprotocol.xyz/mcp\"\n    }\n  }\n}\n```\n\n### Gemini CLI\n\n```json\n{\n  \"mcpServers\": {\n    \"clicks-protocol\": {\n      \"url\": \"https://mcp.clicksprotocol.xyz/mcp\"\n    }\n  }\n}\n```\n\n### Available MCP Tools\n\n| Tool | Description |\n|------|-------------|\n| `get_protocol_stats` | TVL, APY, agent count |\n| `get_agent_info` | Check if an agent is registered |\n| `get_yield_info` | Yield balance for an agent |\n| `simulate_yield` | Project earnings over time |\n| `clicks://protocol/overview` | Resource: protocol overview |\n\nSee [`examples/integrations/`](examples/integrations/) for ready-to-use config files.\n\n---\n\n## Works with\n\nAny agent framework that handles USDC on Base:\n\nx402 · LangChain · CrewAI · AutoGen · Eliza · OpenClaw · Claude · Cursor · Codex · Gemini · Hummingbot · Phidata\n\n---\n\n## Development\n\n```bash\nnpm install\nnpx hardhat compile\nnpx hardhat test          # 227 tests\n```\n\n---\n\n## License\n\nMIT\n\n---\n\n<p align=\"center\">\n  <sub>Built for agents, by agents. Live on Base.</sub>\n</p>\n",
  "bytes": 11063,
  "sha": "3c34356fbfe946c1f72527a127d9db3794bda7ad065c7c47179aae7f79cc1270",
  "repo_slug": "clicks-protocol/clicks-protocol",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_clicksprotocol_mcp_server_07da19cc/readme"
}