Back to Browse

X402 Examples MCP Server

Developer ToolsLow Risk10.0MCP RegistryLocal
Free

Server data from the Official MCP Registry

Hyperliquid prices, regime, vol, funding, dip/FOMO checks, plus Fear & Greed; USDC per call (x402)

About

Hyperliquid prices, regime, vol, funding, dip/FOMO checks, plus Fear & Greed; USDC per call (x402)

Security Report

10.0
Low Risk10.0Low Risk

Valid MCP server (2 strong, 2 medium validity signals). 2 code issues detected. No known CVEs in dependencies. Package registry verified. Imported from the Official MCP Registry. 2 finding(s) downgraded by scanner intelligence.

11 files analyzed · 3 issues found

Security scores are indicators to help you make informed decisions, not guarantees. Always review permissions before connecting any MCP server.

Permissions Required

This plugin requests these system permissions. Most are normal for its category.

env_vars

Check that this permission is expected for this type of plugin.

HTTP Network Access

Connects to external APIs or services over the internet.

What You'll Need

Set these up before or after installing:

Set to 1 to pay for calls. Without it every tool is a dry run that only reports the price.Optional

Environment variable: X402_PAY

Path to a file with the private key of a dedicated wallet holding a few dollars of USDC on BaseOptional

Environment variable: PRIVATE_KEY_FILE

Private key of a dedicated wallet (alternative to PRIVATE_KEY_FILE)Required

Environment variable: PRIVATE_KEY

Spending cap per session in USDOptional

Environment variable: MAX_SPEND_USD

How to Install

Add this to your MCP configuration file:

{
  "mcpServers": {
    "io-github-swaphunt-swaphunt-mcp": {
      "env": {
        "X402_PAY": "your-x402-pay-here",
        "PRIVATE_KEY": "your-private-key-here",
        "MAX_SPEND_USD": "your-max-spend-usd-here",
        "PRIVATE_KEY_FILE": "your-private-key-file-here"
      },
      "args": [
        "swaphunt-mcp"
      ],
      "command": "uvx"
    }
  }
}

Documentation

View on GitHub

From the project's GitHub README.

SwapHunt x402 examples

SwapHunt's x402 API sells crypto market context per call (prices, market regime, volatility, funding, coin strength vs BTC and anti-FOMO sanity checks computed from Hyperliquid perpetuals, alt season, the Crypto Fear & Greed Index, the halving countdown, trading session and weekend liquidity), paid in USDC on Base, Polygon, Arbitrum or Solana with the x402 protocol. No account, no API key: the payment is the credential.

The examples pay on Base. Every endpoint has the same price on all four networks; see docs/endpoints.md for the network list.

These examples get you from zero to a paid call in a few minutes, and show how to build on it.

Examples

ExampleLanguageWhat it doesCost per run
quickstartPython, TypeScriptOne paid call to /v1/market/fear-greed$0.001
daily-briefPythonFear & Greed with its 1, 7 and 30-day changes, halving countdown, trading session and weekend liquidity, summarized by an LLM and delivered to stdout, Telegram, Discord or email$0.005 + LLM tokens
mcp-serverPython (uvx swaphunt-mcp)30 SwapHunt tools (Hyperliquid prices, regime, volatility, funding, coin strength, dip/breakout/FOMO checks; Fear & Greed) for Claude and other AI agents, paid per call with a session cap$0.001-0.005 per tool call
alert-botPythonChecks one price on an interval and messages you on Telegram when it crosses a threshold$0.001 per check

The API has 30 paid endpoints, from $0.001 to $0.005 per call; the live list with parameters is in the OpenAPI docs. Prices, parameters and example responses for the core endpoints: docs/endpoints.md.

Fear & Greed data comes from Alternative.me, which asks for attribution next to its data. The responses include an attribution field with the text to show.

Quickstart

You need a wallet with a few dollars of USDC on Base mainnet (see Security).

git clone https://github.com/swaphunt/x402-examples.git
cd x402-examples/quickstart/python
python3 -m venv .venv
.venv/bin/pip install -r requirements.txt

.venv/bin/python quickstart.py          # dry run: shows the price, pays nothing

cp ../../.env.example ../../.env        # put your PRIVATE_KEY in ../../.env
set -a; . ../../.env; set +a
.venv/bin/python quickstart.py --pay    # pays $0.001

Output of the paid call:

Price: $0.001 USDC on eip155:8453, payTo 0x<swaphunt-address>
200 {'value': 30, 'label': 'Fear', 'timestamp': '2026-10-31T00:00:00', 'source': 'alternative.me', ...}
This run cost $0.001 (tx https://basescan.org/tx/0x<transaction-hash>)

The TypeScript version and a 10-line minimal snippet are in quickstart/.

How x402 works

  1. You call an endpoint without paying and get 402 Payment Required, with the price, network and receiving address in the PAYMENT-REQUIRED header.
  2. Your x402 client signs a USDC transfer for exactly that amount.
  3. You retry with the signed payment. A facilitator settles it on Base, and you get 200 with the data and the transaction hash.

The official x402 client libraries (Python, TypeScript) do steps 2 and 3 for you.

Security

  • Use a dedicated wallet with a few dollars of USDC on Base mainnet. Never your main wallet. The facilitator pays the gas, so the wallet only needs USDC.
  • Dry run by default. Every example shows what it would pay and stops. It only pays with --pay or X402_PAY=1.
  • Spending cap. Every example refuses to spend more than MAX_SPEND_USD per run (default $0.10) and prints what the run cost.
  • Never commit keys. Put PRIVATE_KEY and API keys in .env (ignored by git), using .env.example as the template.

Links

License

MIT

Nothing here is investment advice.

Reviews

No reviews yet

Be the first to review this server!