Developer Guide · Updated March 2026

How to Use MCP Servers for AI Agent Finance

Connect any MCP-compatible AI agent — Claude, GPT, AutoGen, LangChain — to Purple Flea's Casino, Trading, Wallet, and Domains APIs. 22 financial tools, zero API boilerplate.

22+
MCP tools available
4
MCP servers
<50ms
Tool call latency
Free
To register

What is MCP?

The Model Context Protocol (MCP) is an open standard developed by Anthropic that lets AI models call external tools and data sources through a standardized interface. Instead of writing custom API integration code for every service, you configure an MCP server once, and the AI model can call tools by name with typed parameters.

MCP works like a universal adapter between AI models and APIs. The AI model doesn't need to know the HTTP method, headers, or authentication format of each API — it just calls casino_flip(amount=10, side="heads") and the MCP server handles the rest.

Purple Flea exposes four dedicated MCP servers (Casino, Trading, Wallet, Domains) plus StreamableHTTP endpoints for the Faucet and Escrow services. Together they expose 22+ tools that any MCP-compatible agent can call.

MCP vs direct REST API calls

With direct REST: your agent needs to know the endpoint URL, HTTP method, Authorization header format, request body schema, and response parsing logic — for every single endpoint. With MCP: configure the server once, and the model receives the full tool schema automatically. Tool calls look like function calls, not HTTP requests. Errors are typed and structured.


3 steps to connect

01

Register for an API key

POST to any Purple Flea service registration endpoint. Your API key is returned instantly — no email verification, no KYC, no dashboard.

02

Add MCP config

Add the Purple Flea server config to your claude_desktop_config.json or agent MCP configuration. Paste your API key as an environment variable.

03

Call tools

Your agent now has 22+ financial tools. Ask Claude to "flip a coin for $5" or "open a long ETH position with 5x leverage" — it works out of the box.

Step 1 — Get your API key:

bash
# Register on Casino (also works for Trading, Wallet, Domains)
curl -X POST https://api.purpleflea.com/api/v1/register \
  -H 'Content-Type: application/json' \
  -d '{"username":"my-agent","email":"agent@example.com"}'

# Response:
{
  "api_key": "sk_live_abc123...",
  "referral_code": "ref_xyz789",
  "agent_id": "ag_000001"
}

Step 2 — Claude Desktop config (~/Library/Application Support/Claude/claude_desktop_config.json):

json
{
  "mcpServers": {
    "purpleflea-casino": {
      "command": "npx",
      "args": ["-y", "@purpleflea/casino-mcp"],
      "env": {
        "PURPLEFLEA_API_KEY": "sk_live_abc123..."
      }
    },
    "purpleflea-trading": {
      "command": "npx",
      "args": ["-y", "@purpleflea/trading-mcp"],
      "env": {
        "PURPLEFLEA_API_KEY": "sk_live_abc123..."
      }
    },
    "purpleflea-wallet": {
      "command": "npx",
      "args": ["-y", "@purpleflea/wallet-mcp"],
      "env": {
        "PURPLEFLEA_API_KEY": "sk_live_abc123..."
      }
    },
    "purpleflea-domains": {
      "command": "npx",
      "args": ["-y", "@purpleflea/domains-mcp"],
      "env": {
        "PURPLEFLEA_API_KEY": "sk_live_abc123..."
      }
    }
  }
}

Step 3 — It just works. Ask Claude anything:

prompt
User: "Flip a coin for $5 and show me the proof"
Claude: [calls casino_flip(amount=5, side="heads")]
→ You won $9.80. Proof hash: sha256:a8f3c2...7d1e. Cryptographically verified.

User: "Open a long ETH position with $1000 at 5x leverage"
Claude: [calls trading_open(market="ETH-PERP", side="long", size=1000, leverage=5)]
→ Position opened. Entry: $3,240. Liquidation: $2,592. Position ID: pos_abc123

User: "Create a new HD wallet and show me my addresses"
Claude: [calls wallet_create()]
→ Wallet created. ETH: 0x7a3f... BTC: bc1q... SOL: 7xKm... (mnemonic shown once — store it safely)

All 22+ MCP tools

Every tool available across the four Purple Flea MCP servers.

Casino MCP casino.purpleflea.com — 10% referral

Tool Description Key params
casino_flipProvably fair coin flipamount, side (heads|tails)
casino_diceDice roll with custom targetamount, target (over|under), target_value
casino_customCustom win probability (1-99%)amount, win_probability
casino_crashCrash game with target multiplieramount, target_multiplier
casino_rouletteEuropean rouletteamount, bet_type, bet_value
casino_verifyVerify any past bet outcomebet_id
casino_balanceCheck current balance(none)
casino_historyPast bets with proofslimit?

Trading MCP trading.purpleflea.com — 20% referral

ToolDescriptionKey params
trading_marketsList 275+ perpetual markets(none)
trading_openOpen a position (up to 50x leverage)market, side, size, leverage
trading_closeClose an open positionposition_id
trading_stop_lossSet a stop-loss orderposition_id, price
trading_take_profitSet a take-profit orderposition_id, price
trading_positionsList open positions with P&L(none)
trading_ordersList open orders(none)

