DEV Community

harrywalkr
harrywalkr

Posted on Fully Autonomous

Build a Copy-Trading Research Agent with a Free MCP Server (No API Key)

Language models are good at reasoning about traders, but they have no idea who is actually making money on-chain today. The Model Context Protocol (MCP) fixes that: you plug a live data source into Claude, Cursor or your own agent, and the model can call it like a function.

In this tutorial we connect an agent to DexTrading's public MCP server (https://dextrading.com/api/mcp). It needs no API key and no sign-in. Then we write a 60-line Node.js script that answers a question people really ask: "Which Solana wallets are worth copying right now, and which ones are too fast to copy?"

What the server exposes

Five read-only tools over Streamable HTTP (stateless JSON-RPC):

Tool What it answers
find_traders_to_copy The best traders to copy on Solana, BNB Chain, Base or Robinhood Chain for 24h / 7d / 30d, each with a report card
trader_report_card One wallet: ranks, profit taken, profit with unsold coins counted, win rate, hold time, best coin, red flags, verdict
compare_traders 2 to 5 wallets side by side and the coins they bought in common
build_copy_squad A group of wallets that buy the same coins, with a rule like "buy when 2 of 3 agree within 15 minutes"
smart_money_buying_now Coins that wallets with a profitable record are buying now, with a signal (strong, building, early, taking profit)

The ranking is opinionated in a useful way: wallets that launched the coins they traded, wallets with impossible numbers, inactive wallets and wallets with more than 40% of their coins gone to zero are left out. The rest are ranked by profit that still holds once unsold coins are valued at today's price, so one lucky coin counts less.

Step 1: add it to your assistant

Claude Code

claude mcp add --transport http dextrading https://dextrading.com/api/mcp
Enter fullscreen mode Exit fullscreen mode

Claude (web or desktop): Settings → Connectors → Add custom connector → URL https://dextrading.com/api/mcp.

Cursor (.cursor/mcp.json):

{
  "mcpServers": {
    "dextrading": { "url": "https://dextrading.com/api/mcp" }
  }
}
Enter fullscreen mode Exit fullscreen mode

Now you can ask "who should I copy on Base this week?" and the model calls find_traders_to_copy itself. There is also a ready-made Agent Skill and mcp.json in this GitHub repo.

Step 2: call it with plain HTTP

MCP is JSON-RPC, so curl is enough to see what the model sees:

curl -s https://dextrading.com/api/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
       "params":{"name":"find_traders_to_copy",
                 "arguments":{"chain":"solana","period":"7d","limit":3}}}'
Enter fullscreen mode Exit fullscreen mode

The answer's result.content[0].text is a JSON string. Trimmed, one trader looks like this:

{
  "wallet": "FRT8YuLJ9q8PPX2o4RUiJ9hWL427hNmMJ2M6JdgGgzwK",
  "rank": "#9 by profit taken in 7 days",
  "style": "day trader (minutes to hours)",
  "profitTakenUsd": 20040,
  "allInUsd": 19090,
  "winRatePct": 66.7,
  "wins": 24,
  "losses": 12,
  "medianHold": "1.9 h",
  "bestCoin": { "coin": "STEADY", "multiple": "2.2x", "shareOfProfitPct": 20 },
  "verdict": "good pick",
  "cautions": []
}
Enter fullscreen mode Exit fullscreen mode

Step 3: a tiny agent in Node.js

No SDK needed. Node 18+ has fetch:

// agent.mjs: Node 18+ (built-in fetch), no dependencies
const MCP = "https://dextrading.com/api/mcp";
let id = 0;

async function callTool(name, args = {}) {
  const res = await fetch(MCP, {
    method: "POST",
    headers: {
      "content-type": "application/json",
      accept: "application/json, text/event-stream",
    },
    body: JSON.stringify({
      jsonrpc: "2.0",
      id: ++id,
      method: "tools/call",
      params: { name, arguments: args },
    }),
  });
  const { result, error } = await res.json();
  if (error) throw new Error(error.message);
  if (result.isError) throw new Error(result.content[0].text);
  return JSON.parse(result.content[0].text);
}

// "62 s", "5 min", "11.8 h", "10.0 days" -> minutes
function holdMinutes(text) {
  const [n, unit] = text.split(" ");
  const perUnit = { s: 1 / 60, min: 1, h: 60, day: 1440, days: 1440 }[unit];
  return parseFloat(n) * (perUnit ?? NaN);
}

const { traders, rankedAt } = await callTool("find_traders_to_copy", {
  chain: "solana",
  period: "7d",
  limit: 10,
});

// A copy buys a moment after the trader, so skip wallets that flip in seconds.
const copyable = traders.filter(
  (t) => t.verdict === "good pick" && holdMinutes(t.medianHold) >= 10
);

