> ## Documentation Index
> Fetch the complete documentation index at: https://docs.chance.cc/llms.txt
> Use this file to discover all available pages before exploring further.

# MCP server (local)

> Verification as a tool your agent can call — installed locally via npx.

Chance ships a **local** [MCP](https://modelcontextprotocol.io) server so any MCP-compatible desktop/IDE agent — Claude Desktop, Claude Code, Cursor, Windsurf — can verify a proposed action against its mandate **before it executes**, and get a signed, independently-verifiable verdict back. It uses the same API key and credits as the [HTTP API](/api-reference/introduction).

<Note>
  Using a **web or mobile** assistant (Claude.ai, ChatGPT, Claude mobile), or one of the AI platform APIs? Those can't launch a local process — use the hosted [Connectors](/connectors) instead (one-click OAuth, no install).
</Note>

<Note>
  **Light integration.** The MCP gives your agent the *verdict*. You still handle execution and decide to honor it — fail-closed: treat anything other than `ALLOW` as do-not-execute. For enforcement a failed check can't ignore, give your agent an [escrow wallet](/escrow) — it can only move funds through the harness.
</Note>

## Setup

<Steps>
  <Step title="Get an API key">
    Sign in at [harness.chance.cc/login](https://harness.chance.cc/login) — 50 free credits, no card. In the [dashboard](https://harness.chance.cc/dashboard), click **Create API key** and copy it.
  </Step>

  <Step title="Add the server to your MCP client">
    ```jsonc theme={null}
    {
      "mcpServers": {
        "chance": {
          "command": "npx",
          "args": ["-y", "chance-mcp"],
          "env": { "CHANCE_API_KEY": "chance_sk_live_..." }
        }
      }
    }
    ```

    <AccordionGroup>
      <Accordion title="Claude Desktop">
        Settings → Developer → **Edit Config**, paste the block into `claude_desktop_config.json`, and restart.
      </Accordion>

      <Accordion title="Claude Code">
        ```bash theme={null}
        claude mcp add chance -e CHANCE_API_KEY=chance_sk_live_... -- npx -y chance-mcp
        ```
      </Accordion>

      <Accordion title="Cursor / Windsurf">
        Their MCP settings use the same `mcpServers` shape — paste the block into the MCP config and reload.
      </Accordion>
    </AccordionGroup>
  </Step>

  <Step title="Use it">
    Restart your client and the `verify_intent` tool is available. Prompt your agent to call it before any consequential action and to honor the verdict.
  </Step>
</Steps>

## Environment

| Variable          | Required | Default                     | Description                                |
| ----------------- | -------- | --------------------------- | ------------------------------------------ |
| `CHANCE_API_KEY`  | yes      | —                           | Your `chance_sk_…` key from the dashboard. |
| `CHANCE_BASE_URL` | no       | `https://harness.chance.cc` | Override the API host.                     |

## Tools

<ResponseField name="verify_intent" type="tool">
  Verify a proposed action against the stated intent/mandate. Returns a verdict — `ALLOW` / `BLOCK` / `ESCALATE` — with a reason and a provable receipt (attested judge signature, hash-chained transcript, onchain anchor when configured). **Costs one credit.**

  Inputs: `intent` (string), `action` (string), `context` (object, optional).

  The verifier is **platform-agnostic** today — it works across prediction markets, perps/DeFi, and API venues (Hyperliquid, Kalshi) alike. Per-venue verification with protocol-specific knowledge bases is coming.
</ResponseField>

<ResponseField name="get_verification" type="tool">
  Fetch a prior verification and its proof by `id` (UUID) or `requestHash` (`0x…`). Read-only, no credits.
</ResponseField>

### Wallets your agent can spend from

The tools above verify an action your agent will execute itself. These go further: the wallet is held by the harness, so a `BLOCK` is never handed to a signer. See [Escrow wallets](/escrow).

<ResponseField name="create_escrow_wallet" type="tool">
  Provision a wallet on Base, Solana or Starknet. Inputs: `name`, `chain`, `mode` (`autonomous` executes on a passing verdict; `safe` waits for you to confirm), `mandate`, and optional `limits` — per-action and daily dollar caps, an address allowlist, and a token-contract allowlist.
</ResponseField>

<ResponseField name="escrow_transfer" type="tool">
  Propose a transfer: `wallet`, `asset`, `amount`, `to`, `chain`. Simulated, judged, then settled or held.
</ResponseField>

<ResponseField name="escrow_swap" type="tool">
  Propose a swap. Chance fetches the quote itself, so the route that gets verified is the route that runs.
</ResponseField>

<ResponseField name="escrow_pay_x402" type="tool">
  Pay an HTTP resource that charges via x402. Chance requests the URL, reads the payment terms from the `402` response itself rather than from your agent, and verifies the exact amount, token and recipient. Use it for paid APIs and per-call data — and for topping your own credits up.
</ResponseField>

<ResponseField name="escrow_execute" type="tool">
  Propose a raw transaction your agent built for any protocol.
</ResponseField>

<ResponseField name="get_escrow_balances / list_escrow_wallets / list_escrow_transactions / get_escrow_transaction" type="tool">
  Read wallet balances, list wallets, and check the status, verdict and receipt of anything proposed. Read-only, no credits.
</ResponseField>

<ResponseField name="topup_credits" type="tool">
  Buy more verification credits over x402, without leaving the conversation.
</ResponseField>

## Example

Prompt: *"Before you place any Polymarket order, call `verify_intent` with my mandate as the intent and the order as the action. Don't execute unless the verdict is ALLOW."*

```
intent:  Buy favorites priced >= 95c only. Reject longshots. Max $10 per market.
action:  BUY YES "Will candidate X win the 2028 nomination?" @ 21c, size $10.

→ Verdict: BLOCK
  The action buys a 21c longshot, violating the "priced >= 95c only" clause…
  Onchain: https://basescan.org/tx/0x…
```

The package is open source on [npm](https://www.npmjs.com/package/chance-mcp) as `chance-mcp`.
