Skip to main content
Glama
mcp-fleaflicker

mcp-fleaflicker

by pete-builds

mcp-fleaflicker

An MCP server for Fleaflicker fantasy leagues. It reads rosters, standings, matchups, boxscores, and draft boards, and it scores stat lines using the league's own published scoring rules rather than a hardcoded scoring system.

Fleaflicker's read API is public and unauthenticated, so this server needs no API key, holds no upstream credential, and exposes no write surface. It cannot change your league.

The server's own HTTP endpoint is a different matter: it requires a bearer token and refuses to start without one. See Authentication.

Why the scoring engine is the interesting part

Most fantasy tooling hardcodes a scoring system, or offers a handful of presets. This server fetches FetchLeagueRules and evaluates whatever it finds, so the same code scores a 6-point-passing-TD superflex league and a standard half-PPR league without a branch.

Three things about Fleaflicker's rule model are load-bearing, and each was verified against the live API rather than assumed:

Zero-valued fields are omitted from the JSON. The API is protobuf-derived and serializes defaults by leaving them out. The shutout rule ("10 extra points when total Points Allowed is exactly 0") arrives with no boundLower and no boundUpper key, because both are 0. Default a missing upper bound to infinity and every defense scores the shutout bonus every week. Missing bounds mean zero, never "unbounded".

RANGE_LOWER_BOUND is two different rules wearing one name. Which one depends on category.multiValue. On a single-valued category it is a once-per-game threshold on the summed total (300 passing yards is +1, once, no matter how far past). On a multi-valued category it fires once per qualifying event (every touchdown of 80+ yards is +4 each).

A touchdown is two categories, not one. The flat 6 points and the long-distance bonus live under separate category ids that share a name within a group. They are linked automatically by (group, name), so one caller-supplied stat key feeds both.

Score one game at a time

Every threshold rule fires on a single game's box score. A receiver with 2,000 yards across 17 games earns the 150-yard bonus only in the games he actually cleared 150. Feeding the engine a season total silently miscounts every bonus in the rule set.

Ambiguous stat keys fail loudly

"Interception" is a passing category worth −2 (the quarterback threw it) and a defensive category worth +2 (the defense caught it). Resolving a bare interception to both nets two picks to exactly zero and reports a confident, wrong number. So any key reaching more than one scoring group refuses to resolve and names the alternatives instead: passing_interception and defense_interception.

Related MCP server: espn-fantasy-mcp

Tools

Tool

What it does

get_league_rules

Roster construction and the complete scoring rule set, including the valid stat keys

get_standings

Records, points for and against, streaks, draft and waiver position

get_roster

One team's lineup by slot, for any week or season

list_matchups

A week's head-to-head games and scores

get_boxscore

Full matchup detail, both lineups, with Fleaflicker's own computed points

get_draft_board

Every pick in true selection order, snake-aware, with since_overall delta polling for a live draft

search_players

The player pool by name or position, with ranks, projections and ownership

get_available_players

The best undrafted players left, ranked by the league's own projection

score_stat_line

Score a stat line under the league's real rules, with a per-rule breakdown

All tools are read-only and idempotent. Every tool returns a JSON string in one of two shapes:

// success
{"data": ...}

// failure — code is from a fixed enum
{"error": "human-readable message", "code": "UPSTREAM_DOWN", "details": {...}}

Codes: UPSTREAM_DOWN, AUTH_FAILED, INVALID_INPUT, NOT_FOUND, RATE_LIMITED, INTERNAL. No exception ever reaches the caller.

Quick start

git clone https://github.com/pete-builds/mcp-fleaflicker.git
cd mcp-fleaflicker
cp .env.example .env          # set FLEAFLICKER_LEAGUE_ID, or leave it blank
chmod 600 .env
python3 -c "import secrets; print(secrets.token_urlsafe(32))"
# paste that value into .env as MCP_AUTH_TOKEN=<token>
docker compose up -d --build
curl -s localhost:3727/healthz

The token step is not optional. Without MCP_AUTH_TOKEN in .env the container exits at once with Refusing to start streamable-http with no auth provider.

Then register it with your MCP client, sending the same token:

claude mcp add --transport http --scope user fleaflicker http://localhost:3727/mcp \
  --header "Authorization: Bearer <token>"

