Fantasy Premier League

io.github.anubabajide由 GitHub 帳號 anubabajide 發布v0.3.2更新於 Nov 7, 2026

Research and manage a Fantasy Premier League team from any MCP-capable agent.

已驗證STDIO僅桌面位置與生活資料與分析

概覽

AI 產生的概覽

英超夢幻足球(FPL)伺服器,讓助理讀取你的陣容與數據、研究並排名球員,並預覽或提交陣容與轉會變更。

可以做什麼
  • 設定球隊與迷你聯賽 ID、登入、查看或清除工作階段
  • 讀取陣容、賽季總結、單輪戰報與隊內最佳球員
  • 研究球員:熱門球員、球員詳情、對比、依名字搜尋、賽程難度、球隊新聞與預測先發
  • 對比全球或迷你聯賽對手的差異化球員,並查看聯賽積分榜
  • 將球員、賽程與歷史輪次資料匯出為 CSV 或 JSON 供自行建模
  • 預覽後再提交隊長、陣容與轉會變更,包括晶片使用
適用情境
適合管理 FPL 球隊時使用:讓助理彙整你的陣容與聯賽資料、篩選或對比球員、找出差異化人選,或先試運行預覽再提交陣容與轉會變更。
執行需求
透過 uvx 以 stdio 在本機執行(Python 套件 fantasy-premier-league-mcp);唯讀工具不需登入。寫入工具需透過 fpl_login 在瀏覽器一次性登入,並需用 Playwright 安裝本機 Chromium。可選的 HTTP 模式需要 16 字元以上的 FPL_MCP_SHARED_SECRET,且每個請求都要帶 bearer 權杖。
安裝前請注意
寫入工具可以轉會球員並重寫陣容;預設 dry_run=true,需再次以 dry_run=false 呼叫才會真正提交。登入後的更新權杖保存在 ~/.fpl-mcp/credentials.json,fpl_logout 會將其撤銷。手動貼上權杖的備用方式(fpl_set_token)約一小時失效,且僅在伺服器執行期間保留。HTTP 模式若缺少共用密鑰,任何人都能修改你的球隊。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Fantasy Premier League,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

Fantasy Premier League MCP

An MCP server for Fantasy Premier League that works with any MCP-capable agent — read your squad and stats, rank players, work out differentials, and make changes to your team. It is published in the official MCP Registry and works over either stdio or remote streamable HTTP.

This project is packaged on PyPI as fantasy-premier-league-mcp, rather than fpl-mcp, which is already owned by an unrelated project.

Install

Install it with uv (recommended):

bash
uv tool install fantasy-premier-league-mcp

Or run it without installing:

bash
uvx fantasy-premier-league-mcp

fpl_login also needs a local Chromium installation. Install it once with:

bash
uvx --from playwright playwright install chromium

For development, create a virtual environment and install the project:

bash
uv sync --group devuv run playwright install chromium

Releasing

Releases are published by GitHub Actions when a matching version tag is pushed. The workflow tests and builds the package, publishes it to PyPI using Trusted Publishing, then publishes the matching server.json to the official MCP Registry. No PyPI API token is stored in GitHub.

Before the first release, configure a PyPI pending Trusted Publisher with:

  • owner: anubabajide
  • repository: fpl-mcp
  • workflow: release.yml
  • environment: pypi
  • PyPI project: fantasy-premier-league-mcp

Create a protected GitHub environment named pypi (for example, require manual approval). Once that one-time setup is complete, publish a prepared version with:

bash
git tag v0.3.2git push origin v0.3.2

Playwright drives the one-off browser sign-in described under Authentication.

Connect it to your agent

Any MCP-capable client can use this server. It speaks MCP over stdio by default, and can also run as a remote streamable-HTTP connector for agents that support remote MCP servers.

Local stdio (recommended)

Point your agent at uvx:

json
{  "mcpServers": {    "fpl": {      "command": "uvx",      "args": ["fantasy-premier-league-mcp"]    }  }}

