fantrax-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., "@fantrax-mcpshow me the current standings"
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
MCP server for Fantrax fantasy baseball. It exposes tools to read league info, rosters, standings, free agents, and related data. The server is league-scoped: set one Fantrax league ID per deployment or local process.
Requirements
Node.js 18+
pnpm (or use
npx/npmequivalents)
Related MCP server: fpl-mcp
Environment
Variable | Required | Description |
| Yes | Fantrax league ID (from the league URL) |
The app does not load .env automatically for the stdio entrypoint; set variables in your shell or in your MCP client config (env).
MCP tools
All tools use the league configured by FANTRAX_LEAGUE_ID. Atomic tools map roughly one-to-one to Fantrax data; composite tools combine several calls for common workflows.
Atomic
Tool | Description |
| Full league info: teams, roster settings, player statuses. Prefer |
| Lightweight league info: name, season year, start/end dates, roster and draft settings. |
| Standings: rank, points, and win percentage per team. |
| All teams with |
| Every team’s roster (player IDs, positions, salary). Prefer |
| One team’s roster ( |
| Free agents with name, MLB team, position, and eligible fantasy positions. |
| MLB player ADP-style data for ranking and valuation. Optional: |
| Stats that count in this league — use when comparing or recommending players. |
Composite
Tool | Description |
| All rosters enriched with player names and ADP. |
| Trade targets by position and max ADP ( |
| One team’s roster, standings position, and league scoring categories ( |
| Free agents ranked by ADP, with scoring categories — for add/drop decisions. |
| Side-by-side comparison for two players by name, with league scoring context. |
Run locally (stdio MCP)
Use this when your client spawns a subprocess and talks MCP over stdin/stdout (e.g. Cursor, Claude Desktop).
From the repo root:
pnpm install
export FANTRAX_LEAGUE_ID=your-league-id
pnpm mcp:stdioCursor (~/.cursor/mcp.json or project .cursor/mcp.json):
{
"mcpServers": {
"fantrax": {
"command": "pnpm",
"args": ["mcp:stdio"],
"cwd": "/absolute/path/to/fantrax-mcp",
"env": {
"FANTRAX_LEAGUE_ID": "your-league-id"
}
}
}
}Prefer the example above: it runs the lockfile-pinned tsx from this repo. Using npx tsx … for the local server works after pnpm install, but npx adds resolver/caching overhead on each spawn compared to pnpm mcp:stdio or pnpm exec tsx src/mcp-stdio.ts. If you use npm, npm run mcp:stdio with the same cwd is the analogous choice.
Important: Do not log to stdout in the stdio server; MCP uses stdout for the protocol.
Run remotely (HTTP MCP)
This repo is a Next.js app. The MCP endpoint is served by mcp-handler at:
https://<your-host>/api/mcp
Examples:
Local dev:
http://localhost:3000/api/mcp(afterpnpm dev)Production:
https://<project>.vercel.app/api/mcp(or your custom domain)
Clients that support Streamable HTTP can use the URL directly, for example:
{
"mcpServers": {
"fantrax-remote": {
"url": "https://your-deployment.vercel.app/api/mcp"
}
}
}If your client only supports stdio, proxy the remote server with mcp-remote:
{
"mcpServers": {
"fantrax-remote": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://your-deployment.vercel.app/api/mcp"]
}
}
}Deploy to Vercel
Push this repository to GitHub (or another supported Git provider).
In the Vercel dashboard, import the project and select the Next.js preset.
Under Settings → Environment Variables, add
FANTRAX_LEAGUE_IDfor Production (and Preview if you want preview deployments to work).Deploy. The build runs
prebuild, which generatessrc/player-ids.jsonviascripts/generate-player-ids.ts.
Official reference: Deploying Next.js to Vercel.
Scheduled rebuilds
Production is redeployed automatically every Monday and Thursday at approximately 6:00 AM Eastern via .github/workflows/scheduled-rebuild.yml. The workflow POSTs to a Vercel Deploy Hook, which runs a full build (including prebuild player ID refresh).
One-time setup:
In Vercel: Settings → Git → Deploy Hooks — create a hook named e.g.
scheduled-production-rebuildon branchmainfor Production.In GitHub: Settings → Secrets and variables → Actions — add
VERCEL_DEPLOY_HOOK_URLwith the hook URL.
Manual trigger: Actions → Scheduled production rebuild → Run workflow.
Timezone note: GitHub cron uses UTC only (no DST). The schedule 0 11 * * 1,4 runs at 6:00 AM EST and 7:00 AM EDT. To target 6:00 AM during daylight saving instead, change the cron to 0 10 * * 1,4 (5:00 AM in winter).
Player data at build time
pnpm build runs prebuild first (package.json), which executes scripts/generate-player-ids.ts. That script fetches the MLB player ID catalogue from Fantrax’s public getPlayerIds API over HTTPS and writes src/player-ids.json. The build host must allow outbound network access; if the fetch fails, the build exits with an error. This step does not use FANTRAX_LEAGUE_ID (that variable is only for runtime MCP requests against your league).
Development
Script | Purpose |
| Next.js dev server (remote MCP at |
| Local stdio MCP server |
| Production build ( |
| Vitest |
|
|
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for Financial Modeling Prep API with 250+ financial data tools
Public MCP server for discovering open jobs. Search, filter, and get application links.
Market data tools for the MCP ecosystem: server stats, events, search, leaderboards, package trends.
The official Planning Center MCP server for interacting with your ministry's data.
Related MCP Servers
- AlicenseAqualityCmaintenanceMCP server providing access to ESPN Fantasy Baseball data, enabling league settings, rosters, player lookup, free agents, waiver claims, lineup changes, and trade management.161MIT
- FlicenseNot gradedqualityDmaintenanceMCP server for the Fantasy Premier League API, enabling querying of players, teams, fixtures, and your FPL team through any MCP-compatible client.-
- FlicenseNot gradedqualityCmaintenanceMCP server for NFL fantasy football retrieval, providing access to NFL stats and Sleeper league data through retrieval-oriented tools.-
- AlicenseAqualityCmaintenanceA read-only MCP server that supplies live context from Sleeper fantasy-football leagues, including rosters, trade analysis, draft picks, and league settings via Sleeper's public API.11MIT