fantrax-mcp
Provides access to NHL schedule data, including games per night and per team, to support fantasy hockey planning such as weekly games, light nights, and lineup decisions.
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., "@fantrax-mcpHow is my matchup going this week, category by category?"
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.
fantrax-mcp
An MCP server that lets Claude (or any MCP client) read your Fantrax fantasy hockey league and the NHL schedule, so you can ask things like:
"How is my matchup going this week, category by category?"
"Which free-agent centers would help my faceoffs and still get games this week?"
"If I drop X for Y, how many extra starts do I actually get?"
"Will I hit the goalie minimum this week?"
"Show the standings by division." / "Who played last night, and was he in someone's lineup?"
It is read-only: it never makes roster moves, claims, trades or lineup changes. You stay in charge in Fantrax; the server just gives Claude accurate numbers to reason with.
Unofficial project. It uses the same internal web API the Fantrax site uses, with your own logged-in browser session. Fantrax can change that API at any time, so expect occasional breakage. Use it for your own league and in line with Fantrax's terms.
What it can do
Tool | What you get |
| Teams, your team, roster rules, the week calendar (incl. double weeks) |
| Standings with division, division rank, W-L-T, points, win %, games back, category points |
| One H2H matchup: totals for both sides, who wins each category, Fantrax's projection |
| Every pairing for a week, plus bye teams |
| All periods: pairings, byes, playoff rounds |
| A roster with positions, NHL team, status, injury notes and stats |
| Every roster in one call, with raw season totals per timeframe; optionally free agents (code |
| Available players, sortable by any category |
| Goalie W / GAA / SV / SV% plus goals against, shots against and minutes |
| Everyone who played on a date: owner, lineup slot that day, raw stats |
| NHL games per night and per team |
| Week dates, games per NHL team, light nights |
| Daily lineup simulation: usable starts, games wasted on the bench, open slots |
| The same for every team at once, plus goalie games played so far |
| Who fills which slot each day, for every team |
| Net usable starts from a swap, with both players' stats |
| Projected goalie starts against the weekly minimum |
| Is the Fantrax login still valid, when does the cookie expire |
| Debug passthrough to an allow-listed set of read-only Fantrax calls |
Anywhere a tool takes team, you can pass me, a team name (or part of it), a Fantrax team
id, or a short team code from TEAM_CODES (see below). Timeframes are PROJ_SEASON, YTD and LAST_SEASON. Every
response includes fetched_at (UTC) and nhl_date (the US-Eastern game date). Bad input,
such as an unknown team, comes back as {"error": "..."} with a readable message.
Related MCP server: Yahoo Fantasy MCP
Is it a fit for my league?
It was built for, and tested on, one league. Before you set it up, check these:
Works out of the box | Needs a small code edit today |
Fantrax NHL leagues with head-to-head categories scoring | Other sports or points-based scoring are not supported |
Any number of teams, any league id | Scoring categories are pinned in |
Roster size and IR slots ( | Daily lineup slots (3 C, 3 LW, 3 RW, 6 D, 2 G) live in |
Season calendar read from Fantrax | Team codes: |
Making those settings configurable is on the to-do list; pull requests are welcome.
Requirements
A Linux machine that stays on (a small VM, LXC container or Raspberry Pi is plenty)
Python 3.11 or newer
Your Fantrax account, logged in through a browser
For Claude Desktop: Node.js (it runs the
mcp-remotebridge vianpx)
Quick start
1. Install
sudo apt install -y python3-venv git
sudo useradd -r -s /usr/sbin/nologin fantrax
sudo git clone https://github.com/RakkenRoli/fantrax-mcp.git /opt/fantrax-mcp
cd /opt/fantrax-mcp
sudo python3 -m venv .venv
sudo .venv/bin/pip install .2. Configure
sudo mkdir -p /etc/fantrax-mcp
sudo cp .env.example /etc/fantrax-mcp/env
sudo nano /etc/fantrax-mcp/envAt minimum set:
FANTRAX_LEAGUE_ID: the id in your league's URL,fantrax.com/fantasy/league/<this part>/...FANTRAX_TEAM_NAME: your team's name exactly as Fantrax shows it. Put it in quotes if it contains spaces. Or setFANTRAX_TEAM_IDinstead (theteamId=value on your roster page).MCP_AUTH_TOKEN: a long random secret. Generate one withopenssl rand -hex 32.
All settings are listed under Configuration below.
3. Give it your Fantrax login
Fantrax has no public API, so the server reuses your browser session:
Log in at fantrax.com with "Remember me" ticked.
Install the Cookie-Editor browser extension, open it on fantrax.com, and export the cookies as JSON.
Save the export as
/etc/fantrax-mcp/fantrax_cookies.json.
sudo chown -R root:fantrax /etc/fantrax-mcp
sudo chmod 750 /etc/fantrax-mcp && sudo chmod 640 /etc/fantrax-mcp/*Treat that file like a password: anyone who has it is logged in to your Fantrax account. Never commit it or paste it anywhere.
4. Run it as a service
sudo cp deploy/fantrax-mcp.service /etc/systemd/system/
sudo systemctl daemon-reload
sudo systemctl enable --now fantrax-mcp
sudo journalctl -u fantrax-mcp -n 20 --no-pagerCheck it from the same machine:
curl -s -H "Authorization: Bearer <your token>" http://127.0.0.1:8765/healthz200 with "ok": true means it is logged in and the scoring categories match.
5. Put HTTPS in front of it
MCP clients should reach the server over HTTPS. Any reverse proxy works; Caddy is the
simplest. deploy/Caddyfile.snippet is a starting point; keep flush_interval -1, because
MCP streams responses. If you use Caddy's tls internal certificates, the machine running
Claude must trust Caddy's root certificate (see Troubleshooting).
Add the hostname you use to MCP_ALLOWED_HOSTS, then restart the service.
6. Connect Claude Desktop
Merge deploy/claude_desktop_config.snippet.json into your Claude Desktop config and
replace the URL and token:
{
"mcpServers": {
"fantrax": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://fantrax.example.lan/mcp",
"--header", "Authorization:${FANTRAX_MCP_AUTH}"],
"env": {
"FANTRAX_MCP_AUTH": "Bearer <your token>",
"NODE_EXTRA_CA_CERTS": "/path/to/caddy-root.crt"
}
}
}
}The token is passed through an environment variable because mcp-remote arguments must
not contain spaces. Drop NODE_EXTRA_CA_CERTS if your certificate comes from a public CA.
Restart Claude Desktop and ask: "Use the fantrax tools: how is my matchup this week?"
Other MCP clients work the same way: point them at https://<your-host>/mcp and send
Authorization: Bearer <token>.
Configuration
Settings are environment variables, read from /etc/fantrax-mcp/env by the service.
Variable | Required | Default | Meaning |
| yes | League id from the Fantrax URL | |
| one of these two | Your team's name (quote it if it has spaces) | |
| Your team id; skips the name lookup | ||
|
| Cookie-Editor JSON export, a | |
| strongly recommended | Shared secret every request must send. Without it the server is open to anyone who can reach it | |
|
| Where the server listens | |
|
| Host names the server accepts (DNS-rebinding protection) | |
|
| Roster cap (IR not counted) and IR slots | |
| 2026-27 season | Fallback calendar, used only if Fantrax's own calendar can't be read | |
|
| NHL season for schedule lookups | |
|
| Parallel requests to Fantrax. Keep at 1 unless you know your session tolerates more | |
|
| Seconds between requests to Fantrax. Fantrax rejects bursts with | |
|
| Waits (s) before each retry of a rejected or 429/5xx request | |
| (memory only) | Where last good copies of big pulls are kept across restarts; the shipped unit sets | |
|
| How results are sent: | |
| off |
| |
| Fallback only: penalty text used when the goalie rule cannot be read from Fantrax (normally |
Keeping it running
The Fantrax cookie expires after a few months, or when you log out of Fantrax in that browser.
session_healthshows the expiry date and warns three days ahead. To renew, export the cookies again and overwrite the file. The server picks up the new file on the next call, so no restart is needed.Optional: let the server keep the cookie fresh. Fantrax refreshes some cookies on its responses. With
FANTRAX_COOKIE_WRITEBACK=1the server merges those back into the cookie file (atomically, only cookies already in the file, never deletions), so a restart doesn't fall back to an older login. The service needs write access to the folder for that, which the default unit blocks on purpose:sudo systemctl edit fantrax-mcp # add the two lines below # [Service] # ReadWritePaths=/etc/fantrax-mcp sudo chmod 770 /etc/fantrax-mcp && sudo chmod 660 /etc/fantrax-mcp/fantrax_cookies.json sudo systemctl restart fantrax-mcpIf the server can't write, it logs one warning and carries on without write-back.
When Fantrax rejects a refresh,
get_league_rostersserves the last good copy of that timeframe (up to 48 h for projections and last season, 24 h for YTD) and lists it understale; only if there is none does the part come backnullunderincomplete.Updating:
cd /opt/fantrax-mcp && sudo git pull --ff-only && sudo .venv/bin/pip install -q . \ && sudo systemctl restart fantrax-mcpUsing it from scripts:
/healthzreturns 200 when the login works and the category map matches, 503 when not, 401 without the token. A good gate before any scheduled job:curl -fsS -H "Authorization: Bearer $MCP_AUTH_TOKEN" https://<host>/healthz >/dev/null \ || { echo "Fantrax session unhealthy" >&2; exit 1; }
How the numbers are produced
Matchup totals come from Fantrax's standings table, the same numbers Fantrax scores on. Live scoring is used only for Fantrax's own projection.
Lineup simulations solve each day's lineup exactly (players with multiple positions included) against the real NHL schedule, so "usable starts" means games that fit in an active slot, not just games played by the NHL team.
Goalie rates (GAA, SV%) are recomputed from goals against, shots against and minutes when goalies are combined. Averaging per-game rates gives the wrong answer.
Fantrax does not project takeaways (Tk) or time on ice (TOI). In season projections these are reported as missing (
null), not as zero.
Development
python3 -m venv .venv && .venv/bin/pip install -e . pytest
.venv/bin/python -m pytest -q testsTests never touch your real login: tests/conftest.py forces a dummy cookie file, even if
your service environment is loaded in the shell. Several fixtures are real Fantrax
responses from the author's league; if you change the category or team mappings for your
league, a few of those tests will need their expectations updated.
fantrax_raw is the quickest way to inspect a response shape when Fantrax changes
something. scripts/capture_standings_fixtures.py saves fresh standings fixtures.
Changes to tool output are recorded in CHANGELOG.md.
Troubleshooting
Symptom | Fix |
| The token in the client config doesn't match |
| Add the hostname your proxy forwards to |
|
|
Login errors, | Export the Fantrax cookies again (step 3) |
| Your league scores different categories; see Is it a fit for my league? |
Claude Desktop keeps an old connection |
|
Service won't start |
|
License
MIT, see LICENSE. Not affiliated with or endorsed by Fantrax or the NHL.
This server cannot be deployed
Maintenance
Related MCP Connectors
Free fantasy sports AI: ESPN, Sleeper and Fantrax league data for Claude and ChatGPT. Read-only.
Fantasy analysis for your ESPN, Yahoo, and Sleeper leagues. Reads your leagues, never changes them.
The hockey API for stats, odds, and everything between. REST API and MCP server. Free to start.
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
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with Yahoo Fantasy Baseball and Basketball leagues, allowing roster analysis, matchup tracking, free agent browsing, and player stats retrieval via natural language.-
- AlicenseNot gradedqualityBmaintenanceEnables Claude to interact with Sleeper fantasy football leagues via MCP tools for roster, waiver, matchup, and transaction queries, plus a dashboard for daily reports, live scoring, and game-day alerts.108 npmMIT
- FlicenseNot gradedqualityCmaintenanceProvides read-only access to Yahoo Fantasy Football league data through MCP, letting ChatGPT retrieve rosters, standings, scoreboards, draft results, transactions, and player stats without making any roster changes.1-