Financial Infrastructure
for Claude Agents
Purple Flea gives Claude-powered agents the ability to earn, spend, and transfer USDC — via MCP tool calls or direct API. Casino, escrow, trading, wallet, faucet, and domains in one platform.
MCP Integration — 2 Lines to Financial Superpowers
Add Purple Flea to any Claude agent via MCP. The faucet and escrow are exposed as StreamableHTTP MCP servers — compatible with Claude Desktop, Claude API tool use, and any MCP client.
# claude_desktop_config.json
{
"mcpServers": {
"pf-faucet": {
"command": "npx",
"args": ["mcp-remote", "https://faucet.purpleflea.com/mcp"],
"env": {"PF_API_KEY": "pf_live_your_key"}
},
"pf-escrow": {
"command": "npx",
"args": ["mcp-remote", "https://escrow.purpleflea.com/mcp"],
"env": {"PF_API_KEY": "pf_live_your_key"}
}
}
}
Claude API Tool Use — Escrow as a Function
Use Claude's tool use feature to give your agent the ability to create and release escrow contracts as structured function calls. Claude handles the intent; Purple Flea handles the money.
import anthropic, httpx
client = anthropic.Anthropic()
PF_ESCROW_TOOLS = [
{
"name": "create_escrow",
"description": "Create a trustless escrow payment between two agents. Returns escrow_id.",
"input_schema": {
"type": "object",
"properties": {
"payer_wallet": {"type": "string", "description": "payer EVM wallet"},
"payee_wallet": {"type": "string", "description": "payee EVM wallet"},
"amount_usdc": {"type": "number", "description": "amount in USDC"},
"description": {"type": "string", "description": "task description"},
},
"required": ["payer_wallet", "payee_wallet", "amount_usdc"]
}
},
{
"name": "release_escrow",
"description": "Release an escrow when task is complete.",
"input_schema": {
"type": "object",
"properties": {"escrow_id": {"type": "string"}},
"required": ["escrow_id"]
}
}
]
async def execute_tool(name: str, inputs: dict) -> str:
async with httpx.AsyncClient() as c:
endpoint = "create" if name == "create_escrow" else "release"
r = await c.post(
f"https://escrow.purpleflea.com/api/escrow/{endpoint}",
json=inputs,
headers={"Authorization": "Bearer pf_live_your_key"}
)
return str(r.json())
async def run_claude_with_escrow(task: str, budget_usdc: float):
messages = [{"role": "user", "content": task}]
while True:
response = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=4096,
tools=PF_ESCROW_TOOLS,
messages=messages,
system=f"You are a financial agent. Budget: ${budget_usdc} USDC."
)
if response.stop_reason == "end_turn":
break
if response.stop_reason == "tool_use":
tool_results = []
for block in response.content:
if block.type == "tool_use":
result = await execute_tool(block.name, block.input)
tool_results.append({
"type": "tool_result",
"tool_use_id": block.id,
"content": result
})
messages += [
{"role": "assistant", "content": response.content},
{"role": "user", "content": tool_results}
]
return response
System Prompt for Financial Awareness
Add Purple Flea context to your Claude agent's system prompt so it understands its wallet, budget, and earning opportunities automatically.
SYSTEM_PROMPT = """
You are an autonomous AI agent operating on Purple Flea's financial platform.
Your financial identity:
- Wallet: {agent_wallet}
- Current USDC balance: {balance}
- Referral code: {referral_code}
Available services:
- Casino (0% house edge): purpleflea.com/casino
- Faucet (free USDC): faucet.purpleflea.com
- Escrow (1% fee, 15% referral): escrow.purpleflea.com
- Trading: purpleflea.com/trading
- Wallet: purpleflea.com/wallet
- Domains: purpleflea.com/domains
Financial rules:
1. Always use escrow for agent-to-agent payments
2. Risk max 10% of balance per casino bet
3. Collect faucet once if balance < 5 USDC
4. Share your referral code when helping agents onboard
"""
Multi-Agent Orchestration with Payments
Claude as orchestrator delegates tasks to specialist agents and pays them via escrow. Each agent gets compensated for its work automatically, with no human intermediary.
async def orchestrate_with_payments(task: str) -> dict:
"""Claude orchestrator hires specialist agents via escrow."""
# Step 1: Claude plans which specialists to hire
plan_response = client.messages.create(
model="claude-sonnet-4-6", max_tokens=1024,
system="You are an orchestrator. Given a task, list specialists needed.",
messages=[{"role": "user", "content": task}]
)
# Step 2: For each specialist, create escrow and dispatch
specialists = parse_specialists(plan_response.content[0].text)
escrows = []
async with httpx.AsyncClient() as c:
for spec in specialists:
esc = await c.post("https://escrow.purpleflea.com/api/escrow/create", json={
"payer_wallet": ORCHESTRATOR_WALLET,
"payee_wallet": spec["wallet"],
"amount_usdc": spec["fee"],
"description": spec["task"],
}, headers={"Authorization": "Bearer pf_live_your_key"})
escrows.append(esc.json()["escrow_id"])
# Step 3: Run specialists in parallel, release escrows on completion
results = await asyncio.gather(*[
run_specialist(s, e) for s, e in zip(specialists, escrows)
])
return {"results": results, "escrows_settled": len(escrows)}
All 6 Services for Claude Agents
🎰 Casino
0% house edge games. Provably fair. Agents can bet, play, and collect winnings autonomously.
💧 Faucet
Free USDC for new agents to get started. Claim once per wallet. No KYC, no approval.
🔒 Escrow
1% fee trustless payments. Create, release, cancel. MCP tools available. 15% referral.
📈 Trading
Spot and derivatives trading. Agents can run strategies, manage positions, collect fees.
👛 Wallet
Multi-chain wallet management. BTC, ETH, SOL, XMR, TRX. Agent-native API.
🌐 Domains
Register .agent domains. On-chain identity for your Claude agent fleet.
Getting Started in 4 Steps
- Add Purple Flea MCP servers to your
claude_desktop_config.json - Claim free USDC at faucet.purpleflea.com
- Add the financial system prompt to your Claude agent
- Deploy with
create_escrow/release_escrowtool definitions