An end-to-end Fantasy Premier League Draft toolkit. Ask any question about your league in natural language — the agent calls the right data tools and returns a clear, structured answer.
The stack is:
- Go MCP server — exposes 22 tools backed by locally-cached FPL Draft API data
- Python backend — chat API, scheduled reports, and a WebSocket endpoint
- Web UI — chat interface with tool-call visibility and one-click report generation
Open the UI and ask questions in plain English:
- "Show my waiver recommendations for GW 28"
- "What's our league table?"
- "How has Salah done each gameweek this season?"
- "Head to head record between Alpha FC and Beta United?"
- "Show me my season stats"
- "Who's had the best fixture run lately?"
- "What did people add and drop this week across the league?"
The agent routes simple questions directly using a keyword table, and falls back to an LLM (GPT-4.1 by default) for complex multi-step queries.
The scheduler generates Markdown + JSON reports on a configurable cron:
| Schedule | Reports generated |
|---|---|
| Tuesday 11:00 | League summary, waiver recommendations, trades summary |
| Friday 23:00 | Waiver recommendations, starting XI, waiver FA summary |
Reports are saved to reports/gw_<N>/ and served at /reports in the browser.
| Group | Tools |
|---|---|
| League & standings | league_summary, standings, league_entries |
| Matchups & performance | matchup_breakdown, lineup_efficiency, manager_schedule, manager_streak, manager_season |
| Transactions & waivers | transactions, waiver_targets, waiver_recommendations, ownership_scarcity, transaction_analysis |
| Players & fixtures | fixtures, fixture_difficulty, player_form, player_lookup, player_gw_stats |
| Manager utilities | manager_lookup, current_roster, draft_picks, head_to_head |
- Go 1.23+ —
go version - Python 3.11+ —
python3 --version - An OpenAI API key (optional; required for LLM-powered answers)
- Your FPL Draft league ID (visible in the URL on draft.premierleague.com)
git clone https://github.com/aatrey56/FPL-Draft-Agent.git
cd FPL-Draft-Agent
cp .env.example .envEdit .env:
LEAGUE_ID=14204 # replace with your league ID
ENTRY_ID=286192 # replace with your entry (team) ID
OPENAI_API_KEY=sk-... # required for LLM answers
FPL_MCP_API_KEY=secret # any strong random stringSee .env.example for all options with explanations.
This pulls data from the FPL Draft API into data/raw/ and data/derived/.
go run ./apps/mcp-server/cmd/dev --league 14204 --gw-max 0Replace 14204 with your league ID. This takes ~30 seconds on a fast connection.
export FPL_MCP_API_KEY="secret"
go run ./apps/mcp-server/fpl-server --addr :8080 --path /mcpThe server starts on port 8080 and exposes all 22 tools at /mcp.
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r apps/backend/requirements.txt
export FPL_MCP_API_KEY="secret"
export OPENAI_API_KEY="sk-..." # optional
PYTHONPATH=apps/backend uvicorn backend.server:app --reload --port 8000Open in your browser:
- Chat UI: http://localhost:8000/ui
- Reports: http://localhost:8000/reports
Tip: Set
START_GO_SERVER=falsein.envif you manage the Go server separately. WhenSTART_GO_SERVER=true(default), the Python backend starts the Go server automatically.
Instead of setting environment variables manually, put everything in .env at the repo root:
LEAGUE_ID=14204
ENTRY_ID=286192
FPL_MCP_API_KEY=secret
OPENAI_API_KEY=sk-...
START_GO_SERVER=true
CACHE_REFRESH_ON_START=trueThen just run:
PYTHONPATH=apps/backend uvicorn backend.server:app --reload --port 8000The backend loads .env automatically on startup.
Generate reports from the command line without the UI:
# Waiver recommendations
PYTHONPATH=apps/backend python -m backend.cli --type waivers --gw 0
# League summary
PYTHONPATH=apps/backend python -m backend.cli --type league_summary --gw 0
# Starting XI
PYTHONPATH=apps/backend python -m backend.cli --type starting_xi --gw 0
# Trades/transactions summary
PYTHONPATH=apps/backend python -m backend.cli --type trades --gw 0--gw 0 auto-resolves to the current gameweek (waiver/starting XI use GW+1).
PYTHONPATH=apps/backend python -m backend.schedulerGenerates reports on a Tuesday/Friday cron. Timezone defaults to America/New_York; override with REPORTS_TZ=Europe/London in .env.
apps/
mcp-server/ Go MCP server
fpl-server/ Tool handlers + HTTP server
cmd/dev/ FPL data fetcher
backend/ Python API, agent, scheduler, reports
backend/ Package source
tests/ pytest test suite (51 tests)
web/ Web UI (chat + reports browser)
data/ Raw/derived FPL data (git-ignored)
reports/ Generated GW reports (git-ignored)
scripts/
preflight.sh CI validation (go vet, go test, ruff, pytest)
.env.example Annotated environment variable reference
| Check | What runs |
|---|---|
| Go | go vet ./..., go test ./..., gofmt diff check |
| Python | py_compile on all source files, ruff check, pytest |
Run locally:
bash scripts/preflight.shCopy .env.example to .env — every variable has a comment explaining what it controls and how to find its value. Key variables:
| Variable | Default | Description |
|---|---|---|
LEAGUE_ID |
14204 |
Your FPL Draft league ID |
ENTRY_ID |
286192 |
Your team (entry) ID |
FPL_MCP_API_KEY |
(none) | Shared secret for the MCP server |
OPENAI_API_KEY |
(none) | OpenAI key for LLM-powered answers |
OPENAI_MODEL |
gpt-4.1 |
OpenAI model to use |
START_GO_SERVER |
true |
Auto-start Go server from Python backend |
CACHE_REFRESH_ON_START |
true |
Refresh FPL data on backend startup |
REPORTS_TZ |
America/New_York |
Scheduler timezone |
To show the chat UI and reports in action, follow these steps:
-
Take screenshots of:
- The chat UI at
http://localhost:8000/uiwith a sample question and answer - The reports browser at
http://localhost:8000/reportsshowing generated reports - A sample generated report (e.g.
reports/gw_28/waiver_recommendations.md)
- The chat UI at
-
Record a demo GIF using a tool like Kap (macOS), ScreenToGif (Windows), or peek (Linux):
- Show: opening the UI → typing a question → seeing the answer + tool trace → clicking a report
-
Add to the repo:
docs/ screenshots/ chat-ui.png reports-browser.png demo.gif -
Embed in this README below this section:
## Demo  
Tip: keep GIFs under 10 MB; use ezgif.com to optimise if needed. For video, consider linking to a YouTube/Loom recording instead.