yahoo-fantasy-mcp
A read-only MCP server for reporting on Yahoo Fantasy Sports leagues, teams, and matchups — it never changes anything.
List the fantasy games and seasons your Yahoo account has played (NFL, NBA, MLB, NHL)
List your leagues, optionally filtered by game
Read league settings — scoring rules, roster slots, configuration
Read current league standings (W/L/T, points)
Read recent league transactions — adds, drops, trades
Get matchup scores for a league, optionally for a specific week
Get a team's roster, optionally for a specific week
Get a team's full season matchup history and results
Search a league's player pool by name
Call any other
/fantasy/v2/path directly viayahoo_fantasy_raw_getas an escape hatch
All tools are annotated read-only, so a client can auto-approve them; yahoo_get_my_leagues is the way to discover the league and team keys the other tools need.
Provides access to Yahoo Fantasy Sports data for MLB leagues, including league settings, standings, transactions, scoreboards, team rosters, matchups, and player search.
Provides access to Yahoo Fantasy Sports data for NBA leagues, including league settings, standings, transactions, scoreboards, team rosters, matchups, and player search.
Provides access to Yahoo Fantasy Sports data for NHL leagues, including league settings, standings, transactions, scoreboards, team rosters, matchups, and player search.
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., "@yahoo-fantasy-mcp what are the current standings in my football league?"
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.
yahoo-fantasy-mcp
An MCP server over Yahoo Fantasy Sports, backed by a self-owned Yahoo Developer OAuth2 app. Read-only — it reports on leagues, rosters, and matchups but does not set lineups or make transactions.
10 tools. Runs locally over stdio.
Tools
Tool | Purpose |
| Fantasy games (NFL, NBA, MLB, NHL) the account has played |
| Leagues for the account, optionally filtered by game |
| Scoring rules, roster slots, league configuration |
| Current standings with W/L/T and points |
| Adds, drops, and trades |
| Matchups and scores for a given week |
| A team's roster, optionally for a specific week |
| A team's full matchup history |
| Player search within a league, with filters |
| Escape hatch — arbitrary path against the Fantasy API |
yahoo_fantasy_raw_get exists because Yahoo's API surface is much wider than the
typed tools above, and its response shapes are too irregular to wrap exhaustively.
Use it when a typed tool doesn't cover what you need. Every tool is annotated
readOnlyHint: true, so a client can approve them without prompting.
The exact schemas the model sees are in mcp-surface.json.
Related MCP server: Yahoo Fantasy MCP
Design notes
A rotating refresh token makes parallel calls dangerous
Yahoo issues a new refresh token on every refresh and retires the old one.
Clients call tools in parallel, so when the access token expires, several calls
can find it expired at the same moment. If each refreshed on its own, they would
all present the same refresh token: the first would succeed and spend it, the
rest would get invalid_grant, and depending on which write landed last, the
token on disk could be the dead one — a failure that only shows up an hour
later, as an inexplicable need to re-authorize.
Refresh is therefore single-flight: concurrent callers wait on one refresh, and the rotated token is written to disk before anything uses it. The token store takes its storage and its refresh function as parameters, which is what lets the tests drive four parallel calls through an expiry and assert the refresh token was presented exactly once.
Every request stays inside /fantasy/v2/
League and team keys are interpolated into the request path, and the raw tool
takes a path outright. URL resolution collapses .. — and %2e%2e — so the
check is made on the resolved URL, before the token is read: a path that
would land outside /fantasy/v2/ is refused, and never travels with a bearer
token. Keys are also checked for shape, so passing a league's name where its
key belongs gets an error showing what a key looks like, instead of Yahoo's
opaque 400.
Auth
OAuth2 with a refresh token in credentials/token.json (gitignored). Yahoo
does rotate refresh tokens on use, so the stored token is rewritten after each
refresh — meaning credentials/ must be writable, and restoring an old backup of
it will fail with an invalid-grant error rather than working.
npm run authorize # one-time browser consent
npm run check-auth # verify the stored token still worksThe token file is kept owner-readable only (0600).
Setup
Requires Node 20+.
Create an app at developer.yahoo.com/apps with Fantasy Sports → Read permission. Set the redirect URI to OOB (out-of-band): Yahoo displays the code on screen instead of redirecting, so there is no callback server to run.
Save the id and secret to
credentials/client_secret.json— seecredentials/client_secret.example.json.credentials/is git-ignored.Authorize and register:
npm ci npm run authorize claude mcp add yahoo-fantasy -- node /absolute/path/to/yahoo-fantasy-mcp/src/index.jsOr in Claude Desktop's
claude_desktop_config.json:{ "mcpServers": { "yahoo-fantasy": { "command": "node", "args": ["/absolute/path/to/yahoo-fantasy-mcp/src/index.js"] } } }
Development
npm test # unit tests — no network, no credentials
npm run lint # ESLint
npm run surface # start the server and diff its tool surface against mcp-surface.json
npm run surface:update # re-record mcp-surface.json after an intended changeThe tests cover registration, the OAuth constants that silently break consent if changed (notably the out-of-band redirect), path resolution and key shapes, single-flight refresh with rotation, and rate-limit and timeout messages. CI runs them on Node 20, 22 and 24, then starts the server with mcp-surface and fails if the tool surface differs from the committed snapshot.
Layout
src/shared.js version, timeouts, error shaping, tool-result helpers
src/auth.js token load, single-flight rotate-on-refresh, path guard
src/fantasy.js key validation and all tool registrations
src/index.js McpServer construction + stdio transport
scripts/authorize.js one-time OAuth consent flow
scripts/check-token.js token health check
mcp-surface.json the committed tool surface CI compares againstNotes
Yahoo's resource keys are positional and awkward: a league key looks like
nfl.l.123456, a team key likenfl.l.123456.t.7.yahoo_get_my_leaguesis the reliable way to discover the keys the other tools need.The API returns XML-shaped JSON with numeric-string object keys and
countfields rather than plain arrays. Responses are passed through as-is, so expect that structure rather than idiomatic JSON. They are sent compact, not indented — Yahoo's nesting makes indentation a large share of the tokens.Every request has a 30-second timeout, error bodies are trimmed before they reach the model, and a 429 says when to retry.
License
MIT — see LICENSE. Changes are recorded in CHANGELOG.md.
Available Tools
10 toolsyahoo_fantasy_raw_getRaw Yahoo Fantasy API GETA
Escape hatch: GET any Yahoo Fantasy Sports API path (under /fantasy/v2/) not covered by a dedicated tool, e.g. "/league/{key}/draftresults". Read-only.
Inputs: path (required).
yahoo_get_league_settingsGet league settingsC
Scoring rules, roster positions, and other settings for a league.
Inputs: leagueKey (required).
yahoo_get_league_standingsGet league standingsC
Current standings for a league.
Inputs: leagueKey (required).
yahoo_get_league_transactionsGet league transactionsC
Recent adds/drops/trades in a league.
Inputs: leagueKey (required).
yahoo_get_my_gamesList your fantasy gamesA
Lists every fantasy sport/season (NFL, NBA, MLB, NHL, across years) the logged-in Yahoo account has played.
Inputs: no named parameters.
yahoo_get_my_leaguesList your leagues for a gameA
Lists the leagues the account belongs to for a given game key (e.g. "nfl", "nba", "mlb", "nhl", or a year-specific code).
Inputs: gameKey (required).
yahoo_get_scoreboardGet league scoreboardB
Matchup scores for a league, optionally for a specific week.
Inputs: leagueKey (required), week.
yahoo_get_team_matchupsGet a team's matchupsC
A team's full schedule of matchups and results for the season.
Inputs: teamKey (required).
yahoo_get_team_rosterGet a team rosterC
A team's roster, optionally for a specific week.
Inputs: teamKey (required), week.
yahoo_search_league_playersSearch players in a leagueC
Searches the player pool for a league by name.
Inputs: query (required), leagueKey (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 10 tools
Each tool targets a distinct resource or action (e.g., games, leagues, standings, settings, scoreboard, transactions, players, teams, matchups, plus a raw API escape hatch). No two tools overlap in purpose.
All tools follow a consistent 'yahoo_verb_noun' pattern (e.g., yahoo_get_my_games, yahoo_get_league_standings). The naming convention is uniform and predictable.
With 10 tools, the set is well-scoped for a fantasy sports MCP server. It covers the most common queries without being overwhelming, and each tool serves a clear need.
The tools cover most key read operations for Yahoo Fantasy (games, leagues, standings, scoreboard, transactions, roster, matchups, player search). The raw get tool fills gaps like draft results, but write operations are missing, which is a minor gap for a read-only interface.
Maintenance
Related MCP Connectors
Sports MCP — wraps TheSportsDB API (free tier, test key 3, no auth required)
SportsDataIO MCP — wraps SportsDataIO's Big-Six sports data API (sportsdata.io)
ESPN MCP — keyless multi-sport live scores, teams, and news via ESPN's public site API.
Sports Game Odds MCP — wraps the Sports Game Odds API (sportsgameodds.com)
Related MCP Servers
- AlicenseNot gradedqualityBmaintenanceConnect ESPN & Yahoo fantasy leagues to AI assistants via MCP. Read-only tools for rosters, standings, matchups, free agents, and league info across football and baseball.23MIT
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that provides read-only access to Yahoo Fantasy Sports data, enabling AI assistants to query league standings, player stats, matchups, and rosters.6MIT
- AlicenseNot gradedqualityDmaintenanceProvides read-only access to Sleeper fantasy football leagues, enabling team snapshots, available players, matchups, trade context, and league history through standardized MCP tools.MIT
- AlicenseNot gradedqualityCmaintenanceProvides read-only access to Sleeper fantasy football data including user info, leagues, rosters, matchups, and NFL state through MCP tools.135 npmMIT