Veto/docs

Polymarket With Veto MCP

Run a guarded MCP sidecar for Polymarket trading. Every mutating tool call is validated against YAML policy rules before execution.

This guide covers @plawio/polymarket-veto-mcp, a sidecar that wraps the Polymarket CLI with Veto policy guardrails exposed as MCP tools. The agent proposes, Veto permits.


Architecture

  • Rust polymarket CLI handles market access and execution
  • TypeScript MCP sidecar (@plawio/polymarket-veto-mcp) wraps CLI commands as MCP tools
  • Every mutating tool call is validated against YAML rules before execution
  • Simulation mode is on by default. No real orders run unless you explicitly unlock live execution.
  • x402 protocol integration supports paid research endpoints

Install

Install the Polymarket CLI

brew install polymarket

Or build from source:

git clone https://github.com/PlawIO/polymarket-cli-veto.git
cd polymarket-cli-veto
cargo build --release

Or use the install script:

curl -sSf https://raw.githubusercontent.com/Polymarket/polymarket-cli/main/install.sh | sh

Build the MCP sidecar

cd polymarket-cli-veto
pnpm --dir veto-agent install
pnpm --dir veto-agent build

Install the Claude Code skill (optional)

cp -r skills/polymarket-veto ~/.claude/skills/
bash ~/.claude/skills/polymarket-veto/scripts/setup.sh

The setup script writes .mcp.json to the current project directory. Pass a profile name to change the default:

bash ~/.claude/skills/polymarket-veto/scripts/setup.sh user

The skill is optional. The MCP server works with any MCP host that can launch the sidecar process.


Start the MCP sidecar

From source (local development)

pnpm --dir veto-agent exec tsx src/bin.ts serve --config polymarket-veto.config.yaml

Via npm (any MCP host)

{
  "mcpServers": {
    "polymarket-veto": {
      "command": "npm",
      "args": [
        "exec", "--yes", "--prefix", "/tmp",
        "--package", "@plawio/polymarket-veto-mcp",
        "--", "polymarket-veto-mcp", "serve",
        "--policy-profile", "defaults"
      ]
    }
  }
}

Inspect tools and health

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 print-tools --config polymarket-veto.config.yaml

Tool coverage

Read-only (no policy gating)

ToolPurposeKey args
markets_listList marketslimit, active, closed
markets_searchSearch by textquery, limit
markets_getMarket detailsmarket (id or slug)
clob_bookOrder booktoken
clob_midpointMidpoint pricetoken
clob_priceCLOB pricetoken, side
portfolio_positionsWallet positionsaddress

Mutating (policy-guarded, simulation by default)

ToolPurposeKey args
order_create_limitLimit ordertoken, side, price, size, orderType, postOnly
order_marketMarket ordertoken, side, amount
order_cancelCancel one orderorderId
order_cancel_allCancel all orders(none)
approve_setOn-chain approvals(none)
ctf_splitSplit USDC to tokenscondition, amount
ctf_mergeMerge tokens to USDCcondition, amount
ctf_redeemRedeem winnerscondition

Internal controls

ToolPurposeKey args
policy_createGenerate session policy from promptprompt, toolName
policy_listList active session policies(none)
policy_tightenTighten a session ruleruleId, newCondition
policy_request_editRequest review for policy editruleId, changes
audit_queryQuery audit logsince, agentId, toolName, limit
pnl_snapshotAll positions with P&L(none)
pnl_positionPosition details for tokentoken
circuit_breaker_statusCircuit breaker state(none)
compliance_reportGenerate compliance reportformat, period, startDate, endDate
budget_statusSession and category budgets(none)
runtime_statusRuntime readiness and capital controls(none)
approval_statusCheck approval request statusapprovalId

x402-paid research

ToolPurposeKey args
intel_searchPaid research queryquery, limit
intel_market_contextPaid research contextmarket, event, token

Architecturally excluded

wallet_import, wallet_reset, clob_delete_api_key are never exposed. The MCP layer rejects them with error code -32601 before policy evaluation.


Policy profiles

ProfileBest for
defaultsGetting started. Small orders allowed, larger require approval.
agentAutonomous bots. Adds off-hours gating (8am–8pm ET weekdays).
userHuman-delegated trading. Hard caps, sell-side approvals, price discipline.
conservativeExperimentation. Every mutation requires approval.

Set the profile with --policy-profile <name> when starting the server.


Simulation vs live execution

Simulation is on by default. Mutating tools estimate shares and notional, run policy and economic checks, but do not submit real orders.

Live trading requires all three:

  1. Start the server with --simulation off
  2. Set execution.allowLiveTrades: true in config
  3. Export ALLOW_LIVE_TRADES=true in the environment

Do not enable live execution unless you intend to submit real orders. The server stays in simulation unless all three controls are in place.


Economic authorization and x402

The same runtime governs both Polymarket trading notional and x402-paid research spend. It enforces payer requirements, approved payer lists, budget authorization, and fail-closed behavior for live priced actions when the economic authority is unavailable.


Error codes

CodeMeaningResponse
-32601Unknown toolTool not in registry. Do not retry.
-32602Invalid argumentsFix arguments and retry.
-32001Denied by policyProfile blocks this. Explain the rule.
-32002Approval requiredHuman must approve. Inform the user.
-32003Execution failedBinary missing or command error. Run doctor.