sleeper-draft-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@sleeper-draft-mcp Whose turn is it in draft 1234567890? Show available RBs and my roster needs."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
sleeper-draft-mcp
A local MCP server that gives an AI assistant live visibility into a Sleeper fantasy football draft: who's been picked, who's available, whose turn it is, and where your roster is thin.
It uses only Sleeper's public, keyless REST API (https://api.sleeper.app/v1).
No login, no API key, no third-party hosting. See
Auth below.
There's also a static web app in web/ — a browser draft
room (paste a Sleeper draft ID or an ESPN draft link → live picks / available
players / whose turn / roster needs) that talks to Sleeper and ESPN directly and
deploys to GitHub Pages.
Requirements
Node.js >= 22 (uses the built-in
fetch, the test runner, and--experimental-strip-types). Developed on Node 24.
Related MCP server: Sleeper MCP Server
Install & build
npm install
npm run build # tsc -> dist/
npm test # unit tests for the draft math + roster-needs logicRun it directly during development (no build step) with:
npm run devMCP client config
Point your MCP client at the built server over stdio:
{
"mcpServers": {
"sleeper-draft": {
"command": "node",
"args": ["C:/Users/tsjsp/sleeper-draft-mcp/dist/server.js"]
}
}
}(There's a copy of this at mcp.config.example.json.)
Use an absolute path to dist/server.js. Optionally set
SLEEPER_CACHE_DIR in an "env" block to move the player cache.
Tools
Tool | Input | What it returns |
|
| Resolved |
|
|
|
|
| Ordered picks so far: |
|
| Undrafted players (cache minus picks), sorted by Sleeper's |
|
| The pick on the clock (computed from pick count via snake math), the next few picks, and — with |
|
| Your picks so far vs. the league's required starting slots, with thin positions flagged. FLEX / SUPER_FLEX / REC_FLEX aware. |
|
| Sleeper's most-added / most-dropped players. Rough signal only — not rankings. |
| — | Force a re-download of |
Typical flow
get_leaguewith your Sleeper username → pick yourleague_id.get_draft_infowith thatleague_id→ get thedraft_id, confirm draft type, and find yourroster_idin the draft-order table.During the draft, loop on
get_draft_picks/whose_turn(with yourmy_roster_id), andget_available_players/get_my_roster_needswhen you're on the clock.
Player cache
/players/nfl is a ~5 MB JSON blob, so it's fetched once and written to
cache/players.json (override with SLEEPER_CACHE_DIR). It's refreshed
automatically when the file is missing or older than 24h; refresh_player_cache
forces it. The server also warms the cache in the background on startup.
Snake-draft math
src/snake.ts is pure and unit-tested (test/snake.test.ts). It handles:
linear drafts — every round runs slots
1..Nstandard snake — odd rounds
1..N, even roundsN..1third-round reversal (
settings.reversal_round, "3RR") — the flip that would normally happen entering roundreversal_roundis applied one round early, then alternates from there.
whose_turn reads draft.type and draft.settings.reversal_round from Sleeper
rather than assuming pure snake. Auction drafts are detected and reported as
"no turn order".
Auth — does any of this need a key?
No. Every endpoint used here is public and unauthenticated:
GET /state/nfl
GET /user/{username}
GET /user/{user_id}/leagues/nfl/{season}
GET /league/{league_id}
GET /league/{league_id}/drafts
GET /league/{league_id}/users
GET /league/{league_id}/rosters
GET /draft/{draft_id}
GET /draft/{draft_id}/picks
GET /players/nfl
GET /players/nfl/trending/{add|drop}The Sleeper client (src/sleeper.ts) treats any 401/403 as a hard error
that tells you to flag it — so if Sleeper ever starts requiring a key on one of
these, you'll hear about it loudly instead of silently.
Rate limit: stay under ~1000 calls/min. Polling picks every 5–10s during a live draft is well within that.
Dev smoke test
smoke.mjs drives the built server through the MCP client SDK:
node smoke.mjs dist/server.js
# optionally exercise the live-draft tools:
SLEEPER_USER=your_username SLEEPER_DRAFT=some_draft_id node smoke.mjs dist/server.jsWeb app
web/ is a dependency-free static site (vanilla ES modules, no build
step). It calls the Sleeper and ESPN read APIs straight from the browser — both
send permissive CORS headers, so no proxy or server is needed.
Home — one input. Paste a Sleeper draft ID / league ID / username, a
sleeper.com/draft/…URL, or an ESPN draft link (fantasy.espn.com/football/draft?leagueId=…&teamId=…, mock-draft-lobby leagues included — the league must be public). Sleeper numeric input is tried as a draft, then as a league; a username lists that user's leagues to pick from.Draft room (
#/draft/<id>, or#/draft/espn_<leagueId>_<teamId>):On the clock banner — team, round/pick, on-deck, and (once you pick your team) "your next pick is N away". Snake / linear / 3RR aware.
Available players — trimmed player list minus picks, sorted by
search_rank(ESPN: PPR draft rank), with position chips + name search. Once you've picked your team this panel switches to Your picks, listed in draft order.Recent picks — reverse-chronological, your picks highlighted.
Your roster & needs — counts by position vs. the league's required starters (FLEX/SUPER_FLEX/REC_FLEX aware).
Draft board — toggleable snake-aware grid, current pick outlined.
auto-refresh every 6s (toggle), plus a manual refresh. Poll requests are cache-busted so Sleeper's CDN can't serve a stale/empty pick list.
Player dictionary (~5 MB) is fetched once, trimmed to fantasy-relevant players (~tens of KB), and cached in
localStoragefor 24h. "↻ players" forces a refresh. "You are" and recent drafts also persist inlocalStorage. For ESPN drafts the pool is ESPN's top ~400 by PPR draft rank (viakona_player_info), cached per league for 6h.
AI pick suggestions (optional, bring-your-own-key)
The "Claude's pick" panel in the draft room can call the Anthropic API for a live recommendation. It bundles the current state — league format, your roster, roster needs, top ~30 available by ADP, and recent picks — into one prompt and shows Claude's suggested pick plus alternatives.
Draft plan (the collapsible in that panel) is free text saved to
localStorage(keysleeper_draft_plan, shared across drafts). Put your round targets, mid/late targets, and position tactics there — e.g. "Puka in R1", "Kittle rounds 8–10", "no QB before R9", "2 WR + 2 RB by end of R4". It's sent with every ask as strategic guidance; Claude follows it when it can and flags aPLAN:line when it deviates. "Use template" drops in a starting point.Set key stores an Anthropic API key in this browser's
localStorageonly (keysleeper_anthropic_key). It is never committed, never in the deployed JS, and is sent only toapi.anthropic.com(over HTTPS, with theanthropic-dangerous-direct-browser-accessheader). Clearing the field removes it.Put a spend cap on the key. Create a dedicated key in the Anthropic console with a low monthly limit and delete it after draft season — that caps the worst case if the browser it's stored in is ever compromised.
The CSP header restricts outbound requests to Sleeper and Anthropic, so a stray/injected script can't exfiltrate the key elsewhere.
Model is
claude-sonnet-5(fast, ~pennies per draft); changeMODELinweb/lib/advisor.jstoclaude-opus-5for deeper reasoning. Auction drafts aren't supported by the advisor.
Run it locally
cd web && python -m http.server 8777 # or any static server
# open http://localhost:8777Deploy to GitHub Pages
Push this repo to GitHub (default branch
main).Settings → Pages → Build and deployment → Source: GitHub Actions.
The included workflow (
.github/workflows/pages.yml) publishesweb/on every push that touches it. The site lands athttps://<user>.github.io/<repo>/.Edit
REPO_URLat the top ofweb/app.jsso the footer "Source" link points at your repo.
Hash-based routing (#/draft/…) means no Pages redirect config is needed and
draft-room URLs are shareable.
Project layout
src/ MCP server (TypeScript, compiled to dist/)
server.ts MCP server + tool definitions (stdio transport)
sleeper.ts keyless Sleeper REST client + response types
context.ts draft_id/league_id -> resolved draft context (slots, owners, settings)
players.ts disk cache + player-id / name-search indexes
snake.ts pure draft-position math (snake / linear / 3RR)
needs.ts roster-needs vs. required-starters math
web/ static browser app (deployed to Pages)
index.html
app.js router + home + draft-room views
styles.css
lib/ sleeper.js (browser API client), snake.js, needs.js, players.js
test/ MCP server unit tests (node:test)
snake.test.ts
needs.test.ts
web-tests/ web-app checks (run by `npm test`)
logic.mjs snake.js port parity vs. known results
render.mjs mounts app.js in jsdom against a stubbed draftAvailable Tools
8 toolsget_available_playersGet undrafted playersA
Players not yet drafted in this draft, from the cached dictionary minus the picks made. Sorted by Sleeper's search_rank (rough ADP; lower is better). Defaults to fantasy positions only and drops unranked players.
Inputs: draft_id (required), limit, search, position, +2 more.
get_draft_infoGet draft metadataA
Draft settings for a league (or an explicit draft_id): draft type (snake/linear/auction), status, team count, rounds, third-round-reversal flag, the slot -> roster -> owner mapping, and the league's required starting slots.
Inputs: draft_id, league_id.
get_draft_picksGet picks made so farA
Ordered list of picks already made in a draft. Poll this every 5-10s during a live draft. Player names/positions/teams are resolved from the cached player dictionary (falling back to pick metadata).
Inputs: draft_id (required), limit.
get_leagueGet leagues for a userA
Resolve a Sleeper username to a user_id and list that user's NFL leagues for a season (defaults to the current NFL season). Use the returned league_id with the other tools.
Inputs: username (required), season.
get_my_roster_needsRoster needs vs. required startersA
Compare the players a roster has drafted so far against the league's required starting lineup and flag thin positions. Needs the league's roster_positions, so pass league_id (or a draft_id whose league is known).
Inputs: my_roster_id (required), draft_id, league_id.
get_trending_playersTrending adds/dropsB
Sleeper's trending players (most added or dropped across all leagues in the lookback window). Rough signal only — NOT rankings or ADP.
Inputs: type, limit, lookback_hours.
refresh_player_cacheForce-refresh the player cacheA
Re-download Sleeper's /players/nfl dictionary (~5MB) and rewrite the disk cache. Normally automatic (daily); use this if names look stale.
Inputs: no named parameters.
whose_turnWhose pick is itA
Compute the pick currently on the clock from the number of picks made, using snake-draft math (honours linear drafts and third-round reversal). Pass my_roster_id to get an on_the_clock flag and picks-until-your-next-turn.
Inputs: draft_id (required), my_roster_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a clearly distinct task: market trends, cache refresh, on-the-clock computation, roster needs, league resolution, draft settings, draft picks list, and available players. While whose_turn and get_draft_picks both relate to draft state, their descriptions separate the calculation from the raw list, eliminating ambiguity.
Six of eight tools follow the get_<noun> snake_case pattern, but refresh_player_cache uses a different verb and whose_turn is a sentence fragment rather than a verb_noun action. The inconsistency is minor and naming remains predictable overall.
Eight tools form a focused and well-scoped set for live-draft assistance, covering data acquisition, draft configuration, pick tracking, turn calculation, and roster analysis without bloat. The cache refresh tool, though maintenance-oriented, is justified by the large player dictionary requirement.
The tool surface covers the full workflow for preparing and executing a draft: resolve a user's league, fetch draft settings, poll picks, determine whose turn it is, evaluate roster needs, and list undrafted players. No essential draft-related operation is missing, and the trending players tool adds useful pre-draft signal.
Maintenance
Related MCP Connectors
Real-time TikTok profile, video feed, comments, search & HD media metadata API for AI agents.
Live public Instagram and TikTok data for AI assistants: profiles, posts, stories, followers.
Social media data API for AI agents. Live data from any public link, handle or search.
AI Agent Utility Layer for agent safety, web monitoring, crypto research and tool discovery.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceEnables AI models to manage and query fantasy sports leagues through the Sleeper API, supporting tasks like player lookups, league activity, and draft management.MIT
- FlicenseAqualityDmaintenanceEnables natural language interaction with Sleeper Fantasy Football API data, allowing queries about leagues, players, matchups, draft results, and trade analysis.1325-
- FlicenseNot gradedqualityCmaintenanceProvides read-only, league-aware Sleeper fantasy football draft context to AI assistants, including live picks, rosters, and player availability over Streamable HTTP MCP.-
- AlicenseAqualityCmaintenanceEnables AI-assisted live ESPN fantasy football snake drafts by providing league-specific draft context, VORP-based value rankings, tier analysis, and real-time draft state.141MIT