Plug a remote MCP server into smolagents: crypto trader data in a CodeAgent

smolagents can load every tool of a remote MCP server in one line. This post wires it to a free, read-only server that tracks what top traders buy and sell on pump.fun, fomo and Hyperliquid, then shows the two traps I hit on the way: a version clash in the mcp package, and a leaderboard where the biggest winners are not the ones you want to follow.

I'm the founder of copy.top, the service behind the server, so take the choice of example with that in mind. The code below was run against the live server on 2026-11-25.

The server

Setup for Claude, Cursor, VS Code and the rest: https://copy.top/agents

Install, and the version trap

pip install "smolagents[mcp]" "mcp<2" websockets

With a fresh pip install "smolagents[mcp]" I got mcp 2.3.0, and the first connection failed with ImportError: cannot import name 'streamablehttp_client'. The adapter smolagents uses (mcpadapt 0.1.20) still imports the 1.x name. Pinning mcp<2 fixed it, and the adapter then also wanted websockets. Tested with Python 3.14, smolagents 1.26.0, mcp 1.30.0. If a newer mcpadapt is out when you read this, try without the pin first.

Load the tools and call them directly

MCPClient is a context manager. Inside it you get a list of ordinary smolagents tools, and each one can be called like a function, with no model involved.

import json
from smolagents import MCPClient

SERVER = {"url": "https://copy.top/mcp", "transport": "streamable-http"}

def as_data(result):
    # tools return text; this server puts JSON inside it
    try:
        return json.loads(result)
    except (TypeError, ValueError):
        return result

with MCPClient(SERVER, structured_output=False) as tools:
    by_name = {t.name: t for t in tools}
    print(len(by_name), "tools")

    board = as_data(by_name["get_leaderboard"](platform="pumpfun", limit=5))
    for row in board["traders"]:
        print(row["handle"], row["pnl"], row["fairPlay"])

    hot = as_data(by_name["get_hot_coins"](limit=5))
    for c in hot["coins"]:
        mcap = c.get("mcap")
        print(c["symbol"], c["chain"], c["traders"],
              f"${mcap:,.0f}" if isinstance(mcap, (int, float)) else "n/a")

What it printed for me (trimmed):

16 tools
pf_5ae8d0344ba0   1261819  flagged
pf_c311d04abf73    737798  flagged
pf_93ec43d90703    270206  flagged
pf_2ccf3a09cd0e    254988  flagged
gtsb               244849  watch

Two details are worth handling in your own code:

  1. mcap can be null for a coin that just launched, so format it only when it is a number.
  2. Look at the fairPlay column before anything else.

The leaderboard trap

The top four pump.fun accounts by realized pnl were all flagged that day. Fair play is a verdict built from a trader's own trades: clean, watch (many positions sold within 10 minutes, or selling into the people copying them) or flagged. A ranking by profit alone rewards exactly the behaviour you don't want to copy. So the first thing an agent should learn is to drop flagged rows, and to treat watch with care.

Give the same tools to a CodeAgent

from smolagents import CodeAgent, InferenceClientModel

with MCPClient(SERVER, structured_output=False) as tools:
    agent = CodeAgent(tools=list(tools), model=InferenceClientModel())
    agent.run(
        "Which coins did at least 3 tracked traders buy recently, under $5m market cap? "
        "Skip traders whose fair play is flagged. Answer in 5 lines."
    )

InferenceClientModel reads your HF_TOKEN; any smolagents model class works. To be clear about what I tested: the direct tool calls above were run against the live server, the agent step depends on the model you plug in and I'm not showing its output.

Prompts that use the tools well:

Before you rely on it

The data says what traders did, not what they will do. Memecoins are very risky and most traders lose money; following a strong trader does not remove that risk. Nothing here is financial advice.

Full script, plus setup for other clients: https://copy.top/agents ยท MCP endpoint: https://copy.top/mcp

Script used for this post: smol_copytop.py.