Fantasy Premier League (FPL)

io.github.GilbertKamau由 GitHub 账号 GilbertKamau 发布v0.2.1更新于 Oct 24, 2026

FPL data, points predictions, and transfer, captain and chip advice for any team.

已验证Streamable HTTP可网页运行金融数据与分析

概览

AI 生成的概览

梦幻英超(FPL)MCP 服务器:提供实时 FPL 数据、积分预测,以及阵容、转会、队长和芯片建议。

可以做什么
  • 查询比赛周状态、截止时间与赛程,按位置、价格和统计筛选或对比球员
  • 查看球员数据、伤病消息、近期比赛、未来赛程及历年赛季数据,并获取球队概况
  • 预测未来 1 至 5 个比赛周的期望积分,并报告模型的准确度
  • 按队伍编号查看任意经理的公开阵容、资金和排名
  • 在预算内生成最优 15 人阵容、建议转会、挑选队长并给出芯片使用建议
适用场景
适合玩梦幻英超的用户,让助手基于实时 FPL 数据和积分模型回答该买谁、该做哪些转会、该选谁当队长或是否使用芯片等问题。
运行要求
可使用托管远程端点(无需安装、无需登录),也可本地运行。npm 包通过 npx 启动;从源码自建需要 Python 3.12+、执行数据同步与模型训练,以及 SQLite 或 Supabase 等数据库。托管部署可选设置 MCP_AUTH_TOKEN 和 DATABASE_URL。免费托管实例冷启动可能需要一分钟。
安装前请注意
托管服务器为只读并使用公开的 FPL 数据,但若未设置 MCP_AUTH_TOKEN,任何拿到网址的人都能调用其工具。自建 Supabase 需在 DATABASE_URL 中保存数据库连接串,定时更新还需具备写权限的密钥。预测只是估计而非保证,本项目与英超官方无关联。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Fantasy Premier League (FPL),将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Web executable,通过 Streamable HTTP。 远程服务在工作区中配置后即可从网页运行时运行。

交给智能体安装

把这段提示词粘贴到 Claude Code、Codex、Cursor 等智能体,或 SourceWeft 对话中。智能体会读取该服务器的安装指南,先向你展示发布者、端点和登录方式,经你同意后再把它添加到你的客户端。密钥不会写进任何命令。

阅读 https://sourceweft.com/mcp/io.github.GilbertKamau%2Ffpl-mcp/install.md,并按其中说明把这个 MCP 服务器接入我的客户端。修改任何配置之前,先告诉我它的发布者、端点和登录方式,等我确认。不要把 API 密钥写进命令或我会提交的文件;问我密钥应从哪里获取。

查看智能体所依据的安装指南

其他 MCP 客户端

把它添加到你客户端的 mcpServers 配置中。

{
  "mcpServers": {
    "fantasy-premier-league-fpl": {
      "type": "http",
      "url": "https://fpl-mcp-9tiv.onrender.com/mcp"
    }
  }
}

README

fpl-mcp

[Tests] [License: MIT]

An open-source MCP server for Fantasy Premier League that works with Claude, ChatGPT, Grok, Cursor, VS Code and any other MCP client. It pulls live data from the official FPL API and past seasons (2016-17 onward) from the vaastav dataset, predicts every player's points for the next five gameweeks, and recommends squads, transfers, captains and chips. Data lives in SQLite or Supabase.

Try it without installing anything:

  • Remote URL: https://fpl-mcp-9tiv.onrender.com/mcp (claude.ai, ChatGPT, Grok, Cursor; see Connecting AI clients)
  • npm: npx -y fpl-mcp-server for apps that run local servers (Claude Desktop, Cursor, VS Code)
  • Smithery and the official MCP Registry (io.github.GilbertKamau/fpl-mcp)

The hosted server runs on a free plan, so the first request after a quiet spell can take a minute.

