Connect an AI agent
Connect Claude, ChatGPT and other agents over MCP, the command line or OpenAPI.
Connect an AI agent to query traders and process their fills. Choose a connection below.
| Your agent | Use | Needs |
|---|---|---|
| claude.ai, ChatGPT | Remote MCP | A PMWallets account; sign in through OAuth |
| Claude Code, Cursor, Claude Desktop | Remote or local MCP | Remote: OAuth or supported Bearer auth; local: API key + Node.js |
| Codex, Gemini CLI, WorkBuddy, scripts | CLI, or local MCP where supported | API key; Node.js (MCP/CLI) or Python (CLI) |
| Dify, Coze, n8n, GPT Actions | OpenAPI and webhooks | An API key |
Remote MCP
Nothing to install. Add this address as a custom connector or remote MCP server:
https://api.pmwallets.com/mcp
With OAuth, sign in at pmwallets.com and approve the connection. The client can refresh its MCP-only token. Find the connection on API keys as “<app> (OAuth)”; delete it to disconnect. Clients that support Bearer authentication, including Claude Code, Cursor and scripts, can send an existing key as Authorization: Bearer pmw_….
To try it without an account, use https://api.pmwallets.com/mcp/public: it has leaderboard, entity and market, with a fixed 20-trader leaderboard sample, records for those traders, and market lookups.
Local MCP
Add this to your client’s MCP settings, with a key from API keys. The second server is the copy-trading bot; leave it out unless the agent should place orders.
{ "mcpServers": { "pmwallets": { "command": "npx", "args": ["-y", "pmwallets", "mcp"], "env": { "PMW_API_KEY": "pmw_..." } }, "copytrade": { "command": "npx", "args": ["-y", "pmwallets-copytrade", "mcp", "--config", "/abs/path/config.yaml"] } } }
Command line
Data commands print JSON. For Python, run uvx pmwallets instead of npx pmwallets. Give your agent the guide that npx pmwallets skill prints.
export PMW_API_KEY=pmw_... npx pmwallets leaderboard --category politics --minWinLo 0.55 --limit 20 npx pmwallets entity <handle> npx pmwallets subscribe <handle> # billed per hour while it runs npx pmwallets new-fills # fills since the previous call, each once npx pmwallets watch # live: one JSON line per fill
React to fills
watch --exec passes each batch of fills to your command on standard input, at most once. Failed or timed-out batches stay in pmw-watch/failed/ without an automatic retry: the agent may already have placed an order.
npx pmwallets watch --batch-sec 30 --exec 'claude -p "Fills from traders I follow are on stdin. For each BUY above $1000, check the market with pmwallets-copytrade market, and buy $5 with --key <eventId> if the price is below 0.6." --allowedTools "Bash(pmwallets-copytrade:*)"'
For polling, local MCP has new_fills: it saves a cursor on disk. Give each consumer its own PMW_MCP_STATE; the CLI shares the default file. Remote MCP uses fills: pass its next back as sinceBlock/sinceLogIndex on the next call.
Platforms without a shell
Import openapi.json to call the same endpoints over HTTPS, and use webhooks to have each fill pushed to you.
What the tools do
| Tools | What they do |
|---|---|
leaderboard, entity, market | Rank traders, read a trader's stats, look up a token's market and outcome. |
subscribe, cancel_subscription, subscriptions | Start or stop following traders with unlocked addresses; list subscriptions. |
new_fills, fills | new_fills: local MCP only, saved cursor. fills: both, replay after a ledger position. |
signals, radar | Several smart-money wallets buying one side; large taker fills. Local and authenticated remote MCP; Pro and Max. |
export_options, export_quote, buy_export, exports, export_files, export_file | Check available days and prices, buy past fills, read purchased files. Remote MCP only. |
account | Your plan and balance. |
Placing orders
PMWallets never places orders and never sees a private key. The open-source copy-trading bot places them from your machine, with your Polymarket account.
- A buy is fill-or-kill, and its USDC amount is a ceiling.
- Pass the fill’s
eventIdas the key: the same key never places a second order, so a retry cannot double a trade. - Dry-run mode simulates orders against the live order book. Check the results before switching to live.
What an agent can spend
An API key spends your balance, and keys have no separate cap. Following a trader needs that address unlocked, then costs $0.01 per hour while the feed runs or uses a plan slot. Exports use your balance or paid plan allowance. Give an agent a key on an account holding only what you are willing to let it spend. A key cannot create other keys or change your plan: that needs a signed-in browser.
More: what agents can do with PMWallets, and the SDK reference for agents.