Use that block in your client's MCP configuration — many clients accept a .mcp.json/.cursor/mcp.json file or offer a settings screen. Some clients call the top-level key servers instead of mcpServers; the fpl entry is the same. For a checked-out copy, point command at the project's Python and run python -m fpl_mcp.

Nothing is exposed off the machine in stdio mode. This is the safest option.

Remote HTTP

Agents that connect to remote MCP servers over HTTPS can use the built-in HTTP transport:

bash
export FPL_MCP_SHARED_SECRET="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')"python -m fpl_mcp --http

Then put an HTTPS tunnel in front of it (for example cloudflared tunnel --url http://localhost:8000) and give the agent the resulting https://…/mcp URL as a custom connector.

HTTP mode refuses to start without FPL_MCP_SHARED_SECRET (16+ characters). These tools can transfer players and rewrite your lineup, so an open endpoint would let anyone who found the URL edit your team. Every request must carry Authorization: Bearer <secret>; anything else gets a 401. Your machine has to be running for the connector to work.

MCP Bundle

For apps that install local MCP servers as bundles, fpl.mcpb is a zip containing the server, its dependencies and a bundled Python interpreter, plus a manifest.json. Install it through the app's extension UI. See the MCP Bundle setup notes for build, update and Chromium details.

Registry discovery

The server is listed in the official MCP Registry as io.github.anubabajide/fpl, so registry-aware clients can find and install it directly.

Authentication

Everything read-only works with no login at all. Only the three write tools (fpl_set_lineup, fpl_set_captain, fpl_make_transfers) need a session.

Sign in once: ask your agent to run fpl_login. It opens FPL's own sign-in page in a browser window on the machine running the server and returns promptly:

  1. Sign in in that browser window.
  2. The server catches the redirect FPL sends back, exchanges the authorization code, and saves the resulting session automatically — there is no second fpl_login call.

The sign-in runs as an independent background task, so it keeps going even if the client gives up on the first call — your progress in the window is never thrown away. You sign in yourself; this server never sees your password. The session is kept as a refresh token in ~/.fpl-mcp/credentials.json, readable only by you, and access tokens are renewed with a single HTTPS request. No browser is involved after sign-in. You should not need to think about tokens again until the session itself lapses, at which point any write tool will tell you to run fpl_login again. fpl_auth_status can check whether a browser sign-in has finished.

If no browser window can be opened, fpl_login returns status awaiting_redirect_url with a sign_in_url. Open that link in any browser; after signing in, paste the address you land on back into fpl_login as redirect_url.

fpl_logout forgets the session and revokes it at FPL. fpl_auth_status reports the current state.

Why not just store an email and password?

Because FPL's identity provider refuses that exchange. The site's OAuth client (bfcbaf69-aade-4c1b-8f00-c1cb8a193030, read from the FPL app bundle) is configured without the password grant:

POST https://account.premierleague.com/as/token     grant_type=password  -> 400  unsupported_grant_type: "Invalid grant type: password"

The supported flow is authorization-code + PKCE in a browser, and account.premierleague.com rejects non-browser HTTP clients outright. So a real browser has to be involved somewhere. Doing it this way means the login is performed by you, on FPL's own page in a genuine browser window, and no FPL credentials are ever stored, read, or handled by this server. The authorization code is redeemed with a PKCE verifier held only in memory, and what is saved afterwards is a refresh token — not a password and not a browser profile.

If the login ever presents two-factor or a bot check, you complete it in that window like any other sign-in. Nothing is bypassed.

Fallback

fpl_set_token still accepts a bearer token pasted by hand from DevTools, for machines where launching a browser is not an option. Such a token lasts about an hour, cannot renew itself, and is retained only until the server stops.

Tools

Setup

ToolWhat it does
fpl_setupStore your team id and a default mini-league id
fpl_loginSign in once in a browser window; the session is remembered
fpl_logoutForget the saved session
fpl_auth_statusCheck the session, renewing the token if needed
fpl_set_tokenPaste a token by hand (fallback)

Your team

ToolWhat it does
fpl_my_squadStarting XI, bench, captain, formation, bank, free transfers remaining, held chips
fpl_season_summaryPoints, overall rank, rank by gameweek, chips, hits, past seasons
fpl_gameweek_reportPer-player scoring for a gameweek, incl. bench and auto-subs; live or confirmed headline
fpl_best_performersRank your own squad to see who is carrying and who is dead weight

Player research

ToolWhat it does
fpl_top_playersBest players in the game, filtered by position, club and price; ranked by metric or sort_by
fpl_playerOne player in depth: stats, fixtures, set pieces, injury news
fpl_compare_playersTwo or more players side by side
fpl_search_playersName lookup
fpl_fixture_tickerClubs ranked by upcoming fixture difficulty

Bulk export (for your own modelling)

ToolWhat it does
fpl_export_playersCompact player-pool export as CSV — full pool or paged, unranked
fpl_export_fixturesEvery fixture over a horizon, one row per team per match
fpl_export_gameweek_historyPer-player, per-gameweek stats across finished gameweeks

These return whole datasets rather than a ranked top-N, so a client can run its own optimiser. CSV is the default: the same data as JSON costs roughly five times the tokens.

The default player export is compact — about 22 columns — so it fits in a tool result. fields="standard" restores the broad optimiser set (62 columns), and fields="all" gives every raw column (112) with a size warning. Narrow further with ids, position, team, min_minutes or max_price, or page with offset/limit; the response carries has_more and next_offset.

Join fpl_export_fixtures to the player export on team_id to build per-player, per-gameweek projections. Blanks and doubles fall out of the shape: no row for a gameweek means a blank, two rows mean a double.

Team news and lineups

ToolWhat it does
fpl_team_newsManager, new signings, departures and injury flags, per club
fpl_predicted_lineupsConfirmed XI if published, otherwise a derived prediction

Managers come from the Premier League's own Pulse backend, joined to FPL on the pulse_id field FPL already ships. It is undocumented and unversioned, so when it does not answer the manager reads unknown rather than failing the call. Managers are not an FPL asset this season, so a change matters indirectly — rotation, set-piece duty, formation — not as points.

Signings and departures need no extra source: FPL's team_join_date is a real transfer feed, and its news text carries departures and loans verbatim.

Predicted lineups do not exist as data anywhere — they are editorial judgement. fpl_predicted_lineups therefore returns one of two things:

  • source: "confirmed" — the real team list, once the league publishes it about an hour before kickoff;
  • source: "predicted" — a heuristic derived here, ranked on recent starts, minutes per appearance, availability, set-piece duty and price. Every pick carries its score_breakdown so you can disagree with the weighting.

The season prior is split into rate and volume, because total minutes alone conflates "was injured" with "is not a starter". Odegaard started only 16 games last season but averaged 85 minutes in them — nearly identical to Rice's 88 — so scoring on totals alone dropped a nailed-on captain out of the XI. Minutes-per-start now carries more weight than starts, since fitness returns and a squad role does not.

Recent signings are scored on fee instead, since a July arrival has no club minutes and one from abroad has none recorded anywhere. Those rows are flagged new_signing. Because they score on absent evidence rather than on merit, any who miss the XI are listed separately under new_signings_not_predicted — left to the ranking alone they would fall off the bottom and read as "not considered", when the truth is "cannot be judged".

Nothing here can see a new manager's preferences, pre-season friendlies, or a press conference.

Differentials

ToolWhat it does
fpl_differentialsBoth directions — see below
fpl_league_standingsA mini-league table and your position in it

Changing your team (all preview first)

ToolWhat it does
fpl_set_captainMove the armband, keeping the XI as-is
fpl_set_lineupSet the full XI, bench order, captain and vice; may play Bench Boost or Triple Captain
fpl_make_transfersTransfer players in and out, optionally on a wildcard or free hit

How differentials work

fpl_differentials answers the question in both directions, which is what you asked for:

  • my_differentials — high performers you own that few rivals do. When these return points, you gain ground on everyone else.
  • differentials_against_me — high performers you don't own that many rivals do. Every haul from these costs you rank, so this doubles as a transfer shortlist.

Two comparison sets are available:

scope="global"                          # vs ownership across all ~7m FPL managersscope="league", league_id=123456        # vs the top N teams in one mini-league

League scope is the more meaningful one, because your mini-league rank is decided by those specific rivals and not by the global template. It fetches each rival's actual squad and also reports effective ownership, which counts a captaincy twice — a player captained by every rival sits at 200%, and that is the real damage rate.

Tune the thresholds with low_ownership_max (default 10%) and high_ownership_min (default 20%), and the metric with metric= (total_points, form, value, xgi, points_per_game, ict_index, …).

Safety

Every write tool runs with dry_run=true by default. That validates the change and returns a full preview — the resulting squad, the points hit, the bank afterwards, and any rule breaches — without submitting anything. Only a second call with dry_run=false actually sends it to FPL.

Before submitting, the server checks the change against FPL's own rules:

  • squad shape (2 GKP / 5 DEF / 5 MID / 3 FWD) and no duplicates
  • maximum 3 players from any one club
  • enough money in the bank, using your real selling prices, not current market price
  • legal formation, exactly one captain and one vice, both of them starting
  • like-for-like positions on every transfer
  • the substitute goalkeeper in the right bench slot

If any check fails, nothing is submitted and the problems are listed instead. The points cost of extra transfers is calculated from your actual free-transfer count, and set to zero when you play a wildcard or free hit.

Gameweek deadlines

Both fpl_my_squad and fpl_export_fixtures return the next gameweek deadline, in FPL's UTC format and converted to UK local time, taken from FPL's own bootstrap deadline_time:

  • next_deadline_utc — e.g. 2026-11-07T11:00:00Z
  • next_deadline_uk / next_deadline_uk_display — the same instant in Europe/London

fpl_export_fixtures also lists gameweek_deadlines for each gameweek in its window.

Changelogs

0.3.2

  • Fixed free_transfers / free_transfers_available to be transfers remaining (FPL's limit minus transfers already made), and compute points hits from it instead of treating the granted allowance as the remaining balance. Dry runs now report the correct hit, including transfers already made this gameweek.
  • fpl_set_lineup now accepts chip (bboost or 3xc) and reports whether FPL confirmed it after submission; Bench Boost and Triple Captain can be played in the dry-run flow.
  • fpl_gameweek_report now returns consistent headline points, points_on_bench and overall_rank for live gameweeks, alongside confirmed values and an as_of marker, instead of mixing stored history with live player rows.
  • fpl_my_squad chips_available now lists held chips, with active_chip and chips_playable_this_gw as the per-gameweek view.
  • Player references (element ids) are accepted by the transfer, lineup and captain tools.
  • fpl_top_players accepts sort_by as an alias for metric.
  • fpl_export_players defaults to a compact field set and adds ids, offset and limit so responses fit tool-result limits.
  • New: the gameweek deadline (next_deadline_utc, UK local time) is returned by fpl_my_squad and fpl_export_fixtures.

A note on pre-season

Until gameweek 1 is scored, the FPL API keeps serving last season's totals for every player — points, minutes, goals and value all describe the previous campaign, and form reads 0.00 for everyone. The tools flag this in a caveat field so the numbers don't get read as current-season form. Newly promoted clubs and new signings have no history at all.

FPL also doesn't publish anyone's squad until the first deadline passes, so before then fpl_my_squad and fpl_differentials need a signed-in session to read your draft team, and mini-league tables are empty.

來源:README.md,提交 c525c47

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v0.3.2最新Nov 7, 2026

評分

已滿足適用檢查項的 40%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分

    請在儲存庫或註冊中心條目中宣告授權條款。