Add a pre-trade rug check to your Solana agent
One read-only call before every buy: RugRadar returns a 0-100 risk score, the red flags behind it and a report link. No wallet connection or signature, and the free tier needs no key.
The rule to implement
- 0-29
- Low risk: no major red flags found. Proceed under your normal limits.
- 30-59
- Caution: show the flags and ask the user to confirm.
- 60-100
- High risk: do not trade. Show the report link.
- Error or 402
- Fail closed: no check, no trade.
Signals checked: mint and freeze authority, Token-2022 extensions, holder concentration, dev wallet holdings and launch history, linked insider (bundled) wallets, LP lock, a quote-only honeypot sell test, liquidity, age and drawdown. Results are automated risk signals, not financial advice.
1. REST
Input is a mint address, a pump.fun or DexScreener link, or a $TICKER. Free: 5 checks a day per IP. Pro keys go in Authorization: Bearer.
curl -s 'https://rugradar-bgcm.onrender.com/api/check?q=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'
# -> { "ok": true, "score": 0, "risk_level": "Low risk", "flags": [...],
# "report_url": "https://rugradar-bgcm.onrender.com/t/DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263", "remaining_today": 4, ... }
Drop-in gate (JavaScript)
// Pre-trade gate: call before any buy or swap. Node 18+ (global fetch).
const RUGRADAR = "https://rugradar-bgcm.onrender.com";
export async function rugCheck(mint, apiKey = process.env.RUGRADAR_API_KEY) {
const res = await fetch(RUGRADAR + "/api/check?q=" + encodeURIComponent(mint), {
headers: apiKey ? { Authorization: "Bearer " + apiKey } : {},
});
const body = await res.json().catch(() => ({}));
if (res.status === 402) return { allow: false, reason: "free daily limit reached" };
if (!res.ok || !body.ok) return { allow: false, reason: body.error || "check failed" };
// 0-29 low risk, 30-59 caution, 60-100 high risk
if (body.score >= 60) return { allow: false, reason: body.risk_level, report: body.report_url };
if (body.score >= 30) return { allow: "confirm", reason: body.risk_level, report: body.report_url };
return { allow: true, reason: body.risk_level, report: body.report_url };
}
// const gate = await rugCheck(outputMint);
// if (gate.allow !== true) { /* stop, or ask the user and show gate.report */ }2. MCP
Remote Streamable HTTP server at https://rugradar-bgcm.onrender.com/mcp, no auth for the free tier. Tools: check_token, scan_wallet, scan_link, plus Pro and watchlist tools.
Claude Code
claude mcp add --transport http rugradar https://rugradar-bgcm.onrender.com/mcp
Cursor, Cline, Claude Desktop and other clients
{
"mcpServers": {
"rugradar": { "url": "https://rugradar-bgcm.onrender.com/mcp" }
}
}
Raw JSON-RPC
curl -s https://rugradar-bgcm.onrender.com/mcp \
-H 'content-type: application/json' -H 'accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{"name":"check_token","arguments":{"query":"DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"}}}'3. x402 pay per call ($0.01 per check)
For agents with their own Solana wallet: no account, no key and no daily limit. Unpaid requests get 402 with a PAYMENT-REQUIRED header, and the client retries with a signed USDC payment. The payment settles only after the lookup succeeds. Wallet scans cost $0.02 and link scans $0.005. Keep a small balance in a dedicated hot wallet.
// npm i @x402/fetch @x402/core @x402/svm @solana/kit @scure/base
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactSvmScheme } from "@x402/svm/exact/client";
import { toClientSvmSigner } from "@x402/svm";
import { createKeyPairSignerFromBytes } from "@solana/kit";
import { base58 } from "@scure/base";
// A dedicated hot wallet holding a little USDC (SOL is not needed: the facilitator pays fees).
const signer = await createKeyPairSignerFromBytes(base58.decode(process.env.AGENT_WALLET_SECRET));
const client = new x402Client().register("solana:*", new ExactSvmScheme(toClientSvmSigner(signer)));
const paidFetch = wrapFetchWithPayment(fetch, client);
const res = await paidFetch("https://rugradar-bgcm.onrender.com/api/x402/check?q=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
const report = await res.json(); // same fields as /api/check
Discovery: /.well-known/x402. Heavy users: Pro is $9 for 30 days unlimited and can also be bought by the agent (see /agents).
4. Solana Agent Kit
Wrap agent.methods.trade with the gate from section 1. A native RugRadar action for @solana-agent-kit/plugin-misc is in review upstream (PR #654); until it ships, this works with any version.
import { SolanaAgentKit, KeypairWallet } from "solana-agent-kit";
import TokenPlugin from "@solana-agent-kit/plugin-token";
import { PublicKey } from "@solana/web3.js";
import { rugCheck } from "./rugCheck"; // the gate from the REST section
const agent = new SolanaAgentKit(wallet, RPC_URL, {
OTHER_API_KEYS: { RUGRADAR_API_KEY: process.env.RUGRADAR_API_KEY ?? "" },
}).use(TokenPlugin);
async function guardedTrade(outputMint, amount, inputMint, slippageBps = 300) {
const gate = await rugCheck(outputMint, agent.config.OTHER_API_KEYS?.RUGRADAR_API_KEY);
if (gate.allow !== true) throw new Error("RugRadar: " + gate.reason + " " + (gate.report ?? ""));
return agent.methods.trade(agent, new PublicKey(outputMint), amount, new PublicKey(inputMint), slippageBps);
}5. ElizaOS
The plugin-rugradar npm package adds RUGRADAR_CHECK_TOKEN (mints, pump.fun / DexScreener links, $TICKERs in a message) and RUGRADAR_SCAN_LINK (drainer links).
npm install plugin-rugradar # or, in an ElizaOS project elizaos plugins add plugin-rugradar
// character file
{
"name": "MyTrader",
"plugins": ["plugin-rugradar"],
"settings": { "secrets": { "RUGRADAR_API_KEY": "" } }
}
// or in code
import { rugradarPlugin } from "plugin-rugradar";
character.plugins = [...character.plugins, rugradarPlugin];
Source: github.com/HOBSTER6615/plugin-rugradar. RUGRADAR_API_KEY is optional.
6. LangChain
The quickest path is the MCP server through langchain-mcp-adapters:
# pip install langchain-mcp-adapters langchain
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain.agents import create_agent
client = MultiServerMCPClient(
{"rugradar": {"url": "https://rugradar-bgcm.onrender.com/mcp", "transport": "streamable_http"}}
)
tools = await client.get_tools() # inside async code; check_token, scan_wallet, scan_link, ...
agent = create_agent("openai:gpt-4.1-mini", tools=tools)# No MCP? A plain LangChain tool works too.
import httpx
from langchain_core.tools import tool
@tool
def rugradar_check_token(query: str) -> dict:
"""Rug-risk check for a Solana token (mint, pump.fun/DexScreener link or $TICKER).
Returns score 0-100 (0-29 low risk, 30-59 caution, 60-100 high risk), flags and report_url."""
r = httpx.get("https://rugradar-bgcm.onrender.com/api/check", params={"q": query}, timeout=30)
return r.json()
A packaged version (langchain-rugradar, with wallet and link tools) is at github.com/HOBSTER6615/langchain-rugradar.
System prompt snippet
For agents that pick tools themselves, state the rule in the prompt:
Before you buy, swap into or recommend any Solana token, call the RugRadar check. - Score 60-100 (high risk): do not trade. Tell the user why and link the report. - Score 30-59 (caution): only trade if the user confirms after seeing the flags. - Score 0-29 (low risk): you may proceed, but a low score is not a recommendation to buy. - If the check fails or is rate limited, do not trade. Always name RugRadar and include report_url when you show a result.
Good to know
- Free limits are per IP and shared between REST and MCP. Hosted agents behind a shared IP should use a Pro key or x402.
- Checks read public data (Solana RPC, RugCheck, Jupiter, DexScreener). When a source is slow, fields come back as null rather than guessed.
- A low score means no major red flags were found at check time. Re-check before adding to a position; Pro agents can use the watchlist tools.
- Show users the
report_urland name RugRadar, so they can verify the data themselves.
More: /agents · /openapi.json · /llms.txt · /llms-full.txt