Dev.to AI πŸ€– Ai πŸ‘ 0 πŸ“– 6 min read

Check if a Solana token is a rug before your bot buys it (pay-per-call API, no signup)

Disclosure: I built and operate the two services in this post (RugShield and Wallet Doctor, run by ManHourPlan). RugShield has a free tier and paid credit packs; Wallet Doctor charges per call in USDC. Every output below

Disclosure: I built and operate the two services in this post (RugShield and Wallet Doctor, run by ManHourPlan). RugShield has a free tier and paid credit packs; Wallet Doctor charges per call in USDC. Every output below came from the live endpoints while I was writing this (21 Nov 2026). Nothing here is financial advice.

Most Solana trading bots buy first and ask questions never. A token gets boosted on DexScreener, the bot sees volume, it buys, and three minutes later the dev mints another billion tokens or freezes your account.

A pre-buy check takes one API call, so it's worth adding. This post shows two ways to put one in front of your bot's buy function:

  1. RugShield: a hosted MCP server. Your agent connects to a URL, gets 25 free credits with no signup, and calls scan_token.
  2. Wallet Doctor: a plain HTTP API paid per call with x402 (USDC on Base or Solana). No account and no API key; your bot's wallet pays $0.001 for a mint check.

What a "rug check" can and can't tell you

You can check these on-chain and market facts before you buy:

Check Why it matters
Mint authority still set The dev can print unlimited supply and dump on you
Freeze authority still set The dev can freeze your token account so you can't sell
Top-10 holder % A few wallets can crash the price in one block
Liquidity (USD) and pair age Thin or minutes-old pools are where most rugs happen

What it can't tell you: whether the team is honest, whether the chart will go up, or what happens after you buy. Treat a scan as a filter that removes obvious traps. It doesn't guarantee anything.

Option 1: RugShield over MCP (free to start)

RugShield is a remote MCP server (Streamable HTTP):

https://manhourplan.com/shield/mcp?ref=devto_b

Connect it

Claude Code

claude mcp add --transport http rugshield "https://manhourplan.com/shield/mcp?ref=devto_b"

Cursor (~/.cursor/mcp.json) or any client that takes a mcpServers block:

{
  "mcpServers": {
    "rugshield": { "url": "https://manhourplan.com/shield/mcp?ref=devto_b" }
  }
}

VS Code (.vscode/mcp.json):

{
  "servers": {
    "rugshield": { "type": "http", "url": "https://manhourplan.com/shield/mcp?ref=devto_b" }
  }
}

Get a key and scan

The agent calls register_free_key once and gets a key with 25 credits. Then it calls scan_token with a mint address and that key. Each scan costs 1 credit.

Here's the real result for BONK (DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263), trimmed slightly:

{
  "token": "DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263",
  "safety_score": 100,
  "verdict": "LOW_RISK",
  "flags": [],
  "market": {
    "name": "Bonk", "dex": "orca",
    "liquidity_usd": 199253.49, "volume_24h": 400276.2,
    "pair_age_hours": 34238.2
  },
  "security": {
    "mintable": false, "freezable": false,
    "closable": false, "balance_mutable": false,
    "holder_count": "1021083"
  },
  "holders": { "top_holder_pct": 10.4, "top10_holder_pct": 36.22, "lp_locked_pct": null },
  "disclaimer": "Automated heuristic scan. Not financial advice. DYOR."
}

And here's a pump.fun token that trending_tokens returned a few minutes later (I've left the name out):

{
  "safety_score": 90,
  "verdict": "LOW_RISK",
  "flags": ["pair younger than 24h (-10)"],
  "market": { "dex": "pumpswap", "liquidity_usd": 62552.37, "pair_age_hours": 0.8 },
  "security": { "mintable": false, "freezable": false },
  "holders": { "top_holder_pct": 2.15, "top10_holder_pct": 21.1 }
}

That second result is the reason for the next section. The authorities are revoked, so the score is high. But the pool is 48 minutes old. The score is a summary. Your bot should make its own decision from the raw fields.

Turn the scan into a buy rule

Don't buy just because verdict == "LOW_RISK". Write hard rules against the raw fields and pick thresholds that fit your risk:

def ok_to_buy(scan: dict) -> tuple[bool, str]:
    sec, mkt, hold = scan["security"], scan["market"], scan["holders"]
    if sec.get("mintable"):    return False, "mint authority still set"
    if sec.get("freezable"):   return False, "freeze authority still set"
    if (mkt.get("pair_age_hours") or 0) < 24:   return False, "pool younger than 24h"
    if (mkt.get("liquidity_usd") or 0) < 50_000: return False, "liquidity under $50k"
    if (hold.get("top10_holder_pct") or 100) > 50: return False, "top-10 hold over 50%"
    return True, "passed"

