# MCP Server · Polymarket Clause Audit & Crypto Crowding Radar (`redkoi/my-actor`) Actor

MCP-ready deterministic Polymarket settlement clause poison-pill auditor & crypto perp crowding radar. Detects hidden cross-year lockups, touch-vs-close polarity traps, unverified resolution sources, and tail risks (<0.30 / >=0.93) alongside Binance/OKX funding & OI skew.

- **URL**: https://apify.com/redkoi/my-actor.md
- **Developed by:** [RedKoi Research](https://apify.com/redkoi) (community)
- **Features:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 audited polymarket events & clause verdict

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## MCP Server · Polymarket Clause Risk Audit & Crypto Perp Crowding Divergence

An MCP-ready Apify Python Actor (`mcp.apify.com` compatible) that combines **zero-token deterministic Polymarket settlement clause poison-pill auditing** with **public crypto perpetual futures crowding telemetry** (Binance USDS-M Futures + automatic OKX v5 geo-block fallback).

Built specifically for AI trading agents, Claude/Cursor MCP workflows, and quantitative researchers that require hard deterministic pre-trade contract hygiene before acting on prediction-market implied probabilities.

### MCP Server Integration (`mcp.apify.com`)

Connect this Actor directly as a native tool in Claude Desktop, Cursor, Windsurf, or custom MCP clients via the hosted Apify MCP Server:

- **Endpoint**: `https://mcp.apify.com?actors=redkoi/my-actor` (or select via Apify MCP tool configuration)
- **Zero External API Keys**: Consumes strictly public, unauthenticated market endpoints with deterministic regex/date/decimal contract verification (`0` LLM token overhead).

### Deterministic Polymarket Clause Poison-Pill Audit (`src/clause_audit.py`)

Every item in `polymarketTopEvents` (plus its active sub-markets) and every signal in `divergenceSignals` emits three structured risk fields:

- `clauseAuditVerdict`: `"SAFE"` | `"CAUTION"` | `"TOXIC_TRAP"`
- `trapFlags`: Ordered `list[str]` of triggered deterministic risk codes
- `effectiveEndDate`: Canonical ISO-8601 UTC settlement timestamp (automatically overriding nominal API `endDate` when hidden cross-year lockups are detected in clause text)

#### Audited Risk Taxonomy

1. **`TOXIC_TRAP` (Hard Structural Poison Pills)**:
   - `HIDDEN_CROSS_YEAR_LOCKUP`: Clause text extends settlement into a future calendar year beyond `(endDate + 2 days)`, trapping principal across years.
   - `TOUCH_VS_CLOSE_POLARITY_TRAP`: Question wording (`touch`/`hit` vs `close above`) contradicts statutory clause rules, or clause mixes conflicting intraday-touch and closing-snapshot triggers.
   - `NON_CREDIBLE_ALLEGATION_TRAP`: Resolves regardless of whether an allegation or report is credible, verified, or later retracted.
   - `LOW_THRESHOLD_SOCIAL_SOURCE_TRAP`: Single tweet, X post, podcast mention, or rumor suffices to trigger settlement.
   - `ANONYMOUS_UNOFFICIAL_SOURCE_TRAP`: Relies on unnamed insiders, unverified blogs/polls, or sole creator discretion.
   - `ZERO_COST_FRIVOLOUS_FILING_TRAP`: Triggered by any zero-cost petition, motion, or filing regardless of merit.
   - `RETROACTIVE_REVISION_TRAP`: Vulnerable to retroactively edited articles or restated posts.
   - `PRIVATE_GOSSIP_SCOOP_TRAP` & `INTRADAY_GAMBLING_NOISE_TRAP`: Tabloid gossip or `5m`/`15m`/`hourly` coin-flip markets.
2. **`CAUTION` (Sizing, Boundary & Tail-Asymmetry Warnings)**:
   - `LOTTERY_TICKET_TAIL_RISK_LT_030`: Implied `Yes` probability `< 0.30` (long-shot decay hazard).
   - `PENNY_PICKING_TAIL_RISK_GTE_093`: Implied `Yes` probability `>= 0.93` (capped upside `<= 7.5%` vs `100%` dispute/gap tail loss).
   - `TOUCH_AT_ANY_TIME_WICK_RISK`: Resolves on any 1-minute candle `High`/`Low` print (scam-wick mismatch against perp hedges).
   - `CLOSE_SNAPSHOT_PIN_RISK`: Resolves strictly on a point-in-time `Close` candle (intraday breakout does not settle `Yes`).
   - `DOUBLE_NEGATIVE_POLARITY_ALERT`: Negated question phrasing (`not`, `never`, `fail to`, `without`) prone to `Yes`/`No` side inversion.
   - `GEOPOLITICS_HEADLINE_GAP_RISK`, `UNSPECIFIED_RESOLUTION_SOURCE`, `NEAR_EXPIRY_GAMMA_HAZARD_LT_6H`.

### Pay-Per-Event (PPE) Billing Events

Implemented via `Actor.charge()` with automatic graceful no-op fallback in local/non-PPE runs and strict respect for user `maxTotalChargeUsd` caps:

- `actor-start`: Base run initialization event (`count=1`).
- `audited-market-signal`: Charged per audited Polymarket event (`count=1` per event in `polymarketTopEvents`).

### Local Verification & Testing

```bash
## Offline deterministic manifest + reference snapshot check
python3 -m src.main --dry-run

## Live public API verification (Polymarket Gamma + Binance/OKX perpetuals)
python3 -m src.main --live

## Unit test suite
pytest tests/test_clause_audit_and_radar.py
```

### Disclaimer

For informational research, contract clause auditing, and quantitative tooling use only. Not financial or investment advice.

# Actor input Schema

## `symbols` (type: `array`):

List of USDS-M perpetual contract symbols to measure derivatives crowding.

## `polymarketLimit` (type: `integer`):

Number of highest-24h-volume active Polymarket events to fetch from Gamma API.

## `polymarketKeywords` (type: `array`):

Case-insensitive keywords used to highlight crypto/macro events for cross-market divergence scoring.

## `requestTimeoutSec` (type: `number`):

Per-endpoint timeout for public Binance & Polymarket REST calls.

## `dryRun` (type: `boolean`):

When true, validate schemas and compute crowding/divergence output against built-in reference snapshots without outbound network calls.

## Actor input object example

```json
{
  "symbols": [
    "BTCUSDT",
    "ETHUSDT",
    "SOLUSDT"
  ],
  "polymarketLimit": 15,
  "polymarketKeywords": [
    "bitcoin",
    "btc",
    "ethereum",
    "eth",
    "solana",
    "crypto",
    "fed",
    "rate",
    "etf"
  ],
  "requestTimeoutSec": 12,
  "dryRun": false
}
```

# Actor output Schema

## `auditResults` (type: `string`):

Full structured JSON output of the run stored in the default dataset.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "symbols": [
        "BTCUSDT",
        "ETHUSDT",
        "SOLUSDT"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("redkoi/my-actor").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "symbols": [
        "BTCUSDT",
        "ETHUSDT",
        "SOLUSDT",
    ] }

# Run the Actor and wait for it to finish
run = client.actor("redkoi/my-actor").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "symbols": [
    "BTCUSDT",
    "ETHUSDT",
    "SOLUSDT"
  ]
}' |
apify call redkoi/my-actor --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,redkoi/my-actor"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/4B4Z5GmoaClAeR1gp/builds/badciHclxrBYfvIz9/openapi.json
