Most MCP tutorials stop at "add this JSON to your config and ask the model a question". That works, but it hides what actually travels over the wire. In this post we talk to a remote MCP server directly from Python, with the standard library only, and use it to answer a concrete question: who are the most profitable pump.fun traders right now, and what are tracked traders buying?

The server is the one I run, copy.top, at https://copy.top/mcp. It is read-only, free, and needs no key (20 calls a minute without one). Everything below was run against it today.

What "streamable HTTP" means in practice

A remote MCP server is one URL. Every message is a JSON-RPC 2.0 object sent with a POST. The server answers either with plain JSON or with a short server-sent events stream, so the client has to accept both:

Accept: application/json, text/event-stream 

The first answer may carry an Mcp-Session-Id header. If it does, you send it back on every later request. That is the whole transport.

The conversation always starts the same way:

  1. initialize, where the client says which protocol version it speaks
  2. notifications/initialized, a notification (no id, no answer expected)
  3. then any number of tools/list and tools/call

The client, in about 40 lines

"""Ask the copy.top MCP server who the top pump.fun traders are and what they buy. Standard library only. Run: python3 top_traders.py""" import json import urllib.request MCP_URL = "https://copy.top/mcp" HEADERS = { "Content-Type": "application/json", "Accept": "application/json, text/event-stream", "User-Agent": "mcp-tutorial/1.0", } session_id = None next_id = 0 def rpc(method, params=None, notify=False): """Send one JSON-RPC message over streamable HTTP and return its result.""" global session_id, next_id msg = {"jsonrpc": "2.0", "method": method, "params": params or {}} if not notify: next_id += 1 msg["id"] = next_id headers = dict(HEADERS) if session_id: headers["Mcp-Session-Id"] = session_id req = urllib.request.Request(MCP_URL, json.dumps(msg).encode(), headers) with urllib.request.urlopen(req, timeout=30) as resp: session_id = resp.headers.get("Mcp-Session-Id") or session_id body = resp.read().decode() if notify or not body.strip(): return None if body.lstrip().startswith("{"): data = json.loads(body) else: # server-sent events: keep the last "data:" line lines = [l[5:].strip() for l in body.splitlines() if l.startswith("data:")] data = json.loads(lines[-1]) if "error" in data: raise RuntimeError(data["error"]) return data["result"] def call(tool, **arguments): result = rpc("tools/call", {"name": tool, "arguments": arguments}) text = "".join(c.get("text", "") for c in result["content"] if c["type"] == "text") try: return json.loads(text) except ValueError: return text init = rpc("initialize", { "protocolVersion": "2025-06-18", "capabilities": {}, "clientInfo": {"name": "tutorial", "version": "1.0"}, }) rpc("notifications/initialized", notify=True) print("server:", init["serverInfo"]["name"], init["serverInfo"].get("version")) tools = rpc("tools/list")["tools"] print("tools:", ", ".join(t["name"] for t in tools)) board = call("get_leaderboard", platform="pumpfun", limit=10) clean = [t for t in board["traders"] if t.get("fairPlay") != "flagged"] print(f"\n{len(clean)} of {len(board['traders'])} top pump.fun traders are not flagged:") for t in clean[:5]: print(f" {t['name'] or t['handle']:<20} pnl ${t['realized']:>10,.0f} win {t['winRate']:.0%} trades {t['closed']}") hot = call("get_hot_coins", limit=5) print("\nwhat tracked traders are buying now:") for c in hot["coins"][:5]: print(f" {c['symbol']:<10} {c['chain']:<10} {c['traders']:>3} traders mcap ${c['mcap'] or 0:,.0f}") 

A few details worth pointing out:

  • rpc() handles both answer formats. When the body is an event stream, the JSON lives on the data: lines and the last one is the answer.
  • Notifications get no id. The server answers them with an empty body, so we return early.
  • A tool result is a list of content blocks. This server puts JSON in a text block, which is why call() tries json.loads on it.
  • Set a User-Agent. Some servers sit behind a CDN that rejects the default Python one.

What it prints

server: copy.top 0.2.3 tools: search, get_trader, get_leaderboard, get_token, get_theses, get_hot_coins, get_live_trades, get_alerts, get_hot_index, get_money_flow, get_dex_paid, hl_get_traders, hl_get_trader, hl_get_markets, hl_get_market_read, hl_get_calls 5 of 10 top pump.fun traders are not flagged: supermandev pnl $ 726,823 win 97% trades 31 TarShortRiver pnl $ 254,988 win 54% trades 57 gatsby pnl $ 244,849 win 38% trades 13 pikachu34 pnl $ 241,712 win 50% trades 22 UpbeatAloudChef pnl $ 164,637 win 54% trades 52 

Then one line per coin that tracked traders are buying: symbol, chain, how many of them bought it, market cap. Your numbers will be different: the leaderboard is a 30 day window and moves every few hours.

Why the fair play filter matters

Half of the top 10 was dropped. The leaderboard sorts by realized pnl, and a big pnl is not the same as a trader you want to follow. Each trader carries a fairPlay verdict computed from their own trades: clean, watch (many trades sold within 10 minutes, or sells right after their copiers buy) or flagged. The badges field says why, for example "100% of trades sold within 10 min". If your agent recommends traders to a human, filter on it.

Two other fields that trip people up:

  • pnl is realized profit over the window: closed positions plus what was already sold from open ones. unrealized is given apart and never added in.
  • roi is realized pnl divided by what the trader put in.

Plugging the same server into an assistant

Once you have seen the raw calls, the client configs are less magic. They all point at the same URL.

Claude Code:

claude mcp add --transport http copytop https://copy.top/mcp 

Cursor (~/.cursor/mcp.json):

{ "mcpServers": { "copytop": { "type": "http", "url": "https://copy.top/mcp" } } } 

Claude.ai, Claude Desktop and ChatGPT: settings, connectors, add a custom connector, paste https://copy.top/mcp. The install page for every other client is at https://copy.top/agents.

Then ask in plain words: "who are the 5 best pump.fun traders this week, and are any of them flagged?" The model will call get_leaderboard exactly like the script did.

Where to go from here

  • search resolves a name, @handle, $ticker or address into the handle the other tools expect. Start there.
  • get_live_trades takes up to 25 trader handles and a since cursor, so one call follows a whole watchlist.
  • get_alerts returns events (several top traders in the same coin, big trades, new theses) with a cursor you pass back once a minute.

A word of caution, since this is market data: the numbers describe what happened, not what will happen. Memecoins are extremely risky, most traders lose money, and copying a good one does not remove that risk. Nothing here is financial advice.

I am the founder of copy.top. This post was written with AI assistance; the code was run against the live server before publishing.