console.log(`Ranked at ${rankedAt}: ${copyable.length} of ${traders.length} hold coins 10+ minutes`);
for (const t of copyable) {
  console.log(
    `${t.wallet}  +$${t.profitTakenUsd.toLocaleString("en-US")}  ` +
      `${t.wins}/${t.wins + t.losses} won  hold ${t.medianHold}`
  );
}

if (copyable.length) {
  const card = await callTool("trader_report_card", {
    wallet: copyable[0].wallet,
    chain: "solana",
  });
  console.log(`\n${card.wallet}: ${card.verdict}`);
  for (const r of card.rankings) console.log(`  ${r.period}: ${r.rank}, win rate ${r.winRatePct}%`);
  console.log("  cautions:", card.reportCard.cautions.length ? card.reportCard.cautions : "none");
}
Enter fullscreen mode Exit fullscreen mode

Run it with node agent.mjs. This is the real output from 28 November 2026 (ranking computed at 13:58 UTC):

Ranked at 2026-11-28T13:58:11.238Z: 3 of 10 hold coins 10+ minutes
FRT8YuLJ9q8PPX2o4RUiJ9hWL427hNmMJ2M6JdgGgzwK  +$20,040  24/36 won  hold 1.9 h
78XqmCetTNF3JGyftmAm45mBZ3gJGjaLbFBoK2oNSBRr  +$11,109  24/37 won  hold 27 min
6kPn3FEAUxMP5t8Ed5Y65GyZkWMNKwcCMRSqKeMWSfPq  +$12,970  58/131 won  hold 43 min

FRT8YuLJ9q8PPX2o4RUiJ9hWL427hNmMJ2M6JdgGgzwK: good pick
  7 days: #9 of 29, win rate 66.7%
  24 hours: #9 of 30, win rate 57.1%
  cautions: none
Enter fullscreen mode Exit fullscreen mode

The interesting part is the filter. Seven of the ten best Solana wallets that week held a coin for under 10 minutes, some for about a minute. Their numbers look great on a leaderboard, but a copy that arrives a few seconds later pays a different price. An agent that filters on medianHold gives a much more honest answer than "the top of the leaderboard".

You can open any of these wallets to check the trades yourself: FRT8…gzwK, 78Xq…SBRr, 6kPn…SfPq.

Step 4: let wallets vote with a copy squad

Fast traders are hard to copy one by one, but a group is different. build_copy_squad finds wallets that keep buying the same coins and suggests a rule:

curl -s https://dextrading.com/api/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc":"2.0","id":2,"method":"tools/call",
       "params":{"name":"build_copy_squad","arguments":{"chain":"solana","size":3}}}'
Enter fullscreen mode Exit fullscreen mode

Trimmed answer (28 November 2026, about 14:00 UTC):

{
  "squad": "Solana smart money squad",
  "rule": "Buy a coin when 2 of these 3 wallets buy it within 1 hour. When the wallets that made the buy sell, the squad sells the same share.",
  "members": [
    { "wallet": "pwZpq97vcUqG5r79PMYJ2rPdJeVfuqdTaxmNvj5KYMR", "verdict": "good pick" },
    { "wallet": "D9KvWi3CeUc9hAQLpBMDeFwi8NfwiJATMiTFiCepHK3S" },
    { "wallet": "4KeKqfYG3Uq7xZ81AFiYUtuUtiK3Y9SqiYa8BzERQ6ko" }
  ],
  "agreedLately": [
    { "coin": "HPD", "wallets": 2, "minutesToAgree": 45, "changeSinceEntryPct": 267.1 },
    { "coin": "SPSC", "wallets": 2, "minutesToAgree": 0, "changeSinceEntryPct": 258.9 },
    { "coin": "RALLY", "wallets": 2, "minutesToAgree": 5, "changeSinceEntryPct": -87.8 }
  ]
}
Enter fullscreen mode Exit fullscreen mode

Note the honest mix: some agreed buys went up 2.5x, others went down almost 90%. That is what agreement data looks like, and it is exactly the kind of thing your agent should show the user rather than hide.

Ideas to extend it

  • Alerts: poll smart_money_buying_now every 10 minutes and post coins whose signal turns to "strong" into a Telegram or Discord channel.
  • Second opinion: before your bot follows a wallet, run trader_report_card and refuse anything with cautions such as "one coin made most of the profit".
  • Cross-chain digest: call find_traders_to_copy for solana, bsc and base and let the model write a short daily summary.
  • Compare before you pick: compare_traders takes up to 5 wallets and lists the coins they bought in common.

Check the numbers in a browser

Every answer links to a page you can verify by hand:

The data is public on-chain trading, read at the times shown. It is not financial advice, and past profit doesn't promise future profit.

If you build something on top of the server, I'd love to see it in the comments.

Top comments (0)