Running from source instead:

python -m venv .venv && .venv/bin/pip install -r requirements-dev.in
MCP_AUTH_TOKEN=<token> .venv/bin/python server.py     # HTTP on :3727
MCP_TRANSPORT=stdio .venv/bin/python server.py        # stdio, no token needed

Authentication

Over HTTP, which is the default transport and what docker compose runs, a bearer token is required. There is no setting that turns this off.

  • No token, no server. If MCP_AUTH_TOKEN is unset, empty, or blank, the process exits non-zero before it opens a port. MCP_AUTH_REQUIRED=false does not change that; it used to mean "run open" and is now ignored for HTTP.

  • Every request to /mcp must carry it. A missing or wrong Authorization: Bearer <token> header is answered 401.

  • /healthz needs no token. It sits outside the auth layer so the container healthcheck and an uptime monitor can read it. It reports liveness and configuration only, and never the token.

  • stdio needs no token. It is a local pipe with no network listener. Set MCP_TRANSPORT=stdio and nothing else.

Generate a token:

python3 -c "import secrets; print(secrets.token_urlsafe(32))"

Put it in .env on the host as MCP_AUTH_TOKEN=<token> and make the file readable by you alone (chmod 600 .env). Keep it out of docker-compose.yml and out of git; .env is already gitignored and excluded from the image.

A client entry, for clients configured by JSON (.mcp.json and similar):

{
  "mcpServers": {
    "fleaflicker": {
      "type": "http",
      "url": "http://localhost:3727/mcp",
      "headers": { "Authorization": "Bearer <token>" }
    }
  }
}

From another machine, replace localhost with the host's address. To rotate the token, change it in .env, run docker compose up -d, and update each client.

Finding your league id

It is in the league URL: fleaflicker.com/nfl/leagues/14153 is league 14153.

Setting FLEAFLICKER_LEAGUE_ID makes every tool's league_id argument optional. Leaving it unset is also valid: callers then pass league_id per call, which is how one deployment serves several leagues.

Live-draft notes

Three upstream behaviours matter during a draft, each verified against the live API rather than assumed.

The board states the true pick number; do not count cells. Every cell of FetchLeagueDraftBoard carries slot = {round, slot, overall}, and that overall is already snake-aware. The grid renders each team in a fixed column, so in a snake the even rounds fill right to left and a left-to-right counter assigns the wrong number to every pick in them. get_draft_board reads the field and reports draft_type outright.

FetchPlayerListing rejects a season parameter. Any value, including the current season, returns HTTP 400 with an HTML body while every other endpoint requires one. search_players and get_available_players still accept season and deliberately never forward it.

filter.position.label is accepted and ignored. Asking the listing for tight ends returns quarterbacks and defenses at HTTP 200. Position filtering happens client-side.

Configuration

Variable

Default

Purpose

FLEAFLICKER_LEAGUE_ID

(unset)

Default league. Optional; every tool takes a per-call override

FLEAFLICKER_SPORT

NFL

Only NFL has been verified

FLEAFLICKER_BASE_URL

https://www.fleaflicker.com/api

Override for testing against a mock

FLEAFLICKER_TIMEOUT

30

Per-request timeout, seconds

MCP_PORT

3727

Listen port

LOG_LEVEL / LOG_FORMAT

INFO / text

text or json

MCP_AUTH_TOKEN

(unset)

Required for HTTP. The bearer token every client sends to /mcp. The server will not start over HTTP without it

MCP_TRANSPORT

streamable-http

streamable-http or stdio. stdio needs no token

Scoring examples

Get the valid stat keys first:

get_league_rules()  ->  data.scoring.stat_keys

A plain number is a count or total. A list is per-event yardage, which is what distance bonuses need:

score_stat_line(
    stats={"passing_yard": 318, "passing_td": [45, 12], "passing_interception": 1},
    position="QB",
)

That is two passing touchdowns, one of 45 yards and one of 12: the flat rule scores twice and the 40-to-79 bonus once. Passing {"passing_td": 2} instead scores the flat rule and reports the distance bonus under unresolved_bonuses, rather than silently scoring it as zero.

The response carries the arithmetic, not just the total:

