An MCP server for Yahoo Fantasy Sports (read + write).
Project description
MCP Yahoo Fantasy
An MCP server for Yahoo Fantasy Sports. It wraps
yahoo_fantasy_api and exposes its reads
and writes as MCP tools, working across NFL, NHL, NBA, and MLB.
How it works
- Data: all tools call
yahoo_fantasy_api, which returns plain JSON the model consumes directly. - Auth: Yahoo uses three-legged OAuth2. You authorize once with
uv run yahoo-login, which saves your credentials (one Yahoo app, one long-lived refresh token) to a.envfile. The server loads.envon startup and bridges those credentials into theoauth2.jsonthatyahoo_fantasy_apireads. The access token is refreshed automatically, so the server runs unattended after the one-time login.
Setup
-
Register a Yahoo app at https://developer.yahoo.com/apps/create/.
- Set the application to Confidential Client with Fantasy Sports: Read/Write permission.
- Set the redirect URI to
https://localhost:8000. - Note the Client ID (consumer key) and Client Secret (consumer secret).
-
Install dependencies (from the repo root):
./scripts/setup.sh, or from here:uv sync -
Log in once to mint a refresh token:
uv run yahoo-login --client-id <id> --client-secret <secret>
(Flags are optional -- without them you'll be prompted, or they're read from
.env.) Open the printed URL, approve access, and paste back the verifier code Yahoo shows you. This writes your credentials to.envin the current directory. Run the server from that same directory, or pointYAHOO_ENV_FILEat the file (see below).On first use the server reads
.envand writes a refreshed~/.config/yahoo-fantasy-mcp/oauth2.json; subsequent runs reuse and auto-refresh it.
Configuration (environment variables)
All are optional:
| Variable | Purpose |
|---|---|
YAHOO_LEAGUE_KEY |
Default league key (e.g. 449.l.365083) so tools can omit league_key. Find it with the list_leagues tool. |
YAHOO_ENV_FILE |
Path to the .env written by yahoo-login, if the server doesn't run from the directory it was created in (default ./.env). |
YAHOO_OAUTH_FILE |
Path to the bridged oauth2.json (default ~/.config/yahoo-fantasy-mcp/oauth2.json). |
YAHOO_MCP_CONFIG_DIR |
Directory for the default oauth2.json location. |
YAHOO_CONSUMER_KEY / YAHOO_CONSUMER_SECRET / YAHOO_ACCESS_TOKEN / YAHOO_REFRESH_TOKEN |
The credentials yahoo-login writes to .env; set them directly instead if you prefer (e.g. in your MCP client config). |
Connecting an MCP client
Add the server to your client config (e.g. Claude Desktop's claude_desktop_config.json),
using an absolute path:
{
"mcpServers": {
"yahoo": {
"command": "uv",
"args": ["--directory", "/ABSOLUTE/PATH/TO/mcp-sports/yahoo", "run", "yahoo"],
"env": {
"YAHOO_LEAGUE_KEY": "449.l.365083",
"YAHOO_ENV_FILE": "/ABSOLUTE/PATH/TO/.env"
}
}
}
}
Debug interactively with the MCP Inspector: ../scripts/debug.sh (run from this directory).
Tools
League reads: list_leagues, league_settings, league_standings, league_teams,
league_matchups, league_draft_results, league_transactions, league_stat_categories,
league_roster_positions, current_week.
Player reads: free_agents, waivers, taken_players, player_details, player_stats,
percent_owned.
Team reads: my_team_key, team_details, team_roster, team_matchup_opponent,
proposed_trades.
Writes: set_lineup, add_player, drop_player, add_and_drop_players, claim_player,
claim_and_drop_players, accept_trade, reject_trade.
Most tools accept an optional league_key/team_key; without them they fall back to
YAHOO_LEAGUE_KEY and to your own team in that league.
Note: proposing trades is intentionally omitted --
yahoo_fantasy_api'spropose_tradeis broken upstream (its argument handling is inconsistent with its own helper). Accepting and rejecting trades works.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mcp_yahoo_fantasy-0.1.0.tar.gz.
File metadata
- Download URL: mcp_yahoo_fantasy-0.1.0.tar.gz
- Upload date:
- Size: 58.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a732b4af3ac9ec1f44b9bff7fb6674480df206c95777be0c66dc224d9d8520b
|
|
| MD5 |
076b59c20d60f40e55c262455631f829
|
|
| BLAKE2b-256 |
749607df34f319f2cabc364f05b7c417b68e65e6509d322d66cd135c0999320e
|
File details
Details for the file mcp_yahoo_fantasy-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mcp_yahoo_fantasy-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.25 {"installer":{"name":"uv","version":"0.9.25","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f57c6eb62de2aed9aa667db818bb3314a820919e06e57165f07cb69f7c409e25
|
|
| MD5 |
cbbf4042d561fa5aa156d48491a25499
|
|
| BLAKE2b-256 |
db4548a706003bd51fcb7b5c1595872b3703c2635e51eea3f425b331c17142aa
|