Upstream Polymarket CLI, plus a Veto-powered MCP sidecar for AI agents.
This repo is the practical bundle:
- the Rust
polymarketCLI for market access and execution - the
@plawio/polymarket-veto-mcpsidecar inveto-agent - Claude Code skill wiring in
skills/polymarket-veto - sample Veto rules and config in
veto
The point of the bundle is simple:
Your model suggests.
Veto permits.
Every capital-moving action can be checked before execution against policy, approvals, budget state, payer constraints, and live-vs-simulation rules.
The Rust CLI still works as a normal terminal and script tool:
polymarket markets list --limit 5
polymarket markets search "bitcoin"
polymarket markets get will-trump-win
polymarket -o json markets list --limit 3The sidecar exposes guarded MCP tools for agents:
- market reads
- order placement and cancellation
- approval-aware execution
- runtime readiness and budget inspection
- x402-backed paid research
Key agent-facing tools:
markets_list,markets_search,markets_getclob_book,clob_midpoint,clob_priceorder_create_limit,order_market,order_cancel,order_cancel_allbudget_status,runtime_status,approval_statusintel_search,intel_market_context
Architecturally excluded:
wallet_importwallet_resetclob_delete_api_key
- Build or install the Polymarket CLI:
brew install polymarket
# or from this repo:
cargo build --release- Install the MCP sidecar deps:
pnpm --dir veto-agent install
pnpm --dir veto-agent build- Install the Claude skill:
cp -r skills/polymarket-veto ~/.claude/skills/
bash ~/.claude/skills/polymarket-veto/scripts/setup.sh- Restart Claude Code.
At that point the agent can use the Veto-wrapped Polymarket tools through MCP.
{
"mcpServers": {
"polymarket-veto": {
"command": "npm",
"args": [
"exec",
"--yes",
"--prefix",
"/tmp",
"--package",
"@plawio/polymarket-veto-mcp",
"--",
"polymarket-veto-mcp",
"serve",
"--policy-profile",
"defaults"
]
}
}
}Or locally from this repo:
pnpm --dir veto-agent exec tsx src/bin.ts serve --config polymarket-veto.config.yamlFor priced actions, the runtime loop is:
- Agent proposes an action.
- Veto policy evaluates it.
- Economic authorization evaluates payer, budget, and approval requirements.
- Runtime returns one of:
- allow
- deny
- require approval
- If allowed, the CLI action or x402 call executes.
- Actual spend is committed back to the authority.
This means the agent never gets to move capital first and explain later.
Profiles define the default policy posture:
| Profile | Behavior |
|---|---|
defaults |
Small orders allowed, larger orders require approval |
agent |
Defaults plus off-hours gating |
user |
Harder caps, sell-side approvals, price discipline |
conservative |
Every mutation requires approval |
You can set the profile with --policy-profile <name> when starting the MCP server.
Approval handling is configurable in the sidecar:
runtime.approvalMode: returnThe MCP call returns immediately withapprovalId,pending, and context so the agent can keep working and checkapproval_statuslater.runtime.approvalMode: waitThe MCP call blocks and polls until approval resolves or times out.
The checked-in sample config defaults to return because it is the better agent UX.
Mutating tools simulate by default.
Simulation means:
- the runtime estimates notional and shares
- policy and economic checks still apply
- no real order is submitted
- x402 tools stop at quote discovery and do not settle payment
Live execution requires all three:
- start the server with
--simulation off - set
execution.allowLiveTrades: true - export
ALLOW_LIVE_TRADES=true
The sidecar can govern both:
- Polymarket trading notional
- x402-paid research spend
The same runtime can:
- enforce payer requirements
- enforce approved payer lists
- request budget authorization
- fail closed on live priced actions when the authority is unavailable
- return cached previews for simulation
- attach
economicreceipts to priced tool responses
x402 tools:
intel_searchintel_market_context
Examples:
polymarket markets list --limit 10
polymarket markets search "fed"
polymarket clob midpoint <token>
polymarket clob book <token>Build locally:
cargo build --release
./target/release/polymarket --versionpnpm --dir veto-agent exec tsx src/bin.ts serve --config polymarket-veto.config.yaml
pnpm --dir veto-agent exec tsx src/bin.ts doctor --config polymarket-veto.config.yaml
pnpm --dir veto-agent exec tsx src/bin.ts status --config polymarket-veto.config.yaml
pnpm --dir veto-agent exec tsx src/bin.ts approval-status --approval-id <id> --config polymarket-veto.config.yaml
pnpm --dir veto-agent exec tsx src/bin.ts print-tools --config polymarket-veto.config.yaml
pnpm --dir veto-agent exec tsx src/bin.ts print-config --config polymarket-veto.config.yamlcargo test
cargo build --releasepnpm --dir veto-agent install
pnpm --dir veto-agent typecheck
pnpm --dir veto-agent test
pnpm --dir veto-agent buildveto-agent/README.mdFull MCP tool reference, config surface, approval behavior, economic auth, and x402 docs.veto-agent/polymarket-veto.config.yamlSample sidecar config.veto/Sample Veto policy config and rules.skills/polymarket-vetoClaude Code skill and setup flow.
This repo is intentionally opinionated toward agent use:
- simulation-first
- policy before execution
- approval-aware runtime behavior
- capital authorization hooks for priced actions
If you just want the raw Polymarket CLI, the Rust binary is still here. If you want an AI agent to operate with hard capital controls, this is the repo.