MCP server

MCP server

ParlayLedger MCP server

Connect Claude, Cursor or any MCP client to ParlayLedger with your API key. Agents get a tool that backtests a betting strategy on ParlayLedger's historical odds and results.

POSThttps://api.parlayledger.com/mcp
  • Transport Streamable HTTP
  • Sessions Stateless
  • Responses JSON

The server is stateless: every request stands alone, there is no session id and no event stream to resume. Clients send JSON-RPC over POST. GET and DELETE on /mcp return 405.

Authentication

Use the same customer API key as the REST API, from your dashboard. Send it either way:

  • X-API-Key: <apiKey>
  • Authorization: Bearer <apiKey>

The key must belong to a ParlayLedger account. Every request, including initialize and tools/list, needs a valid key.

Metering

  • Each tools/call is metered as one API call against your monthly quota, with the same quota headers and the same 429 when it runs out.
  • initialize, tools/list and ping are not metered.
  • Send one tools/call per HTTP request. A JSON-RPC batch with more than one is rejected with 400.
  • On top of the API call, backtest_strategy uses one backtest from your plan's monthly backtest limit.

Connect a client

Put your key in an environment variable, for example PARLAYLEDGER_API_KEY, rather than in a file you commit.

Claude Code

Add it with the CLI, or commit a project .mcp.json that reads the key from the environment. Add --scope user to the CLI command to use it in every project.

claude mcp add --transport http parlayledger https://api.parlayledger.com/mcp \
  --header "X-API-Key: $PARLAYLEDGER_API_KEY"

Cursor

Add the server to ~/.cursor/mcp.json, or to .cursor/mcp.json in a project.

Cursor
{
  "mcpServers": {
    "parlayledger": {
      "url": "https://api.parlayledger.com/mcp",
      "headers": {
        "X-API-Key": "${env:PARLAYLEDGER_API_KEY}"
      }
    }
  }
}

Claude Desktop

Two ways to connect. Use whichever your account supports.

  1. Connectors with a request header In Settings → Connectors → Add custom connector, enter the server URL, choose no sign-in, and add an x-api-key request header with your key.
    Note:

    May not be on your account

    Connector request headers are in beta and may not be available on every account. If you do not see them, use option 2.

  2. The mcp-remote bridge Add this to claude_desktop_config.json and restart Claude Desktop. It runs the mcp-remote package with npx, which needs Node.js, and sends your key as a header.
    claude_desktop_config.json
    {
      "mcpServers": {
        "parlayledger": {
          "command": "npx",
          "args": [
            "mcp-remote",
            "https://api.parlayledger.com/mcp",
            "--header",
            "X-API-Key:${PARLAYLEDGER_API_KEY}"
          ],
          "env": {
            "PARLAYLEDGER_API_KEY": "YOUR_API_KEY"
          }
        }
      }
    }

Other clients

Most clients that support remote HTTP servers take a URL and headers:

Generic config
{
  "mcpServers": {
    "parlayledger": {
      "url": "https://api.parlayledger.com/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Try it with cURL

tools/call
curl https://api.parlayledger.com/mcp \
  -H "X-API-Key: $PARLAYLEDGER_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{
    "jsonrpc": "2.0",
    "id": 1,
    "method": "tools/call",
    "params": {
      "name": "backtest_strategy",
      "arguments": {
        "rules": {
          "version": 1, "sport": "icehockey", "league": "NHL", "market": "moneyline", "side": "home",
          "conditions": [{ "field": "home_is_favorite", "op": "eq", "value": false }],
          "price": { "source": "consensus" }, "stake": { "units": 1 }
        }
      }
    }
  }'

The result is a JSON-RPC response whose result.content[0].text holds the tool output as JSON.

backtest_strategy

Backtest a sports betting strategy against ParlayLedger historical odds and results. Accepts Rule DSL v1 JSON or the id of a published strategy.

Arguments

Send exactly one of the two.

  • rulesobject (Rule DSL v1)optional

    The strategy: version 1, league, market (moneyline, spread or total), side, up to six conditions on pregame fields, price and stake.

  • publicationIdstringoptional

    The id of a published ParlayLedger strategy.

Arguments
{
  "rules": {
    "version": 1,
    "sport": "icehockey",
    "league": "NHL",
    "market": "moneyline",
    "side": "home",
    "conditions": [
      {
        "field": "home_is_favorite",
        "op": "eq",
        "value": false
      },
      {
        "field": "home_prev_result",
        "op": "eq",
        "value": "loss"
      }
    ],
    "price": {
      "source": "consensus"
    },
    "stake": {
      "units": 1
    }
  }
}

Rules use pregame information only, so a backtest never sees the result of the game it is betting on.

Result

FieldTypeDescription
samplenumberGraded bets, pushes included. Voids are not bets.
wins, losses, pushesnumberResults at 1 unit per bet.
winRatenumber | nullWins over wins plus losses.
units, roinumber, number | nullProfit in units, and units per bet.
maxDrawdownUnitsnumberLargest peak to trough fall, in units.
byMontharray{ month, bets, units } per month.
windowobject | null{ from, to }: the first and last game in the sample.
warningsstring[]Codes such as sample_below_minimum or legacy_pricing.
rulesHash, dataVersionstringIdentify the exact rules and data the run used.
rules, rulesTextobject, string[]The normalized rules and their plain-English text.
publicationIdstringPresent when you backtested a published strategy.

Errors and limits

A tool that cannot run returns a result with isError: true and one of these messages:

MessageWhat to do
You've used this month's backtests.Wait for next month or upgrade your plan.
Send either rules or publicationId.Pass rules or publicationId, not both.
MCP tools need the API key of a ParlayLedger account.Use the key from your ParlayLedger dashboard.

HTTP errors come before the tool runs:

  • 400Send one tools/call per request.
  • 401Valid X-API-Key required, or Invalid API key
  • 405GET or DELETE on /mcp
  • 429Monthly API quota exceeded