{"data": {
  "position": "QB",
  "total": 31.52,
  "breakdown": [
    {"category": "passing_yard", "kind": "linear", "points": 8.72,
     "detail": "218 / 25 x 1", "rule": "1 point for every 25 Passing Yards (0.04 per)"},
    ...
  ],
  "unscored_keys": [],
  "unresolved_bonuses": []
}}

Testing

.venv/bin/python -m pytest -q     # 121 tests
.venv/bin/ruff check .

Fixtures under tests/fixtures/ are real captures from the live API, trimmed to the fields the code reads. They are real rather than hand-written on purpose: the behaviours that bite here — omitted zero fields, one touchdown spanning two category ids, a bonus whose bounds are both absent — are exactly the ones a hand-written fixture would smooth over.

The scoring tests include oracle tests that reconstruct real stat lines and assert against the totals Fleaflicker itself published for those games, so the engine is checked against the platform rather than against its own arithmetic.

What this does not do

It builds no model of its own. There is no ranking engine, no waiver recommendation, and no start/sit advice.

It does now surface a projection, but that projection is Fleaflicker's, not this server's: projected_points is the platform's own viewingProjectedPoints, already computed under the league's real scoring rules, and it is passed through unchanged. Read it next to rank_draft, which is the default board the rest of the league drafts from, and the gap between the two is the whole mispricing signal. For a projection this server computes, feed your own projected stat line into score_stat_line; those stat lines still have to come from somewhere else.

It is also unofficial and not affiliated with Fleaflicker. The API it uses is public but undocumented, so a shape change upstream can break a normaliser; the tests are built to catch that quickly.

License

MIT. See LICENSE.

Available Tools

9 tools
get_available_playersGet Available PlayersA
Read-onlyIdempotent

Get the best undrafted players left, ranked by projected points.

This is the during-a-draft tool: it answers "who is actually still on the board" in one call, without diffing a draft board against a ranking list. Everything returned is unowned right now.

Returns JSON with data.players[] sorted by projected_points descending, plus data.returned, data.pool_size (the whole free agent pool upstream) and data.scanned (how many were examined).

Each player carries id, name, position, pro_team, bye_week, percent_owned, projected_points, and rank_draft (overall, positional, label like "QB29", rating) when the league publishes one. The key matches search_players so both tools read the same.

projected_points is Fleaflicker's own projection computed under THIS league's scoring rules, so it already accounts for superflex, passing TD value and every bonus. rank_draft is the default board the rest of the room is drafting from. A large gap between the two is a mispriced player.

Cost: the pool is unsorted upstream and pages at 30, so one call walks the whole free agent pool (roughly a dozen requests) to rank it. Call it when you need the board, not on a tight poll loop.

Position filtering is applied here rather than upstream, because Fleaflicker accepts filter.position.label and then ignores it.

Idempotent: yes, read-only.

Example: get_available_players(position="TE", limit=10)

Inputs: limit, position, league_id, min_projected. Returns: result

get_boxscoreGet BoxscoreA
Read-onlyIdempotent

Get one matchup's full boxscore: every slot, both teams, with points.

Returns JSON with data.game_id, data.week, data.home and data.away team stubs, data.home_total / data.away_total, data.home_optimum / data.away_optimum, data.is_final, and data.slots[]. Each slot carries slot, group, and a home and away player (or null), each with name, position, points, and a stats summary keyed by category name.

Two things here are worth knowing. The per-player points are Fleaflicker's own computed totals, so this is the authoritative check on anything score_stat_line produces for the same player and week. And *_optimum is what the roster would have scored with a perfect lineup, so the gap to the actual total is points left on the bench.

Idempotent: yes, read-only.

Example: get_boxscore(fantasy_game_id=56361068)

Inputs: fantasy_game_id (required), league_id. Returns: result

get_draft_boardGet Draft BoardA
Read-onlyIdempotent

Get a draft's picks as one flat list in true selection order.

Built for polling a LIVE draft. Call it once with no since_overall to get the board so far, then pass back data.next_overall - 1 on every later call to receive only what is new. On a 14-team board that is the difference between roughly 42 KB and a few hundred bytes per poll.