Run that before every buy, and log the reason when you skip. You'll learn quickly which rule saves you the most.

The server also has scan_tokens (up to 20 mints per call, 1 credit each), trending_tokens (the latest boosted tokens on DexScreener) and check_credits.

When the 25 free credits run out: credit packs are $9 for 1,000 scans, $29 for 10,000 and $99 for 100,000. You pay by card through Stripe. To top up the key you already have, open https://manhourplan.com/credits/checkout?product=rugshield&pack=9&api_key=YOUR_KEY (use pack=29 or pack=99 for the bigger packs). Leave api_key off and you'll get a new key with the pack. Pricing is also on the RugShield page.

Option 2: Wallet Doctor over x402 (pay per call, no signup)

Some bots shouldn't carry an API key at all. For example, an autonomous agent with its own wallet that you don't want to sign up for services. That's what x402 is for: the server answers 402 Payment Required with its price, the client pays in USDC, and then it retries the request.

Wallet Doctor's mint check:

curl -i "https://wallet-doctor-x402.m-zikriz.workers.dev/v1/token_safety?mint=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263"

Without payment you get this real response (trimmed):

HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6Mi...
{
  "x402Version": 2,
  "resource": {
    "description": "Token mint safety: mint/freeze authority, supply, decimals; top-10 holder concentration when the public RPC allows it"
  },
  "accepts": [
    { "scheme": "exact", "network": "eip155:8453",
      "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "amount": "1000" },
    { "scheme": "exact", "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
      "asset": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", "amount": "1000",
      "extra": { "feePayer": "CjNFTjvBhbJJd2B5ePPMHRLx1ELZpa8dwQgGL727eKww" } }
  ],
  "error": "PAYMENT-SIGNATURE header is required"
}

amount: "1000" is in USDC base units (6 decimals), so $0.001 per check, on Base or Solana. Any x402 v2 client handles the rest: it reads the accepts list, signs a USDC payment from your bot's wallet, and retries with the PAYMENT-SIGNATURE header (older clients that send X-PAYMENT work too). Payment settles through the PayAI facilitator. If a call fails upstream, it isn't settled, so you aren't charged.

With the official TypeScript client it's a wrapped fetch (Base shown; @x402/svm does the same for Solana):

import { wrapFetchWithPaymentFromConfig } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm";
import { privateKeyToAccount } from "viem/accounts";

const pay = wrapFetchWithPaymentFromConfig(fetch, {
  schemes: [{ network: "eip155:8453", client: new ExactEvmScheme(privateKeyToAccount(process.env.BOT_KEY as `0x${string}`)) }],
});

const res = await pay("https://wallet-doctor-x402.m-zikriz.workers.dev/v1/token_safety?mint=DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263");
console.log(await res.json());

The other Wallet Doctor endpoints, all GET with one query parameter:

Endpoint Param Price What it returns
/v1/balance wallet $0.0001 SOL + USDC balance
/v1/txtrace signature $0.0005 Status, slot, fee, SOL balance changes, first 20 log lines for one tx
/v1/approvals wallet $0.0005 Active SPL Token / Token-2022 delegates
/v1/token_safety mint $0.001 Mint/freeze authority, supply, decimals (top-10 when the RPC allows)
/v1/drain_forensics wallet $0.0025 Last 25 txs, failed ones flagged, plus active delegates

approvals is worth calling on your bot's own wallet every so often. A delegate you didn't expect is how many wallet drains begin.

The machine-readable catalog lives at /.well-known/x402.json, and the OpenAPI spec is at /openapi.json. More details are on the Wallet Doctor page.

Which one should you use?

  • Prototyping, or your agent already speaks MCP (Claude, Cursor, VS Code): use RugShield. It's free for 25 scans and gives you a market + security + holders snapshot in one call.
  • Autonomous bot with its own wallet, no accounts allowed: use Wallet Doctor over x402. You pay per call and need no key.
  • Either way: make the buy decision in your own code from the raw fields, not from a single score.

Limits worth knowing

  • Data comes from public sources (Solana RPC, DexScreener, RugCheck and GoPlus for RugShield) at the moment you call. A token can change after you scan it.
  • lp_locked_pct is often null on newer AMMs where LP isn't a token you can lock. Treat null as "unknown", not "safe".
  • Wallet Doctor's top-10 holder field is null when the public RPC refuses that query.
  • Heuristic scores produce false positives and false negatives. Keep your own rules, and keep your position sizes small.

Questions or bugs: [email protected]. Full list of our agent tools: manhourplan.com/tools.

πŸ“° Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.