[An AI assistant answering 'Best midfielders under £7m for the next 3 gameweeks?' and 'Who are the best captains for GW7?' with fpl-mcp's predictions]

Example questions: "Who are the best midfielders under £7m for the next 3 gameweeks?", "Suggest transfers for team 1234567", "Should I play my Bench Boost this week?"

Setup

Requires Python 3.12+.

bash
git clone https://github.com/GilbertKamau/fpl_mcp.git && cd fpl_mcppython -m venv .venv# Windows: .venv\Scripts\activate     macOS/Linux: source .venv/bin/activatepip install -e ".[supabase,dev]"fpl-sync all       # load data (~3 min to SQLite; ~15 min to a remote Supabase the first time)fpl-model all      # train the model and write predictions (~3-6 min the first time)

fpl-sync jobs:

JobWhat it doesTime
livePlayers, prices, injuries, teams, gameweeks, fixturesseconds
currentThis season's per-match stats for every player (FPL API)~1 min
historyPast seasons from vaastav (--seasons 2024-25 to pick some)minutes, once
allAll of the above
weeklylive + current, then retrain and refresh predictions~5 min

fpl-model jobs: evaluate (test only), compare (feature sets side by side), train, predict, all (train + predict). Add --refresh-cache after re-loading history, so the local cache of past seasons is rebuilt.

Database

SQLite at data/fpl.db by default. To use Supabase, copy .env.example to .env and paste your Supabase Session pooler connection string as DATABASE_URL (the direct db.<ref>.supabase.co host is IPv6-only). Special characters in the password are encoded automatically. Tables are created automatically.

TableContents
players, teams, gameweeks, fixturesCurrent-season snapshot
player_gameweeksOne row per player per match, every season. player_code links a player across seasons
season_teamsTeam id → name for each season
predictionsExpected points per player per upcoming fixture
prediction_historyEvery prediction made, with benchmarks, for live scoring
model_artifactsTrained models
model_runsEvery training run, its test results, and whether it was accepted
sync_logWhen each sync ran

Data quirks: 2019-20 gameweeks run to 47 (the COVID restart was numbered 39-47); 2024-25 includes AM (assistant manager) rows, which the model ignores; xG/xA exist from 2022-23 onward.

data/ (SQLite backup, cache, logs), models/ and .env are git-ignored, and a local pre-commit hook refuses to commit them.

Prediction model

LightGBM predicts each player's points per fixture from information available before kick-off:

  • Form: rolling averages over the last 1, 3, 6, 12 and 38 matches (points, minutes, starts, xG, xA, bonus, BPS, ICT, defensive contributions...)
  • Market: ownership and net transfers that gameweek, as percentiles (the crowd's read on fitness and form)
  • Context: price, position, home/away, days since the last match
  • Team strength: both clubs' recent goals and xG for and against

A gameweek's expected points is the sum over its fixtures, so double gameweeks count twice. Injury and suspension news scales the next gameweek's prediction by FPL's chance of playing. The trained model is stored in the database, so any machine can make predictions with it.

Testing on past seasons. Walk-forward: for each of the last three complete seasons, the model is trained only on earlier seasons and predicts every fixture. The baseline is the player's average points over their last 6 matches.

SeasonModel MAEBaseline MAERegular starters: model / baseline
2023-240.9310.9992.19 / 2.40
2024-250.9881.0532.20 / 2.41
2025-260.9541.0552.26 / 2.55

That is 7.5% better than the baseline overall. Adding last-match form, season-long form and the market features improved the average MAE from 0.982 to 0.958 and was better in every test season (fpl-model compare reruns this). A retrained model is only used if it beats the baseline and is no worse than the current model.

Past-season tests have no injury news (there's no historical record of it), so they understate live accuracy. They also can't fairly be compared with FPL's own expected points: the historical xP column includes injury news, and its 2025-26 values are on a different scale.

Live tracking. Every prediction is archived. After each gameweek, the prediction made before the deadline is scored against actual points, next to two benchmarks recorded at the same moment: the 6-match baseline and FPL's own expected points (ep_next). It also compares what each method's top 20 players actually scored. model_report shows the running results.

FPL points are very noisy (a 2-pointer and a 15-pointer can come from the same performance), so treat predictions as estimates.

Optimizer

Integer programs solved with HiGHS (via PuLP) that follow FPL rules: 2 GKP / 5 DEF / 5 MID / 3 FWD, max 3 per club, a valid formation, the budget, and −4 per transfer beyond the free ones. Points for later gameweeks are discounted (×0.85 per week) because predictions further out are less reliable.

For a manager's team it uses public endpoints only (no login). Selling prices are estimated from the manager's transfer history (FPL keeps half of any price rise), and free transfers from their gameweek history (up to 5 banked, kept through Wildcard and Free Hit weeks). Transfers made since the last deadline aren't public yet, so they aren't included.

MCP tools

ToolWhat it does
gameweek_statusCurrent/next gameweek and deadline
search_playersFilter by position, team, price, minutes; sort by any stat
get_playerStats, injury news, last 6 matches, next 5 gameweeks' fixtures
compare_players2-6 players side by side with per-90 and value numbers
get_fixturesA team's next fixtures, or a whole gameweek
team_summaryResults, goals, clean sheets, fixture run, top players
player_season_historyA player's totals for every season since 2016-17
get_my_teamAny manager's squad by team id (public, no login)
predict_pointsExpected points for the next 1-5 gameweeks, ranked
model_reportHow accurate the model is versus the baseline
optimal_squadBest 15-man squad from scratch for a budget
suggest_transfersBest transfers for a team, or advice to roll the transfer
pick_captainCaptain, vice-captain and the top 5 options
chip_adviceWhich chips are left this half, what each is worth, play or save
refresh_dataRe-pull the live snapshot

Connecting AI clients

There are two ways to run the server:

  • Local (stdio): your AI app starts the server on your computer. Works with Claude Code, Claude Desktop, Cursor and VS Code. Nothing is exposed to the internet.
  • Remote (HTTP): you host the server at a public HTTPS URL (see Deploying). Required for claude.ai, ChatGPT and Grok, which can't start programs on your computer.

In the examples, /path/to/fpl_mcp/.venv/bin/python is the Python inside your virtual environment (Windows: C:\path\to\fpl_mcp\.venv\Scripts\python.exe), and https://your-server.example.com/mcp is your deployed URL.

Claude Code

bash
claude mcp add fpl -- /path/to/fpl_mcp/.venv/bin/python -m fpl_mcp.server        # localclaude mcp add --transport http fpl https://your-server.example.com/mcp          # remote

Claude Desktop

Local: Settings > Developer > Edit Config, then add to claude_desktop_config.json:

json
{  "mcpServers": {    "fpl": { "command": "/path/to/fpl_mcp/.venv/bin/python", "args": ["-m", "fpl_mcp.server"] }  }}

Remote: use Settings > Connectors > Add custom connector (same as claude.ai below).

claude.ai

Settings > Connectors > Add custom connector, and paste https://your-server.example.com/mcp. Available on paid plans; on Team/Enterprise an owner adds it for the organization. claude.ai connects to servers without a login or with OAuth, so leave MCP_AUTH_TOKEN unset.

ChatGPT

Turn on Developer mode (Settings > Apps & Connectors > Advanced), create a connector with the URL https://your-server.example.com/mcp and authentication None, then pick it from the tools menu in a chat. Plan availability varies, so check OpenAI's current docs. Like claude.ai, it can't send a fixed token, so leave MCP_AUTH_TOKEN unset.

Grok (xAI API)

Grok connects to remote MCP servers through the xAI API:

python
from xai_sdk import Clientfrom xai_sdk.chat import userfrom xai_sdk.tools import mcp
client = Client()  # reads XAI_API_KEYchat = client.chat.create(    model="grok-4.7",    tools=[mcp(server_url="https://your-server.example.com/mcp", server_label="fpl")],)chat.append(user("Who should I captain in gameweek 7?"))print(chat.sample().content)

Or with the Responses API, add this to tools:

json
{ "type": "mcp", "server_url": "https://your-server.example.com/mcp", "server_label": "fpl" }

If you set MCP_AUTH_TOKEN, also pass "authorization": "<token>".

Cursor

Add to ~/.cursor/mcp.json (all projects) or .cursor/mcp.json (one project):

json
{  "mcpServers": {    "fpl": { "command": "/path/to/fpl_mcp/.venv/bin/python", "args": ["-m", "fpl_mcp.server"] }  }}

Remote: "fpl": { "url": "https://your-server.example.com/mcp" }, plus "headers": { "Authorization": "Bearer <token>" } if you set a token.

VS Code (GitHub Copilot agent mode)

.vscode/mcp.json:

json
{  "servers": {    "fpl": { "type": "stdio", "command": "/path/to/fpl_mcp/.venv/bin/python", "args": ["-m", "fpl_mcp.server"] }  }}

Remote: "fpl": { "type": "http", "url": "https://your-server.example.com/mcp" }.

Anything else

Any MCP client that supports stdio or Streamable HTTP works. To try the server interactively: npx @modelcontextprotocol/inspector /path/to/fpl_mcp/.venv/bin/python -m fpl_mcp.server.

Deploying

The hosted server only reads the database. Data, training and predictions run on your own machine (or any scheduled job) with fpl-sync weekly, and the hosted server picks up new predictions within 10 minutes. You therefore need a database both can reach, such as Supabase.

  1. Create a read-only database user for the public server: run scripts/supabase_readonly_role.sql in Supabase's SQL editor.

  2. Deploy. On Render: New > Blueprint, pick your fork of this repo, and render.yaml sets it up. Elsewhere (Fly.io, Railway, Google Cloud Run, a VPS), use the Dockerfile.

  3. Set environment variables:

    VariableRequiredPurpose
    DATABASE_URLyesSupabase Session pooler URI for the read-only user
    MCP_AUTH_TOKENnoIf set, every request needs Authorization: Bearer <token>. Grok, Cursor and VS Code can send it; claude.ai and ChatGPT can't
    FPL_MCP_ALLOW_REFRESHno1 exposes the refresh_data tool (off by default when hosted)
    PORTnoSet by most hosts automatically; defaults to 8000
  4. Your MCP URL is https://<your-app>/mcp. https://<your-app>/health should return {"status":"ok"}.

To run the HTTP server locally: fpl-mcp --http (serves http://127.0.0.1:8000/mcp).

Without a token, anyone with the URL can call the tools. The data is public FPL data and the server is read-only, but if the URL gets shared widely, set a token or put it behind your host's access controls.

Scheduled updates

GitHub Actions keeps the shared database fresh:

When (UTC)ModeWhat it does
Tuesday 06:00weeklyRefresh data and results, retrain, predict
Friday 06:00newsRefresh prices and injury news, predict

Run it by hand from the Actions tab (Scheduled update > Run workflow). It needs a repository secret DATABASE_URL with write access, and only runs in the main repository, not in forks. To run your own copy, add the secret to your fork and change the if: line in the workflow.

Without GitHub Actions, run fpl-sync weekly (or fpl-sync live + fpl-model predict) from cron or Windows Task Scheduler; scripts\update.ps1 wraps both modes for Windows and logs to data\logs.

Tests

powershell
.venv\Scripts\python -m pytest

Roadmap

  1. Data pipeline (FPL API + vaastav → SQLite/Supabase)
  2. Read-only MCP tools
  3. Points prediction: LightGBM with walk-forward validation against a rolling-average baseline (plus live tracking against FPL's own expected points)
  4. Optimizer: best squad, transfers, captain, chip advice
  5. Scheduled updates (sync → retrain → predict) on GitHub Actions
  6. HTTP hosting for claude.ai, ChatGPT, Grok and other remote clients
  7. Optional: apply changes to your FPL team (preview-only by default)

Contributing

Issues and pull requests are welcome. Please run pytest before opening a PR, and never commit .env, data/ or models/. By submitting a contribution you agree that it is licensed under this project's MIT License.

Licence

Copyright (c) 2026 Gilbert Kamau. Released under the MIT License: you may use, copy, modify and distribute the code, including commercially, as long as you keep the copyright and licence notice. Third-party software and data are listed in THIRD_PARTY_NOTICES.md.

Credits and disclaimer

Historical data comes from vaastav/Fantasy-Premier-League (code under the MIT License); live data from the public FPL API. Fantasy Premier League data is the property of the Premier League; the MIT License covers this project's code only, not the data. This project is not affiliated with or endorsed by the Premier League or Fantasy Premier League. Use the FPL API responsibly, and treat predictions as estimates, not guarantees.

来源:README.md,提交 3e38efb

工具

14

gameweek_status

Current and next gameweek, the next deadline, and when the data was last refreshed.

无需输入参数。

search_players

Find and rank players; position GKP/DEF/MID/FWD, sort_by any stat (e.g. form, price, ep_next).

输入参数nameteamlimitsort_bypositionmax_pricemin_pricemin_minutesavailable_only

get_player

A player's stats, injury news, last 6 matches and next fixtures. player: name or FPL id.

输入参数player必填

compare_players

Compare 2-6 players side by side, including per-90 output, value and fixture difficulty.

输入参数players必填

get_fixtures

Fixtures for a team (next 6 gameweeks), or every fixture in a gameweek (default: next gameweek).

输入参数teamgameweek

team_summary

A club's results so far, goals for/against, clean sheets, upcoming fixtures and top FPL players.

输入参数team必填

player_season_history

A player's FPL totals for every season loaded (back to 2016-17), linked across seasons.

输入参数player必填

get_my_team

A manager's squad, bank, rank and availability_alerts. team_id is the number in the FPL entry URL.

输入参数team_id必填gameweek

predict_points

Expected points for the next 1-5 gameweeks, best first; one player, or filter to rank candidates.

输入参数teamlimitplayerpositiongameweeksmax_price

model_report

Model accuracy: past-season tests and this season's live results vs a baseline and FPL's own.

无需输入参数。

optimal_squad

Best 15-man squad from scratch (e.g. a Wildcard) for a budget in £m, following FPL rules.

输入参数budgetgameweeks

suggest_transfers

Best transfers over the next N gameweeks after -4 hits; mention any availability_alerts to the user.

输入参数team_id必填gameweeksmax_transfersfree_transfers

pick_captain

Captain, vice-captain and the top 5 captaincy options in a manager's current squad for next gameweek.

输入参数team_id必填

chip_advice

Chips left this half of the season, what each is worth, and whether to play or save it.

输入参数team_id必填gameweeks

版本历史

1
  1. v0.2.1最新Oct 10, 2026

评分

已满足适用检查项的 100%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通必需25 分
  • 已声明认证方式必需10 分
  • 已列出工具必需15 分
  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分