How to build a Solana trading agent with Claude and Cursor (MCP guide)
Build a Solana trading agent by connecting Claude or Cursor to the Anaxer MCP server, which gives the model nine typed tools for live launches, graduations, trades, and prices - the agent reasons over real market data instead of hallucinating it.
A Solana trading agent is an AI system that watches live market data, reasons about it, and decides when to act. The fastest way to build one is to connect Claude or Cursor to the Anaxer MCP server: nine typed tools give the model real launches, graduations, trades, and prices, so it reasons over live data instead of guessing.
What is a Solana trading agent?
A trading agent pairs a language model with live market access. Instead of a hard-coded bot that fires on fixed rules, the agent reads current data, applies judgment you express in plain English - "skip launches with no socials", "only flag graduations that filled their curve in under an hour" - and produces decisions you can act on manually or route to an execution layer.
That flexibility is the appeal. The catch is that a model without live data will happily invent prices and token addresses. Everything below is about closing that gap safely.
Why use MCP instead of pasting API docs into prompts?
You can paste an API reference into a prompt and ask the model to write fetch calls, but that path fails in familiar ways: the model drifts from the docs, invents parameters, and every answer depends on you re-pasting context. The Model Context Protocol fixes this by giving the model a set of typed tools it can call directly. The host (Claude or Cursor) shows the model each tool's schema; the model fills in arguments; the server returns structured JSON.
With @anaxer/mcp that means the model does not write HTTP code at all. When you ask "what launched on pump.fun in the last ten minutes?", it calls list_creations and reasons over the actual events - mints, creators, socials, slots - that came back.
What does the agent architecture look like?
Keep the data layer and the execution layer separate. The model sits between them and is the only part that needs judgment.
Data & signals — Anaxer MCP
- Launches & graduations (list_creations, list_graduations)
- Prices & metadata (get_token_price, get_token_metadata)
- Live tail (tail_stream)
- Structured JSON into the model's context
Decision & execution — your agent
- Claude / Cursor reasons over the data
- Strategy rules in plain English
- Proposed action with reasoning
- Separate signer executes with hard limits
This split is not a limitation - it is the safety model. The MCP server is read-only by design: it never sees a private key and cannot move funds. If a prompt injection or a bad model call happens, the blast radius is a wasted API call, not a drained wallet.
Which MCP tools does a trading agent actually use?
All nine tools are documented in the MCP server reference. Mapped to agent jobs:
| Agent job | Tools |
|---|---|
| Screen new launches | list_creations, get_launchpad_stats |
| Catch momentum shifts | list_graduations, tail_stream on graduations |
| Evaluate a specific token | get_token_metadata, get_token_price, list_token_trades |
| Watch a basket | get_tokens_metadata, get_token_prices (up to 30 mints per call) |
| Observe live flow | tail_stream on trades, creations, or prices |
Two behaviors matter for agent design. List tools return one page (default 20 items) and a next cursor, which keeps the model's context small - the agent pages only when it needs to. And tail_stream turns the live WebSocket into a bounded collect: it gathers up to maxEvents (default 20, cap 100) or until timeoutMs (default 10s, cap 30s), whichever hits first, then returns the batch. The model gets a taste of live flow without holding a connection open.
How do I set up the MCP server in Claude or Cursor?
Setup is the same three lines everywhere: run npx -y @anaxer/mcp with your API key in the environment. In Cursor that lives in .cursor/mcp.json; in Claude Desktop it goes in claude_desktop_config.json; Claude Code uses the same mcpServers shape.
{
"mcpServers": {
"anaxer": {
"command": "npx",
"args": ["-y", "@anaxer/mcp"],
"env": {
"ANAXER_API_KEY": "YOUR_KEY"
}
}
}
}Node.js 20 or newer is required, and the key comes from the console after you create a free account. Step-by-step walkthroughs with first prompts and troubleshooting: Cursor setup and Claude setup.
What prompts turn the model into a market analyst?
Once the tools are connected, strategy work is conversational. Real prompts that map cleanly onto the tools:
- "List the last 20 pump.fun launches. Flag any where the creator has launched before and the token has a website and Twitter."
- "Which tokens graduated in the past hour? For each, how long did the bonding curve take and how much liquidity moved to PumpSwap?"
- "Tail the trades stream for 15 seconds filtered to buys over $500 and summarize which mints are seeing the most aggressive flow."
- "Here are 10 mints from my watchlist - batch their prices and metadata and tell me which moved more than 20% since I last asked."
Each of these becomes one or two tool calls plus reasoning. The pattern to build toward is a screening loop: the agent pulls fresh launches, applies your written criteria, and returns a shortlist with its reasoning attached - which you can audit before anything else happens.
Write your strategy as a system prompt
Put your rules in the host's project instructions (Cursor rules, Claude project instructions) rather than repeating them per chat: entry criteria, red flags, position limits, and the instruction to always show the data behind a recommendation. The agent then applies the same discipline every session.
How does the agent execute trades?
Anaxer deliberately stays out of execution - the MCP tools cannot sign or submit anything. When you are ready to close the loop, add a third component: a small execution service that holds the wallet and exposes exactly one action ("swap X SOL into mint Y") behind hard limits you enforce in code, using a swap aggregator or DEX API of your choice.
The division of responsibility keeps risk legible:
- Anaxer MCP answers "what is happening on-chain right now?"
- The model answers "given my strategy, what should I do?"
- Your signer answers "is this action within limits?" - max position size, max daily spend, allowlisted venues - and only then submits.
Start with the agent in advisory mode: it proposes, you click. Graduate to automatic execution only after you have watched its reasoning across enough market conditions to trust the guardrails - and even then, cap what any single decision can spend.
When should I graduate from MCP to the SDK?
MCP is the right interface while a model is in the loop. It is the wrong interface for the always-on part of a strategy: tail_stream is bounded by design, and each tool call costs a model round-trip you do not want between a graduation event and your reaction to it.
The pattern that works: prototype and refine the strategy conversationally through MCP, then implement the latency-critical core as a long-lived process with @anaxer/sdk - persistent WebSocket subscriptions, automatic reconnects, typed events - and keep the agent for research, monitoring, and strategy changes. Both surfaces share the same event shapes, so what the agent learned transfers directly. For production connection handling, the Solana WebSocket streams guide covers the details.
Next steps
Get a free API key, drop the config block into Cursor or Claude, and ask for the last 20 launches - you will have live Solana data in the model's context in under five minutes. Then follow the Cursor walkthrough or the Claude walkthrough for first prompts and troubleshooting, and see the pump.fun API overview for everything the data layer covers. When the strategy needs trades and prices, pricing is flat per plan - no compute-unit math.
Frequently asked questions
Can Claude or Cursor trade Solana tokens directly through Anaxer?
No. The Anaxer MCP server exposes nine read-only data tools - prices, launches, graduations, trades, and a bounded live stream tail. It never holds keys or signs transactions. Execution belongs in a separate component you control, typically a small signer service the agent calls with strict limits.
What is the Anaxer MCP server?
@anaxer/mcp is an official local MCP (Model Context Protocol) server that runs over stdio via npx. It gives Claude Desktop, Claude Code, Cursor, and other MCP hosts typed tools for Solana token metadata, prices, pump.fun launches, graduations, DEX trades, and launchpad stats.
Is building a Solana trading agent with MCP free?
You can start free. The Anaxer free plan includes the creations and graduations streams plus a REST allowance, with no card required, which is enough to build and test a launch-screening agent. Live trades and prices require a paid plan.
Which AI tools work with the Anaxer MCP server?
Any MCP host that can launch a local stdio server: Claude Desktop, Claude Code, and Cursor are documented first-class, and other hosts that support the standard mcpServers config shape work the same way.
Do I need my own Solana RPC node to build a trading agent?
No. Anaxer parses pump.fun and PumpSwap activity into structured JSON and serves it over REST and WebSocket. The MCP server wraps that API, so your agent consumes clean events without touching an RPC node, Geyser plugin, or program logs.
When should I use the TypeScript SDK instead of the MCP server?
Use @anaxer/mcp when a human or agent is in the loop - research, screening, alerting, strategy work in Claude or Cursor. Use @anaxer/sdk for the always-on part: a long-lived bot process that holds a persistent WebSocket, reconnects automatically, and reacts in milliseconds without a model call.
Start streaming Solana data
Anaxer gives you real-time pump.fun and PumpSwap streams and REST APIs on a flat plan. The free tier needs no card.
Written by Anton Gilborn · Senior Platform Engineer, Anaxer
Anton is a senior platform engineer at Anaxer, where he builds the real-time streaming infrastructure behind its Solana data API - token launches, graduations, DEX trades, prices, and transfers. He writes about low-latency streaming architecture and building fast on-chain apps.
Keep reading
Ask Claude about pump.fun launches: MCP setup for Claude Desktop and Claude Code
Claude makes a strong pump.fun analyst once it can see the chain. One config block connects Claude Desktop or Claude Code to live launches, graduations, and stats - here is the setup and the analysis prompts that work.
Give Cursor live Solana data with the Anaxer MCP server
Five lines of JSON connect Cursor's agent to live Solana market data. Here is the setup, the first prompts to try, and the fixes for every common failure.
Yellowstone gRPC vs parsed Solana streams: which do you need?
It was never polling vs streaming - everyone serious streams. The real question is whether you decode a raw Yellowstone gRPC firehose yourself or consume parsed events. Here is how to choose.