Returns JSON with data.draft_type (SNAKE, LINEAR or UNKNOWN), data.total_picks (every seat on the board), data.picks_made, data.next_overall (the pick number that lands next), data.returned (how many picks this call carried), and data.picks[]. data.draft_order[] (slot, id, name) is present only on a call with no since_overall, because the seat order cannot change mid-draft and resending it would be most of a delta poll's payload.

Each pick carries overall, round, pick_in_round, team, team_id, and player (id, name, position, pro_team, bye_week, percent_owned).

overall is the TRUE selection number read from the upstream, already snake-aware: in a snake, round 2 column 1 is overall 28, not 15. Do not infer pick order from a board's left-to-right layout, which is a static grid and reverses against the real sequence in even rounds.

picks_made and next_overall always describe the whole draft, never the filtered slice, so they stay valid as a polling cursor. Undrafted seats are omitted rather than sent as nulls: check picks_made == 0 to tell whether a season has drafted at all.

Pass needs_for_team to get data.needs alongside the picks: that team's live roster counts against the league's own position minimums and maximums, as positions[LABEL] with min, max, starts, have, still_required and room.

Idempotent: yes, read-only.

Example: get_draft_board(since_overall=104, needs_for_team=1255738)

Inputs: season, team_id, league_id, since_overall, +1 more. Returns: result

get_league_rulesGet League RulesA
Read-onlyIdempotent

Get a league's roster construction and its complete scoring rules.

Read this before scoring anything: it returns the exact stat keys score_stat_line accepts. The two tools pair up, this one says what the league scores, that one applies it.

