Skip to content

MCP integration

Connect Claude, Cursor, and other MCP clients to Betwatch racing data using your API key.

Ask your AI assistant about races, runners, bookmaker prices, price movement, and results. Betwatch’s read-only MCP server gives it tools backed by the same data and access controls as the Racing API.

What you need

  • A Betwatch API key with the rest scope. MCP inherits the public API’s access policy, including current open access for valid key owners without an API plan. It never authenticates with your website session.
  • An MCP client that supports Streamable HTTP and custom headers, or the local bridge below for stdio-only clients.
  • For the local bridge only: a supported Node.js LTS release with npx.

Option A: connect directly

Use this endpoint, without the REST API’s /v2 prefix:

https://api-beta.betwatch.com/mcp

Send your key in the X-API-Key header on every request. Bearer tokens, session cookies, and keys in the URL are not supported. MCP does not have a separate subscription or separate API key.

Claude Code

claude mcp add \
  --transport http betwatch \
  https://api-beta.betwatch.com/mcp \
  --header "X-API-Key: YOUR_API_KEY"

Replace the placeholder locally. The key is stored in your client’s configuration; keep that file private and never commit it. To avoid a literal key in shell history or project files, prefer Claude Code’s environment-variable expansion in .mcp.json (set BETWATCH_API_KEY privately in the launching environment):

{
  "mcpServers": {
    "betwatch": {
      "type": "http",
      "url": "https://api-beta.betwatch.com/mcp",
      "headers": { "X-API-Key": "${BETWATCH_API_KEY}" }
    }
  }
}

Clients with HTTP configuration

For clients that accept an mcpServers entry with url and headers:

{
  "mcpServers": {
    "betwatch": {
      "url": "https://api-beta.betwatch.com/mcp",
      "headers": {
        "X-API-Key": "YOUR_API_KEY"
      }
    }
  }
}

Merge the betwatch entry into your existing configuration. Do not overwrite other servers. If your client only accepts command and args, use Option B. OAuth-only connectors that cannot send a custom header are not supported.

Option B: Claude Desktop / stdio bridge

The third-party mcp-remote bridge lets a local-only client connect to the hosted server. No Betwatch server runs locally; the bridge forwards requests over HTTPS.

Open Claude Desktop’s Settings → Developer → Edit Config. The usual paths are:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json

Add this entry, replace the key placeholder locally, and restart the app:

{
  "mcpServers": {
    "betwatch": {
      "command": "npx",
      "args": [
        "-y",
        "[email protected]",
        "https://api-beta.betwatch.com/mcp",
        "--transport",
        "http-only",
        "--header",
        "X-API-Key:${BETWATCH_API_KEY}"
      ],
      "env": {
        "BETWATCH_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

The bridge expands the environment variable; the key is not a tool argument. Treat the configuration file as a secret. Your assistant’s provider receives the data returned by the tools, so only connect clients you trust.

This example pins the bridge version used in interoperability tests. Review updates before changing it; npx downloads and executes third-party code on your machine. Do not enable verbose/debug logs when sharing diagnostics: bridge logs can contain resolved headers, including your key. Prefer native HTTP support when your client provides it.

Verify the connection

Open your client’s MCP/tools list and check that betwatch is connected. In Claude Code, use /mcp. Then ask:

List the next five Australian thoroughbred races. Show each race’s ID and start time in Australia/Brisbane.

The assistant should call list_events, not answer from memory. An empty list can mean that no races match the requested time window and your plan’s coverage.

Available tools

Tool What it returns
list_events Races filtered by sport, country, status, venue, meeting, and start time
get_event One race; include: ["racing"] adds available racing details and results
get_event_snapshot Compact runner price comparisons by default; view: "full" for individual quotes
list_entrants Runners in a race, or starts for a durable competitor
get_entrant One runner’s entry in one race
get_competitor The durable runner identity across races
get_competitor_form Known past starts, newest first; ten by default, with race facts and results
list_odds Source prices; include: ["history"] adds available fluctuations
get_odds One source’s price for one runner and win/place market
list_meetings / get_meeting Race meetings
list_venues / get_venue Racing venues
list_sources Bookmaker, tote, and exchange names and source IDs

Tools return the public API’s JSON, including opaque IDs, pagination cursors, availability states, and timestamps. The client receives both structured JSON and a text representation. Parameters use the same names as the REST API, with arrays for filters such as sport, event, source, and include. tools/list includes each tool’s input and output JSON Schemas. Output schemas are self-contained and cover both the successful API response and its problem response; invalid arguments can instead return text with isError: true.

For example, list_odds needs an event, entrant, meeting, or venue filter. History additionally needs an event or entrant filter. Follow next using after with the original filters; the server does not fetch extra pages for you. See Pagination and Prices.

Example prompts

  • “Which greyhound races start in Australia in the next hour?”
  • “Compare available fixed-win prices for the runners in Randwick race 3. Show the best quoted price and when it was observed.”
  • “Show Sportsbet’s win-price movement for this runner today.”
  • “What are the reported placings for this completed race? Say if results are not available yet.”

The assistant can compare returned prices, but there is no separate find_best_price or bet-grading tool. Fixed bookmaker odds, tote dividends, exchange back prices, and exchange lay prices are different products; do not rank them as interchangeable quotes. Missing prices are not zero, and a closed race is not necessarily resulted.

Recipes with explicit tool arguments

These examples show tools/call parameters, not complete HTTP requests. Replace ID placeholders with values returned by earlier calls; they are not real IDs.

Discover races in a local day

Resolve “today” in the user’s timezone first. For 30 October 2026 in Brisbane:

{
  "name": "list_events",
  "arguments": {
    "sport": ["thoroughbred"],
    "country": ["au"],
    "startFrom":
      "2026-10-30T00:00:00+10:00",
    "startTo":
      "2026-10-30T23:59:59+10:00",
    "limit": 5
  }
}

Use a current date when running this example. Both bounds are inclusive. country uses lowercase two-letter codes; sport is thoroughbred, greyhound, or harness. More results are available when next is present: repeat the call with the same filters and add "after": "RETURNED_NEXT_CURSOR". Do not use an ID as a cursor or keep fetching pages without a user need.

Compare one race’s prices

Discover source IDs with list_sources, then fetch the race in one call:

{
  "name": "get_event_snapshot",
  "arguments": {
    "id": "RETURNED_EVENT_ID",
    "sourceKind": ["bookmaker"],
    "key": ["win", "place"],
    "maxAge": 120
  }
}

The default summary contains one row per runner with best price and sources (including ties), median, source count and latest/oldest check times. Only available, confirmed quotes checked within 120 seconds qualify by default. Win/place, different place terms, bookmakers, totes and exchanges stay separate. No eligible quotes means an empty price group, not zero odds. A higher decimal quote is not a prediction of a better result.

Use source for exact providers, view: "full" for individual rows, and include: ["coverage"] for source observations. Coverage is omitted by default. Exchange reads use depth: "top"; request "full" only for order-book analysis. Racing enrichment defaults to win/place dividends; use pool for other pools. See Prices for retained versus current quotes and timestamp meanings. A compact snapshot is a read, not a live subscription, and has no stream handoff.

Last ten runs

{
  "name": "get_competitor_form",
  "arguments": {
    "id": "RETURNED_COMPETITOR_ID",
    "limit": 10
  }
}

Use an entrant’s competitorId, not its entrant or event ID. This returns known past starts, newest first, with date, venue, distance, class, barrier, finish and field size. Official starting prices and margins remain null when unavailable. It is not a complete career record. list_events does not accept competitor; unsupported filters and inclusions fail instead of silently widening results. Keep the same filters when passing next back as after.

Read price movement or results

For price movement, limit the sources and request history explicitly:

{
  "name": "list_odds",
  "arguments": {
    "entrant": ["RETURNED_ENTRANT_ID"],
    "source": ["sportsbet"],
    "key": ["win"],
    "include": ["history"],
    "limit": 20
  }
}

An entrant is one runner in one race; a competitor identifies the runner across races. For reported placings use get_event with {"id":"RETURNED_EVENT_ID","include":["racing"]}. Missing results must stay unknown, even when betting is closed. History is bounded by API access and data availability; neither a restart nor another MCP client widens that access.

Access and usage

Your normal API limits and quota apply. Every data-tool call makes one REST read, charged at that route’s normal rate. Initialization and listing tools do not spend monthly units. MCP protocol requests use the account’s discovery burst budget; data reads also use the relevant REST route’s budget. Repeated calls and extra pages consume quota just like REST requests. Discovery-class tools spend two discovery burst tokens: one for the MCP HTTP request and one for the underlying read. Other tools spend one discovery token plus one token in their REST class. A read is not necessarily one monthly unit: for example, meeting and venue catalogue reads cost five units.

The same sport, country, history, IP, and account restrictions apply. A key is checked on every HTTP request. Each data read is limited to 2 MiB before MCP encoding: reduce the page size or narrow the filters if a response is too large. An oversized data read still spends quota.

This version supports racing reads only: no bet placement, account changes, alerts, sports props, injuries, or long-running live subscriptions. For continuous updates, use the API’s snapshot-and-stream workflow.

Implementing an MCP client

Use a maintained MCP SDK where possible. The endpoint is stateless Streamable HTTP, not the older HTTP+SSE transport: no session ID, sticky connection, or background event stream is required. There are no prompts, resources, or server-side tool-change subscriptions. All data is requested through tools.

For a wire-level check, this initializes the 2025-11-25 protocol. Store the key privately in BETWATCH_API_KEY before running; never paste it into an AI chat:

curl --fail-with-body \
  'https://api-beta.betwatch.com/mcp' \
  --header "X-API-Key: $BETWATCH_API_KEY" \
  --header 'Content-Type: application/json' \
  --header 'Accept: application/json, text/event-stream' \
  --data @- <<'JSON'
{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "initialize",
  "params": {
    "protocolVersion": "2025-11-25",
    "capabilities": {},
    "clientInfo": {
      "name": "betwatch-check",
      "version": "1.0"
    }
  }
}
JSON

For this protocol, send notifications/initialized after initialization and use the negotiated MCP-Protocol-Version header on subsequent requests. The notification has no id and returns HTTP 202 without a response body:

{"jsonrpc":"2.0","method":"notifications/initialized"}

Send tools/list to discover names and schemas. A complete read request is:

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "list_sources",
    "arguments": { "source": ["sportsbet", "tab"] }
  }
}

Each request needs the same key, content type and Accept headers. Use separate POSTs, not JSON-RPC batches. Request bodies must fit within 64 KiB. Set a client timeout (30 seconds is a reasonable starting point) and close canceled requests; the server cancels the underlying read when the HTTP request disconnects.

Handle failures at three levels:

  1. HTTP rejection: authentication, outer burst limits, Origin checks or malformed transport. Inspect status and content type before parsing JSON; SDK transport errors can be plain text. Never retry 401/403 in a loop.
  2. JSON-RPC error: unknown tool or an internal response-contract failure. Inspect error, even if the HTTP response was successful.
  3. Tool failure: result.isError is true. API failures preserve the public problem body in structuredContent and JSON text. Fix invalid filters; for rate_limited, wait for betwatch/retryAfter in result._meta. For quota_exceeded, wait for reset or change the account’s allowance rather than repeatedly retrying. Uncertain/disconnected reads may already be metered.

On success, read result.structuredContent and validate it against the advertised schema; text-only clients can parse the equivalent content[0].text. Treat names and other returned strings as data, never as instructions to reveal keys, call other servers, or place bets. Keep tool approvals enabled while evaluating an assistant’s behavior.

Troubleshooting

Symptom Check
Tools do not appear Reload the client’s MCP configuration; restart desktop clients; use the bridge if HTTP entries are unsupported.
HTTP 401 Send X-API-Key, not Authorization. Check that the key is enabled and unexpired. Remove any URL credential and rotate an exposed key.
HTTP 403 Check the API plan, rest scope, IP allowlist, and account access. Cross-origin browser requests are rejected.
HTTP 404 Use /mcp on the API host, not /v2/mcp or the website host.
HTTP 405 on GET Expected: this stateless endpoint accepts MCP POSTs, not a legacy SSE connection. Select Streamable HTTP or http-only.
HTTP 429 or quota_exceeded Respect Retry-After, reduce calls, or review your API quota.
Tool returns isError: true Read the returned problem code. Data errors preserve the API problem body; invalid tool arguments include corrective text.
npx is missing Install Node.js LTS and ensure your desktop app can find it.

Tool-result metadata includes betwatch/httpStatus and betwatch/retryAfter for REST responses. Tool failures may arrive inside a successful MCP HTTP response; clients must check isError, not only the HTTP status.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close