espn-fantasy-football-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., "@espn-fantasy-football-mcpshow me my roster for this week"
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.
espn-fantasy-football-mcp
A TypeScript MCP server for ESPN fantasy football over stdio. Read league settings, rosters, available players, matchups and transactions. Update lineups, add or drop players, and manage waiver claims.
Tools return readable text and structured results. Player tables include ESPN ids, slots, opponents, injuries and projected points. Missing statistics are null, distinct from a recorded or projected zero. Text displays missing values as - and points to one decimal.
Install
Requires Node.js 22.12 or newer and npm. From a checkout of this repository:
npm install && npm run buildRun the built server with your league id:
ESPN_LEAGUE_ID=123456 ESPN_READ_ONLY=1 node dist/index.jsThe server waits for an MCP client on stdin. It does not provide an interactive command prompt. Stdout carries only MCP messages. Startup errors go to stderr.
Related MCP server: yahoo-fantasy-mcp
Configuration
Supply environment variables to the server process:
Variable | Required | Meaning and default |
| Yes | Integer league id from the league URL's |
| No | Integer NFL season year. Defaults to the current calendar year. Set it explicitly when viewing a season after New Year's Day. |
| No | Integer fantasy team id from your team's URL. Used when a tool omits |
| Private reads and all writes | The |
| Private reads and all writes | The |
| No |
|
Credentials are trimmed at the edges but are never URL-decoded. Cookies are sent only when both values are present. Public leagues can be read without credentials. A private league usually returns a 401 error when cookies are missing or expired.
Claude Code
Register a public league in read-only mode. Replace the path and ids with your own:
claude mcp add --transport stdio --scope user \
-e ESPN_LEAGUE_ID=123456 -e ESPN_SEASON=2026 \
-e ESPN_TEAM_ID=1 -e ESPN_READ_ONLY=1 \
espn-fantasy-football -- node /absolute/path/espn-fantasy-football-mcp/dist/index.jsFor a private league, supply ESPN_S2 and ESPN_SWID through the server's environment using your client's local secret configuration or a launcher that reads your secret manager. Keep credentials out of shared project configuration.
Generic MCP client
Most stdio clients accept a configuration shaped like this:
{
"mcpServers": {
"espn-fantasy-football": {
"command": "node",
"args": ["/absolute/path/espn-fantasy-football-mcp/dist/index.js"],
"env": {
"ESPN_LEAGUE_ID": "123456",
"ESPN_SEASON": "2026",
"ESPN_TEAM_ID": "1",
"ESPN_READ_ONLY": "1"
}
}
}
}Clients launched from a desktop may need an absolute path to node. Restart the MCP server after changing its environment.
Tools
? marks an optional argument. teamId means an ESPN fantasy team id, not an NFL team id. Player ids are ESPN ids. D/ST ids are negative: Chargers D/ST is -16024, following -16000 - proTeamId.
week defaults to the league's current NFL scoringPeriodId. Tools that need a team use the argument or ESPN_TEAM_ID and return an error if neither is set. Limits must be positive integers.
Tool | Arguments | Result and use |
| None | League settings, lineup slot counts, waiver and trade rules, and teams with owners, records and waiver ranks. |
|
| Team name and roster, ordered by starting slot, then bench and IR. Includes eligibility, bye weeks, opponents, kickoff times, injuries, ownership and weekly/season points. |
|
| Free agents and waiver players with availability and ranks. Positions: |
|
| Name substring search across rosters and ESPN's player pool. Returns status and fantasy team ownership, deduplicated by player id with rostered matches first. |
|
| Scores and live projections with team names. |
|
| Recent transactions, newest first, including ids, status, bids, dates and item player ids. ESPN does not include player names in this view. |
|
| One roster transaction for all listed moves. Checks each player's current slot and eligibility. |
|
| Add a free agent, optionally dropping another player in the same transaction. |
|
| Drop one rostered player. |
|
| Submit a waiver claim with an optional drop. Bid must be a nonnegative integer. |
|
| Cancel a pending claim using its transaction id from |
Every write returns { dryRun, payload, result? }. dryRun: true previews the exact payload without posting, but still requires credentials and may fetch current league data. The default is false, which submits immediately. ESPN enforces ownership, locks, roster capacity, budgets and waiver rules. A preview does not guarantee ESPN will accept the transaction later.
Lineup slot names are case-sensitive. Use eligibleSlots from get_roster, such as QB, RB, WR, TE, FLEX, OP, D/ST, K, BE or IR. To swap players, list both moves. The server never adds counter-moves. Unknown position and slot ids display as POS<id> and SLOT<id>.
Validation and ESPN errors return isError: true with a text message. Check transaction status before repeating a write after a connection failure, since ESPN may already have processed it.
Credentials and security
espn_s2 is a full account session. Never commit it or paste it into chats. Treat it like a password, and protect SWID too.
To find the cookies:
Sign in to ESPN and open your league on
fantasy.espn.com.Open browser DevTools, then Application, Storage, Cookies.
Select the ESPN cookie store for the page and locate
espn_s2andSWID.Copy their values into a secret manager or private local configuration. Preserve URL encoding and braces. Refresh them there if the session expires.
ESPN_READ_ONLY=1 disables every write tool before any fetch, even with dryRun: true. Enable writes only for a trusted MCP client and review the requested moves. The server does not ask for confirmation before submitting. The configured team is a default, not an access restriction, and the cookies may authorize actions beyond that team.
The server sends credentials only to the configured ESPN hosts and refuses redirects. It does not save credentials or league data to disk. Your MCP client can retain tool results, including team/member ids and transaction payloads, so protect its history and logs as well.
API and development
ESPN's fantasy API is unofficial and can change without notice. Reads use lm-api-reads.fantasy.espn.com. Writes use lm-api-writes.fantasy.espn.com. This project is not affiliated with ESPN.
Payload builders live in src/espn/transactions.ts. ESPN ids, views, filter sort keys, endpoints and protocol constants live in src/espn/constants.ts. Only the NFL team schedule index is cached, per server instance. Other data is fetched for each tool call. There are no automatic retries.
npm run typecheck
npm test
npm run buildThe tests inject fetch and use local fixtures. They do not contact ESPN. CI runs these checks on Node 24. On Node 22.12 through 22.17, direct TypeScript test execution requires NODE_OPTIONS=--experimental-strip-types; compiled server execution does not.
License
MIT. See LICENSE.
Available Tools
11 toolsadd_playerAdd a free agentADestructive
Add an available free agent, optionally dropping a rostered player in the same transaction. Use submit_waiver_claim for players on waivers. Player ids are ESPN ids, including negative D/ST ids. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. week defaults to the current NFL week. dryRun previews the payload without posting. Requires ESPN_S2 and ESPN_SWID.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| dryRun | No | Preview the payload without posting it to ESPN. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. | |
| playerId | Yes | ESPN player id. D/ST ids are negative, such as -16024 for the Chargers. | |
| dropPlayerId | No | ESPN player id. D/ST ids are negative, such as -16024 for the Chargers. |
Output Schema
| Name | Required | Description |
|---|---|---|
| dryRun | Yes | |
| result | No | |
| payload | Yes |
cancel_waiver_claimCancel a waiver claimADestructive
Cancel a pending waiver claim using its ESPN transactionId from get_transactions. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. week defaults to the current NFL week. dryRun previews the payload without posting. Requires ESPN_S2 and ESPN_SWID.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| dryRun | No | Preview the payload without posting it to ESPN. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. | |
| transactionId | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| dryRun | Yes | |
| result | No | |
| payload | Yes |
drop_playerDrop a rostered playerADestructive
Release one player from your fantasy team. ESPN enforces roster locks and league rules. Player ids are ESPN ids, including negative D/ST ids. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. week defaults to the current NFL week. dryRun previews the payload without posting. Requires ESPN_S2 and ESPN_SWID.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| dryRun | No | Preview the payload without posting it to ESPN. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. | |
| playerId | Yes | ESPN player id. D/ST ids are negative, such as -16024 for the Chargers. |
Output Schema
| Name | Required | Description |
|---|---|---|
| dryRun | Yes | |
| result | No | |
| payload | Yes |
get_free_agentsFree agents and waiversARead-only
Find available players to add or claim, with optional position filters and ownership or projection sorting. Player ids are ESPN ids, including negative D/ST ids.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| limit | No | ||
| sortBy | No | percentOwned | |
| positions | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| week | Yes | |
| players | Yes |
get_leagueLeague and standingsARead-only
Inspect league settings, lineup slots, waiver rules and team standings before managing a team. Team ids identify ESPN fantasy teams.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
| teams | Yes | |
| league | Yes |
get_matchupsWeekly matchupsARead-only
Check scores and live projections for a week, with the configured team's matchup marked mine. Team ids are ESPN fantasy team ids.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. |
Output Schema
| Name | Required | Description |
|---|---|---|
| week | Yes | |
| matchups | Yes |
get_rosterTeam rosterARead-only
Inspect a team's lineup, eligible slots, injuries, opponents and projections before making moves. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. Player ids are ESPN ids, including negative D/ST ids.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. |
Output Schema
| Name | Required | Description |
|---|---|---|
| week | Yes | |
| teamId | Yes | |
| players | Yes | |
| teamName | Yes |
get_transactionsRecent transactionsARead-only
Inspect recent league activity, newest first, and find transaction ids for cancelling pending claims. Items contain ESPN player ids only, without names. Player ids are ESPN ids, including negative D/ST ids.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| transactions | Yes |
search_playersSearch playersARead-only
Look up ESPN player ids and fantasy team ownership by a case-insensitive name substring, across rosters, free agents and waivers. Player ids are ESPN ids, including negative D/ST ids.
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | ||
| query | Yes |
Output Schema
| Name | Required | Description |
|---|---|---|
| players | Yes |
set_lineupMove lineup playersADestructive
Move rostered players to eligible slots such as QB, FLEX, BE or IR. List every move, including the player leaving an occupied slot. No counter-moves are added. Player ids are ESPN ids, including negative D/ST ids. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. week defaults to the current NFL week. dryRun previews the payload without posting. Requires ESPN_S2 and ESPN_SWID.
| Name | Required | Description | Default |
|---|---|---|---|
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| moves | Yes | ||
| dryRun | No | Preview the payload without posting it to ESPN. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. |
Output Schema
| Name | Required | Description |
|---|---|---|
| dryRun | Yes | |
| result | No | |
| payload | Yes |
submit_waiver_claimSubmit a waiver claimADestructive
Claim a player on waivers with an optional drop and a nonnegative bid, defaulting to 0. ESPN processes the claim under league rules. Player ids are ESPN ids, including negative D/ST ids. teamId is an ESPN fantasy team id and defaults to ESPN_TEAM_ID. week defaults to the current NFL week. dryRun previews the payload without posting. Requires ESPN_S2 and ESPN_SWID.
| Name | Required | Description | Default |
|---|---|---|---|
| bid | No | ||
| week | No | NFL scoring week, defaults to the league's current scoringPeriodId. | |
| dryRun | No | Preview the payload without posting it to ESPN. | |
| teamId | No | ESPN fantasy team id, defaults to ESPN_TEAM_ID. | |
| playerId | Yes | ESPN player id. D/ST ids are negative, such as -16024 for the Chargers. | |
| dropPlayerId | No | ESPN player id. D/ST ids are negative, such as -16024 for the Chargers. |
Output Schema
| Name | Required | Description |
|---|---|---|
| dryRun | Yes | |
| result | No | |
| payload | Yes |
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
11 tool updates
v0.1.0- First observed
add_player - First observed
cancel_waiver_claim - First observed
drop_player - First observed
get_free_agents - First observed
get_league - First observed
get_matchups - First observed
get_roster - First observed
get_transactions - First observed
search_players - First observed
set_lineup - First observed
submit_waiver_claim
TDQS
Scored across 11 tools
Most tools target distinct actions and resources: get_* tools cover reads while add/drop/set_lineup and waiver tools cover writes. The main potential confusion is between add_player and submit_waiver_claim, and between search_players and get_free_agents, but the descriptions clearly separate free agents from waivers and lookup from listing.
All tool names follow a consistent snake_case verb_noun pattern, such as get_league, set_lineup, drop_player, and cancel_waiver_claim. The verb choices are predictable and match the operation performed.
11 tools is well-scoped for a fantasy football management server, covering league info, rosters, players, transactions, lineup changes, and waiver operations. Each tool addresses a distinct core workflow without unnecessary bloat.
The tool set covers the major fantasy football workflows: viewing league/roster/matchup data, searching and adding players, setting lineups, and managing waiver claims. A notable gap is lack of trade support, which is a common fantasy football operation, but the core management lifecycle is otherwise complete.
Maintenance
Related MCP Connectors
ESPN MCP — keyless multi-sport live scores, teams, and news via ESPN's public site API.
SportsDataIO MCP — wraps SportsDataIO's Big-Six sports data API (sportsdata.io)
Query SEC EDGAR filings, XBRL financials, and company data via MCP. STDIO or Streamable HTTP.
Related MCP Servers
- 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
- AlicenseBqualityCmaintenanceEnables querying Yahoo Fantasy Sports leagues, rosters, and matchups via an MCP interface (read-only).10MIT
- AlicenseNot gradedqualityCmaintenanceProvides read-only access to Sleeper fantasy football data including user info, leagues, rosters, matchups, and NFL state through MCP tools.135 npmMIT
- AlicenseAqualityBmaintenanceProvides local MCP tools for fantasy football draft simulation, weekly lineup decisions, and configurable automation policies.1740 PyPI88MIT