Returns JSON with data.roster (starters, bench, max_active, max_roster_size, and positions[] carrying each slot's label, eligibility, starts, roster_min, roster_max) and data.scoring (rule_count, stat_keys[], and rules[] with category, category_id, group, points, kind, multi_value, applies_to, description).

kind explains how a rule fires: linear is points per unit, total_threshold is a one-time bonus when a single game's total clears a bound (300 passing yards), total_range is a one-time bonus inside a closed range (a shutout), and per_event is a bonus per qualifying event (each touchdown of 40+ yards).

Idempotent: yes, read-only.

Example: get_league_rules(league_id=14153)

Inputs: league_id. Returns: result

get_rosterGet RosterA
Read-onlyIdempotent

Get one team's roster, organised by lineup slot.

Returns JSON with data.slots[], starters first. Each slot carries slot (the position label), group (START, or null for bench), eligibility[], and player (or null for an empty slot) with id, name, position, pro_team, bye_week, points, season_total, season_average.

Get team ids from get_standings.

Idempotent: yes, read-only.

Example: get_roster(team_id=1255738, season=2025, week=1)

Inputs: team_id (required), week, season, league_id. Returns: result

get_standingsGet StandingsA
Read-onlyIdempotent

Get league standings: records, points for and against, streaks.

Returns JSON with data.league (id, name, size), data.season, and data.teams[] sorted by wins then points for. Each team carries rank, id, name, owner, division, record (wins, losses, ties, win_percentage, formatted), points_for, points_against, streak, draft_position, waiver_position.

Team ids from here are what get_roster takes. division is an empty string in single-division leagues.

Idempotent: yes, read-only.

Example: get_standings(season=2025)

Inputs: season, league_id. Returns: result

list_matchupsList MatchupsA
Read-onlyIdempotent

List a week's head-to-head matchups and scores.

Returns JSON with data.week and data.games[], each carrying id (pass it to get_boxscore), home and away team stubs, home_score, away_score, home_result / away_result (WIN, LOSE, or TIE), and is_final.

Idempotent: yes, read-only.

Example: list_matchups(week=1, season=2025)

Inputs: week, season, league_id. Returns: result

score_stat_lineScore Stat LineA
Read-onlyIdempotent

Score one game's stat line under a league's real scoring rules.

Fetches the league's published rules and applies them, so bonuses, thresholds, and position restrictions are the league's own, not a generic PPR approximation.

Score one game at a time. Every bonus in a Fleaflicker rule set fires on a single game's box score, so a season total run through this tool will miscount them: a receiver with 2,000 yards over 17 games earns the 150-yard bonus only in the games he actually cleared 150.

Call get_league_rules for the valid stat keys (data.scoring.stat_keys). A plain number is a count or total. A list is the per-event yardage that distance bonuses need: {"passing_td": [45, 12]} is two passing touchdowns, one of 45 yards and one of 12, scoring the flat rule twice and the 40-to-79 bonus once. Passing {"passing_td": 2} scores the flat rule and reports the bonus under unresolved_bonuses rather than silently scoring it as zero.

Returns JSON with data.total (the score), data.breakdown[] (one entry per contributing rule, with category, group, kind, points, rule, and detail showing the arithmetic), data.unscored_keys[] (keys this league does not score, usually a typo), and data.unresolved_bonuses[] (distance bonuses that needed a list).

A stat key that matches more than one scoring group fails with INVALID_INPUT and names the alternatives, rather than guessing. In most leagues interception is the one that collides: use passing_interception (thrown, negative) or defense_interception (caught, positive).

Idempotent: yes, pure computation over a read-only rule fetch.

Example: score_stat_line(stats={"passing_yard": 318, "passing_td": [45, 12], "passing_interception": 1}, position="QB")

Inputs: stats (required), position, league_id. Returns: result

search_playersSearch PlayersA
Read-onlyIdempotent

Search the league's player pool by name or position.

Returns JSON with data.players[], each carrying id, name, position, pro_team, bye_week, percent_owned, owned_by (empty string when unowned), season_total, season_average, and rank_fantasy / rank_draft as {overall, positional} when the league publishes them. Also data.total (pool size upstream), data.returned, and data.next_offset (null when exhausted).

A name that matches nothing returns an empty list, not an error.

Read data.next_offset before concluding a name is not in the pool. Name matching happens client-side over fetched pages, and a name search scans at most 12 upstream pages (360 players) per call. So a search can stop with fewer than limit results while matches remain further down the pool -- most likely for a common substring, or a position with a deep pool late in a season.

data.returned does NOT distinguish those two cases and must not be used to decide: a short result means only "this call ended", never "the pool is exhausted". data.next_offset is the one that separates them. It is null only when the pool really is exhausted, and non-null whenever there is more to read -- whether because you hit limit or because the page cap stopped the scan. Call again with offset=data.next_offset to continue from where this one stopped.

Idempotent: yes, read-only.

Example: search_players(name="Chase", position="WR")

Inputs: name, limit, offset, season, +3 more. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.1/5.0

    Scored across 9 tools

    Disambiguation4/5

    Each tool targets a distinct resource: rules, standings, draft board, roster, matchups, boxscore, scoring. The one soft spot is search_players vs get_available_players, which both return player lists, though the descriptions clearly separate name/position search over the full pool from ranked unowned players during a draft. get_league_rules and score_stat_line are explicitly cross-referenced as a pair rather than duplicated.

    Naming Consistency5/5

    All nine tools are snake_case verb_noun and consistent throughout (get_*, list_*, search_*, score_stat_line). Verb choice matches semantics: get_ for single-resource reads, list_ for collections, search_ for filtered queries.

    Tool Count5/5

    Nine tools is squarely in the well-scoped range. Each one covers a distinct slice of the fantasy-football workflow (rules, standings, draft, roster, players, matchups, boxscore, scoring) with no filler.

    Completeness4/5

    The read/analysis surface is strong: rules, standings, live draft polling with delta cursors, rosters, free agents, matchups, boxscores, and an independent scoring engine that cross-validates against boxscores. Gaps are moderate rather than blocking: no transactions/waivers/trade history, no player-detail tool, and no way to discover league or team ids from within the surface (ids are referenced from other tools but never listed).

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Provides read-only access to the Sleeper Fantasy Sports API for league info, rosters, matchups, drafts, transactions, and player data.
      18
      1
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables AI clients to read and write ESPN fantasy sports leagues using your own session cookies, including managing rosters, lineups, waiver claims, and free agent adds without a browser.
      17
      1
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables reading Sleeper fantasy football rosters, matchups, standings, news, chat, and pick'em entries, with optional write actions for setting lineups, claiming waivers, and proposing trades.
      39
      2
      MIT
    • F
      license
      A
      quality
      C
      maintenance
      Enables access to Sleeper fantasy football data, including users, leagues, rosters, matchups, transactions, drafts, and player information.
      13
      9 npm
      -