Catalog PyPI
PACKAGE EXPLORERView in registry

agentcrab

PyPI

Python SDK + MCP Server for agentCrab — trade Polymarket prediction markets, earn $CRAB token airdrops

ai-agentairdropmcpmcp-serverpolymarketprediction-marketsdktrading
Versions collected1
Direct dependencies4From release 0.4.1
Last observed20 Oct, 21:44 UTC

README

Version 0.4.1 documentation

agentcrab

Python SDK + MCP Server for agentCrab — turn any AI agent into a Polymarket assistant with 3 lines of code. Every API call earns $CRAB airdrop points worth 2x your spending.

Install

pip install agentcrab          # SDK only
pip install agentcrab[mcp]     # SDK + MCP server

Quick Start

from agentcrab import AgentCrab

client = AgentCrab("https://api.agentcrab.ai/polymarket", "0xYOUR_PRIVATE_KEY")

# Search markets
markets = client.search("bitcoin")
for m in markets:
    print(m.title, m.outcomes)

# Check balance
balance = client.get_balance()
print(f"{balance.calls_remaining} API calls remaining")

Trading

# One-time setup (deploys Safe + approvals + L2 credentials)
setup = client.setup_trading()
print(f"Safe: {setup.safe_address}")

# Buy shares
result = client.buy(token_id="TOKEN_ID", size=5.0, price=0.65)
print(f"Order {result.status}: {result.order_id}")

# Sell shares
result = client.sell(token_id="TOKEN_ID", size=5.0, price=0.70)

# View positions
for pos in client.get_positions():
    print(f"{pos.outcome}: {pos.size} shares, PnL: {pos.pnl}")

Full API

Balance & Payment

MethodDescriptionCost
get_balance()Prepaid balanceFree
get_wallet_balance()BSC wallet USDT + BNBFree
get_trading_status()Trading setup statusFree
deposit(amount_usdt)Deposit to agentCrabFree
deposit_to_polymarket(amount_usdt)Deposit to PolymarketFree

Market Data

MethodDescriptionCost
search(query, tag, category)Search events0.01 USDT
browse(category, mood)Browse events0.01 USDT
get_categories()List market categoriesFree
get_event(event_id)Get single event0.01 USDT
get_event_by_slug(slug)Get event by slug0.01 USDT
get_market(market_id)Get single market0.01 USDT
get_orderbook(token_id)Get orderbook0.01 USDT
get_orderbooks_batch(token_ids)Batch orderbooks (up to 20)0.01 USDT
get_price(token_id)Get price0.01 USDT
get_prices_batch(token_ids)Batch prices (up to 20)0.01 USDT
find_tradeable(query, category, mood)Find liquid market + orderbook (1 search + N orderbook calls)0.01+ USDT
search_history(query, category)Search closed events0.01 USDT
sync_history()Trigger closed-event syncFree

Positions & History

MethodDescriptionCost
get_positions()Your positions0.01 USDT
get_trades(limit, offset)Your trades0.01 USDT
get_activity(limit, offset)On-chain activity0.01 USDT
get_trader_positions(address)Any trader's positions0.01 USDT
get_trader_trades(address)Any trader's trades0.01 USDT

Leaderboard

MethodDescriptionCost
get_leaderboard(limit, offset)Global leaderboard0.01 USDT
get_category_leaderboard(category)Category leaderboard0.01 USDT
get_trader_category_profile(address)Trader category breakdown0.01 USDT
get_category_stats(category)Category aggregate stats0.01 USDT

Trading (auto-setup on first trade)

MethodDescriptionCost
setup_trading()Deploy Safe + approvals + creds0.01-0.03 USDT
set_credentials(key, secret, passphrase)Manual cred setFree
refresh_balance()Refresh CLOB balance cacheFree
buy(token_id, size, price)Buy shares0.01 USDT
sell(token_id, size, price)Sell shares0.01 USDT
batch_order(orders)Batch orders (max 15)N × 0.01 USDT
cancel_order(order_id)Cancel order0.01 USDT
cancel_all_orders()Cancel all0.01 USDT
get_open_orders(market)Open orders0.01 USDT

Stop Loss / Take Profit

MethodDescriptionCost
set_stop_loss(token_id, trigger_price, size, exit_price)Set stop loss0.01 USDT
set_take_profit(token_id, trigger_price, size, exit_price)Set take profit0.01 USDT
get_triggers(status, token_id)List triggersFree
cancel_trigger(trigger_id)Cancel triggerFree
cancel_all_triggers(token_id)Cancel all triggersFree

$CRAB Token & Points

MethodDescriptionCost
get_points()Your airdrop pointsFree
get_points_leaderboard(limit)Points rankingFree
get_token_info()Token details + rulesFree

Every API call earns points. 1 USDT deposited = 100 points, 1 API call = 1 point. Airdrop value >= 2x total spend.

Wallet

MethodDescription
AgentCrab.create_wallet()Create new wallet locally (static, no server call)

MCP Server

For Claude Code, Cursor, Windsurf, and other MCP-compatible tools:

# stdio mode (Claude Code, local agents)
AGENTCRAB_PRIVATE_KEY=0x... agentcrab-mcp

Runs locally — private keys never leave your machine. Exposes all SDK methods as MCP tools. No code needed — the AI calls tools directly.

Typed Responses

All methods return typed dataclasses with a .raw escape hatch:

balance = client.get_balance()
print(balance.calls_remaining)   # typed field
print(balance.raw)               # full server response dict

Error Handling

from agentcrab import AgentCrabError, InsufficientBalance

try:
    result = client.buy(token_id, size=5.0, price=0.65)
    # buy()/sell() auto-call setup_trading() if needed — no manual setup required
except InsufficientBalance as e:
    print(f"Top up: {e.message}")
except AgentCrabError as e:
    print(f"Error [{e.error_code}]: {e.message}")

Dependencies

Minimal — no web3 required:

  • eth-account — EIP-191, EIP-712, tx signing
  • httpx — Sync HTTP
  • hexbytes — SafeTx hash signing

License

MIT

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.4.15 Mar 20264

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
agentcrab/agentcrab-python

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 21:44 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:d0eea0dce90951d3e097f990654b5ee282fde4fa61165b7791defa3aceea992a