Skip to main content
Glama
artemsoldatov

igaming-odds-mcp

README.md
# igaming-odds-mcp

An MCP server that gives an AI assistant a set of exact, deterministic betting-odds tools: format conversions, bookmaker margin, parlay pricing, bet settlement, and Kelly staking. All the money math is integer-cents and floor-rounded, the same discipline a real settlement ledger uses.

It pairs with a companion project, bet-settlement-service, which settles bets on a double-entry ledger.

## Tools it exposes

convert_odds converts a price between decimal, fractional, American and implied probability. bookmaker_margin works out the overround of a market and the fair odds once the margin is stripped out. parlay_odds combines several legs into one accumulator price. settle_single returns the return and profit in integer cents for a single bet. settle_accumulator settles a multi-leg accumulator, where any losing leg loses the whole bet and void legs drop to 1. settle_each_way settles an each-way bet, win and place parts separately. kelly_stake works out a Kelly-criterion stake for a given edge; a negative edge just recommends no stake at all.

Every input goes through a strict Zod schema, so bad odds (a decimal at or below 1, a probability outside 0 to 1, American at 0) come back as a readable tool error instead of a crash.

## Install

```bash
pnpm install
pnpm build
pnpm test      # 22 tests: pure math + a real MCP handshake over stdio
```

## Using it from Claude Desktop

Add this to claude_desktop_config.json (on macOS that's ~/Library/Application Support/Claude/claude_desktop_config.json):

```json
{
  "mcpServers": {
    "igaming-odds": {
      "command": "node",
      "args": ["/absolute/path/to/igaming-odds-mcp/dist/index.js"]
    }
  }
}
```

Then just ask things like "convert 3/2 to American odds", "what's the margin on a 1.90 / 1.90 market", or "Kelly stake for decimal 2.0 at a true 60% with a $1000 bankroll" and it calls the tools instead of guessing at the math.

## Example

Calling bookmaker_margin with decimalOdds [1.9, 1.9] returns:

```json
{
  "overround": 1.052632,
  "marginPct": 5.2632,
  "fairDecimalOdds": [2, 2],
  "fairProbabilities": [0.5, 0.5]
}
```

## A couple of implementation notes

All the logic is pure functions in src/odds.ts; the tool layer only validates input and formats output. Money stays as integer cents and rounding always favors the house, which is asserted in the tests, matching the rule a real settlement engine would follow. Odds convert to exact fractions through a bounded continued-fraction approximation, so something like 1.3333 round-trips to 1/3 instead of some ugly exact decimal.

TDQS

A3.7/5.0

Scored across 7 tools

Disambiguation5/5

Each tool targets a distinct betting/odds concept: conversion, margin, parlay construction, three settlement types, and stake sizing. The settle_* tools are clearly separated by bet structure, and the others are unambiguously different operations.

Naming Consistency3/5

Most tools follow a verb_noun pattern (convert_odds, settle_single, parlay_odds), but bookmaker_margin and kelly_stake are noun phrases, breaking the uniformity. The naming is readable and lowercase with underscores, but the pattern is not fully consistent.

Tool Count5/5

Seven tools is well-scoped for an igaming/odds toolkit, covering core operations without redundancy. Each tool serves a clear purpose and the count is comfortably within the ideal range.

Completeness5/5

The toolset covers the full lifecycle of odds manipulation and bet settlement: conversion, margin calculation, parlay building, single/accumulator/each-way settlement, and stake recommendation. No critical gaps are apparent for the stated domain.

Maintenance

ActivityInactive
ResponsivenessNo issues