Skip to main content

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 .env file. The server loads .env on startup and bridges those credentials into the oauth2.json that yahoo_fantasy_api reads. The access token is refreshed automatically, so the server runs unattended after the one-time login.

Setup

  1. 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).
  2. Install dependencies (from the repo root): ./scripts/setup.sh, or from here:

    uv sync
    
  3. 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 .env in the current directory. Run the server from that same directory, or point YAHOO_ENV_FILE at the file (see below).

    On first use the server reads .env and 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's propose_trade is broken upstream (its argument handling is inconsistent with its own helper). Accepting and rejecting trades works.

Metadata

Release files for mcp-yahoo-fantasy 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcp-yahoo-fantasy 0.1.0
File Size Uploaded Provenance Actions
mcp_yahoo_fantasy-0.1.0.tar.gz 58.1 kB Without provenance Details for mcp_yahoo_fantasy-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mcp-yahoo-fantasy 0.1.0
File Interpreter ABI Platform Actions
mcp_yahoo_fantasy-0.1.0-py3-none-any.whl Python 3 none any Details for mcp_yahoo_fantasy-0.1.0-py3-none-any.whl

Total release size: 69.1 kB

Release files / mcp_yahoo_fantasy-0.1.0.tar.gz

Download URL mcp_yahoo_fantasy-0.1.0.tar.gz
Size 58.1 kB
Tags Source
SHA-256 checksum
How to use checksums
5a732b4af3ac9ec1f44b9bff7fb6674480df206c95777be0c66dc224d9d8520b
BLAKE2b-256 checksum
How to use checksums
749607df34f319f2cabc364f05b7c417b68e65e6509d322d66cd135c0999320e
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / mcp_yahoo_fantasy-0.1.0-py3-none-any.whl

Download URL mcp_yahoo_fantasy-0.1.0-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f57c6eb62de2aed9aa667db818bb3314a820919e06e57165f07cb69f7c409e25
BLAKE2b-256 checksum
How to use checksums
db4548a706003bd51fcb7b5c1595872b3703c2635e51eea3f425b331c17142aa
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for mcp-yahoo-fantasy 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page