Wallet MCP wallet.purpleflea.com — 10% referral

ToolDescriptionKey params
wallet_createGenerate BIP-39 HD wallet (8 chains)(none)
wallet_balanceCheck on-chain balanceaddress, chain
wallet_sendSign and broadcast transactionchain, to, amount, private_key, token?
wallet_swap_quoteGet cross-chain swap quote via Wagyufrom_chain, to_chain, from_token, to_token, amount
wallet_swapExecute cross-chain swapfrom_chain, to_chain, from_token, to_token, amount, to_address

Domains MCP domains.purpleflea.com — 15% referral

ToolDescriptionKey params
domains_searchCheck domain availability + pricequery, tlds[]
domains_registerRegister a domain (crypto payment)domain, years, auto_renew
domains_listList your registered domains(none)
domains_add_recordAdd a DNS record (A, CNAME, TXT, MX)domain, type, name, value, ttl
domains_delete_recordDelete a DNS recorddomain, record_id

Works with every major framework

Purple Flea MCP servers are compatible with any framework that supports the MCP protocol or OpenAI-compatible tool calling. Here's how to connect the most popular ones.

LangChain + Claude

Use the official langchain-anthropic library with MCP tool binding:

python
# pip install langchain-anthropic mcp
from langchain_anthropic import ChatAnthropic
from langchain_mcp_adapters.client import MultiServerMCPClient

async with MultiServerMCPClient({
    "purpleflea-casino": {
        "command": "npx",
        "args": ["-y", "@purpleflea/casino-mcp"],
        "env": {"PURPLEFLEA_API_KEY": "sk_live_..."}
    }
}) as client:
    tools = await client.get_tools()
    llm = ChatAnthropic(model="claude-sonnet-4-6").bind_tools(tools)
    result = await llm.ainvoke("Flip a coin for $5")
    print(result.content)

CrewAI

Use langchain-purpleflea (wraps the MCP tools for CrewAI compatibility):

python
# pip install crewai langchain-purpleflea
from crewai import Agent, Task, Crew
from langchain_purpleflea import CasinoTool, TradingTool, WalletTool

trader = Agent(
    role="Crypto Trader",
    goal="Execute profitable perpetual futures trades",
    backstory="Expert algorithmic trader using Purple Flea APIs",
    tools=[TradingTool(api_key="sk_live_...")]
)

task = Task(
    description="Open a long ETH position at 5x leverage with $1000",
    agent=trader
)

Crew(agents=[trader], tasks=[task]).kickoff()

StreamableHTTP for Faucet & Escrow

The Faucet and Escrow services use StreamableHTTP MCP endpoints directly:

json — Claude Desktop config
{
  "mcpServers": {
    "purpleflea-faucet": {
      "type": "streamable-http",
      "url": "https://faucet.purpleflea.com/mcp"
    },
    "purpleflea-escrow": {
      "type": "streamable-http",
      "url": "https://escrow.purpleflea.com/mcp"
    }
  }
}

Why MCP for financial agents

MCP makes financial tool integration dramatically simpler than raw REST.

Zero boilerplate

No headers, no HTTP methods, no response parsing. The MCP server handles auth and serialization. Your agent just calls tool names with typed params.

🔒

Typed tool schemas

Every tool comes with a full JSON Schema definition. The LLM sees parameter names, types, and descriptions — reducing hallucinations and invalid calls.

📈

Structured errors

MCP errors are typed and descriptive. Instead of parsing HTTP status codes and error bodies, your agent receives structured McpError objects it can handle programmatically.

🔗

Works with any LLM

Claude, GPT-4, Gemini, Mistral — any model with tool-calling support can use MCP tools via the client library. One server, every model.


Common questions

Do I need separate API keys for each MCP server?

No. Your casino API key works across Casino, Trading (if registered on trading.purpleflea.com), and Escrow. The Wallet and Domains services each have their own registration, but all share the same PURPLEFLEA_API_KEY environment variable name in the config.

What chains does the Wallet MCP support?

The Wallet MCP supports Ethereum, Base, Solana, Bitcoin, Tron, Polygon, Arbitrum, and BNB. All addresses are derived from a single BIP-39 mnemonic. Cross-chain swaps route through Wagyu (aggregating 1inch, Paraswap, Jupiter, Li.Fi, 0x for best rates).

Is MCP the only way to use Purple Flea?

No — Purple Flea also provides direct REST APIs, Python and TypeScript SDKs, and npm packages for LangChain, CrewAI, and other frameworks. MCP is the fastest way to get started if you're using Claude Desktop or a framework with native MCP support. See the docs for all integration options.

How do referral commissions work with MCP?

Referral codes are embedded at registration time, not at tool-call time. When you call casino_flip, commissions flow to whoever referred the account associated with your API key. To earn commissions, refer other agents to register with your referral code — see for-agents for templates.


Ready to connect your agent?

Get an API key, add 5 lines of config, and have 22+ financial tools available in Claude in minutes.