FPL Context

io.github.sbanthia92由 GitHub 帳號 sbanthia92 發布v0.11.1更新於 Oct 30, 2026

Live Fantasy Premier League data for AI agents: fixtures, players, squads, injuries. No setup.

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

概覽

AI 產生的概覽

讓 AI 助理取得英超夢幻足球(FPL)即時資料:輪次、賽程、球員數據、陣容、預期得分與傷停標記。

可以做什麼
  • 查詢目前與下一輪次及轉會截止時間
  • 列出附難度評級的賽程,或依未來賽程難易為 20 支球隊排名
  • 依姓名、球隊、位置與價格搜尋並排序球員,或依估算預期得分排名
  • 查看球員本賽季逐場紀錄及歷屆賽季總數據
  • 查看某一輪次所有球員的數據排名
  • 依球隊 ID 查詢經理陣容、隊長、替補、資金、轉會與晶片使用情形,並檢查傷停與禁賽標記
適用情境
適合夢幻足球相關問題,例如該選誰當隊長、該做哪些轉會、某隊賽程如何、某球員是否健康。適合希望助理依據當前 FPL 資料而非過時知識作答的使用者。
執行需求
以 Python 套件形式透過 stdio 在本機執行(需 Python 3.11+),通常以 uvx 或 pip 安裝後啟動。需要能透過 HTTPS 連線至公開的 Fantasy Premier League API。本機使用不需帳號、API 金鑰或設定;選用的 HTTP 傳輸會用到 MCP_AUTH_TOKEN、MCP_RATE_LIMIT_PER_MIN 等設定。
安裝前請注意
所有工具皆為唯讀,本機使用不索取任何憑證。資料來自非官方、未公開文件的 FPL API,可能隨時變更或限流,專案與英超官方無關。若以 HTTP 方式託管給僅支援網址的用戶端,未設定 MCP_AUTH_TOKEN 會讓端點對任何知道網址的人開放,應設定速率限制;使用資料須自行遵守資料來源的使用條款。

安裝

在 SourceWeft 中

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

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

其他 MCP 客戶端

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

README

fpl-context-mcp

An MCP server that gives any MCP-capable AI agent live Fantasy Premier League (FPL) data: the current gameweek and deadline, fixtures with difficulty ratings, player stats and match history, any manager's squad and chips, expected points, and injury and suspension flags. It works with zero setup and needs no database: it reads the public FPL API directly. It runs locally in Claude Desktop, Claude Code, Cursor, VS Code Copilot, Windsurf, Gemini CLI and Codex; ChatGPT and other clients that only accept a URL can connect when you host it over HTTP.

ToolWhat it does
get_current_gameweekThe current and next gameweek and the transfer deadline
get_fixturesFixtures with FPL's difficulty rating (FDR, 1 to 5): every team, one team's run, or a single gameweek
get_fixture_runHow hard a team's next few fixtures are (average FDR, home/away, blank and double gameweeks), or a ranked fixture ticker for all 20 teams
search_playersFind and rank players by name, team, position and max price; sort by points, form, price, ownership, expected points and more
get_player_historyA player's matches this season (optionally against one opponent) and their season totals for past seasons
get_gameweek_statsEvery player's stats for one gameweek, ranked: top scorers, clean sheets, bonus
get_xptsEstimated expected points for a gameweek by position, team and price, built from underlying stats, expected minutes, availability and fixture difficulty
get_manager_squadA manager's squad, captain, bench, bank, transfers and chips used, from their FPL team ID
get_live_availabilityEvery player's current injury, suspension and availability flags

Plus three prompts (captain_pick, transfer_plan, chip_timing) that show up as slash commands in clients that support them, and a reference resource (fpl://glossary). See Prompts and resources.

Data limits. FPL serves match-by-match data for the current season only; past seasons are season totals. Questions like "how did X do against Arsenal in earlier seasons" can't be answered from FPL's data, and the tools say so rather than guess.


Contents


Quickstart

bash
uvx fpl-context-mcp

Register it with your client (Claude Desktop config: {"mcpServers": {"fpl-context": {"command": "uvx", "args": ["fpl-context-mcp"]}}}) and ask "who should I captain this week?" or "show Arsenal's next five fixtures". That's it: no database, no account, no API key.

For other clients see Other AI clients. For ChatGPT and other URL-only clients, host it over HTTP.


Installation

Needs Python 3.11+ and outbound HTTPS access to fantasy.premierleague.com.

Without installing (uv)

uvx fpl-context-mcp runs it straight from PyPI. Requires uv.

From PyPI

bash
pip install fpl-context-mcp

This installs the fpl-context-mcp command.

From source

bash
git clone https://github.com/sbanthia92/fpl-context-mcpcd fpl-context-mcppip install -e ".[dev]"

As a dependency of another project

fpl-context-mcp @ git+https://github.com/sbanthia92/fpl-context-mcp.git

Configuration

The server needs no configuration over stdio. Everything below applies only to the HTTP transport (--transport http), and can be set as environment variables or in a .env file (see .env.example):

VariableDefaultPurpose
MCP_TRANSPORT / MCP_HOST / MCP_PORT (or PORT)stdio / 127.0.0.1 / 8000Defaults for --transport / --host / --port
MCP_AUTH_TOKEN(empty)Require Authorization: Bearer <token> on /mcp. Comma-separate several keys
MCP_RATE_LIMIT_PER_MIN0 (off)Per-caller request limit on /mcp; see Remote access
MCP_CLIENT_IP_HEADER(empty)Header with the real client IP behind a trusted proxy

Registering with Claude Desktop

Add the server to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).

With uvx (recommended)

json
{  "mcpServers": {    "fpl-context": {      "command": "uvx",      "args": ["fpl-context-mcp"]    }  }}

If installed with pip

json
{  "mcpServers": {    "fpl-context": {      "command": "fpl-context-mcp"    }  }}

If running from source

json
{  "mcpServers": {    "fpl-context": {      "command": "python",      "args": ["/absolute/path/to/fpl-context-mcp/server.py"]    }  }}

Tip: If you use uv, replace "python" with "uv" and prepend "run" to args:

json
"command": "uv","args": ["run", "/absolute/path/to/fpl-context-mcp/server.py"]

Restart Claude Desktop. You should see fpl-context appear in the tools panel.


Other AI clients (local)

Any client that can launch a local MCP server (stdio) works the same way: run the fpl-context-mcp command (no configuration needed).

Claude Code

bash
claude mcp add fpl-context -- uvx fpl-context-mcp

Cursor (~/.cursor/mcp.json), Windsurf (~/.codeium/windsurf/mcp_config.json) and Gemini CLI (~/.gemini/settings.json) all use the same mcpServers shape as Claude Desktop:

json
{  "mcpServers": {    "fpl-context": {      "command": "uvx",      "args": ["fpl-context-mcp"]    }  }}

VS Code (Copilot agent mode) — .vscode/mcp.json in your workspace:

json
{  "servers": {    "fpl-context": {      "type": "stdio",      "command": "uvx",      "args": ["fpl-context-mcp"]    }  }}

OpenAI Codex CLI — ~/.codex/config.toml:

toml
[mcp_servers.fpl-context]command = "uvx"args = ["fpl-context-mcp"]

uv not installed? pip install fpl-context-mcp, then use "command": "fpl-context-mcp" (no args) in any of the configs above.

Your own agent code — the MCP SDKs (Python, TypeScript) and agent frameworks such as the OpenAI Agents SDK can launch fpl-context-mcp as a stdio server, or connect to it over HTTP as below.


Remote access over HTTP (ChatGPT and other URL-only clients)

Some clients can't launch a local process — they only accept a server URL. That includes ChatGPT (Settings → Apps & Connectors → Advanced → Developer mode → create a connector) and custom connectors on claude.ai. For these, run the server with the streamable HTTP transport on a machine with a public HTTPS address:

bash
MCP_AUTH_TOKEN=some-long-random-string \fpl-context-mcp --transport http --host 0.0.0.0 --port 8000
  • The MCP endpoint is https://<your-host>/mcp; GET /health returns ok for load-balancer and platform health checks.
  • --transport, --host and --port can also be set with MCP_TRANSPORT, MCP_HOST and MCP_PORT (or the PORT variable that Render, Cloud Run, Heroku and Fly set).
  • The server listens on plain HTTP. Put it behind something that terminates TLS — any of those platforms does, or cloudflared tunnel / ngrok for a quick test from your own machine.
  • The default bind address is 127.0.0.1, so nothing is exposed until you pass --host 0.0.0.0.

Authentication. With MCP_AUTH_TOKEN set, every request to /mcp must send Authorization: Bearer <token>; others get HTTP 401. Clients that let you set headers can use it — for example Claude Code:

bash
claude mcp add --transport http fpl-context https://your-host/mcp --header "Authorization: Bearer some-long-random-string"

and the OpenAI Agents SDK / Responses API MCP tool (headers={"Authorization": "Bearer ..."}).

Several keys. MCP_AUTH_TOKEN accepts a comma-separated list (key-alice,key-bob). Each user can have their own key, and removing one from the list revokes it without touching the others. Rate limits are applied per key.

Rate limiting and load. Set these before exposing a server publicly:

VariableDefaultPurpose
MCP_RATE_LIMIT_PER_MIN0 (off)Max requests per minute to /mcp for each caller (their bearer token, else their IP). Over the limit gets 429 with a Retry-After header. One tool call is typically 2-3 requests, so leave headroom (120 is a reasonable start). /health is never limited. The counter is in memory, so with several replicas each enforces its own limit.
MCP_CLIENT_IP_HEADER(empty)Behind a proxy, every request appears to come from the proxy. Set this to the header your proxy fills with the real client IP (Fly-Client-IP, CF-Connecting-IP, X-Forwarded-For). Only do this when the proxy overwrites the header; otherwise callers can fake their IP to dodge the limit.

ChatGPT and claude.ai connectors only support OAuth or no authentication — not a static bearer token. To use them you currently have to leave MCP_AUTH_TOKEN unset (the endpoint is then open to anyone who finds the URL) or put an OAuth-capable proxy in front. If you run it open, anyone who finds the URL can use it and spend your server's FPL API traffic, so set the rate limit below. The server logs a warning at startup when it's bound to a non-local address without a token or a rate limit.

Running a public endpoint? See the hosting guide: container, proxy setup, auth modes, and a canary that checks the endpoint every 15 minutes.

Container. A Dockerfile is included: docker build -t fpl-context-mcp ., then run it (optionally with MCP_AUTH_TOKEN set). It runs as a non-root user, listens on $MCP_PORT / $PORT / 8000, defaults to a rate limit of 120 requests a minute, and has a health check on /health.

Where the data comes from. A hosted server calls the public FPL API on behalf of whoever connects, and caches responses in memory. There is nothing to provision or keep fresh. Because you're now serving results to other people, see Data sources and disclaimer, and the hosting guide.


Running the server standalone

bash
fpl-context-mcp          # installed from PyPIpython server.py         # from source

By default the server communicates over stdio: it is designed to be launched by an MCP client, and running it directly is mainly useful for smoke-testing. To run it as a persistent network service, use --transport http (see Remote access over HTTP).


Verifying connectivity (--check)

bash
fpl-context-mcp --check

Confirms the FPL API is reachable from your machine and exits 0 on success, 1 on failure:

=== fpl-context-mcp check ===
✅ FPL API reachable (700 players, 20 teams)
✅ OK

MCP tools reference

Live tools overview

These tools call the public FPL API directly and need no database or configuration. They share one cache: FPL's bootstrap-static data (every player and team) is downloaded once and reused for 5 minutes across tools; a manager's picks and a player's match history are cached for 2 and 5 minutes, and a finished gameweek's stats for an hour. If FPL can't be reached, the last cached copy is served and labelled as possibly out of date. All are read-only and advertise readOnlyHint, so clients can skip approval prompts. Team arguments accept a full name, a short name or a unique fragment (Arsenal, MCI, Man City).

get_current_gameweek

No parameters. Returns the current gameweek (in progress or finished), the next gameweek, and the next transfer deadline with the time left. "When is the next deadline?"

get_fixtures

Fixtures with FPL's difficulty rating (FDR): 1 easiest, 5 hardest, from each team's own point of view.

ParameterTypeDescription
teamstringOptional. Show that team's fixtures (opponent, home/away, its own FDR). Omit for all teams.
gameweekinteger 1-38Optional. A single gameweek (includes scores once played).
gameweeks_aheadinteger 1-38Optional. Gameweeks to list from the next one to play (default 5). Ignored when gameweek is set.

"Arsenal's next six fixtures?", "What are the fixtures in gameweek 12?"

get_fixture_run

ParameterTypeDescription
teamstringOptional. Omit to rank all 20 teams, easiest run first.
gameweeksinteger 1-38Optional. Window length starting from the next gameweek to play (default 5).

For one team you get the average FDR, home/away split, the fixture-by-fixture sequence and any blank or double gameweeks. "Who has the best fixtures for the next six gameweeks?", "Is Chelsea's run good enough to keep Palmer?"

search_players

ParameterTypeDescription
namestringPart of a first, second or web name.
teamstringTeam name or short name.
positionGKP / DEF / MID / FWDOptional.
max_pricenumberMaximum price in £m, e.g. 7.5.
sort_bystringtotal_points (default), form, price, selected_by_percent, ep_next, points_per_game, goals_scored, assists, clean_sheets, minutes, transfers_in_event. Highest first.
limitintegerRows to return (default 15, max 50).

Each row has price, total points, form, ownership, FPL's expected points for the next gameweek (ep_next) and availability status. "Best midfielders under £8m by form?"

get_xpts

ParameterTypeDescription
positionGKP / DEF / MID / FWDOptional.
teamstringOptional.
max_pricenumberOptional, in £m.
gameweekinteger 1-38Optional. Defaults to the next gameweek to play.
limitintegerRows to return (default 15, max 50).

Ranks players by estimated expected points (xPts) next to the opponent and its FDR, expected minutes, and FPL's own ep_next. Double gameweeks count both fixtures; blank ones score zero; flagged players are discounted by FPL's chance of playing.

How xPts is computed. A simple, transparent baseline, not a forecast model: appearance points, plus the player's season xG, xA, clean-sheet, saves and bonus rates per 90 times FPL's scoring values, scaled by expected minutes (the share of available minutes played so far), multiplied by ±10% per FDR point from a neutral 3, and discounted by availability. It extrapolates the season so far, so it is noisy in the first few gameweeks and cannot see rotation, tactics or set-piece changes. Use it to build a shortlist, then cross-check with get_live_availability. "Top five midfielders under £8m by expected points?"

get_player_history

ParameterTypeDescription
playerstringRequired. First, second or full name (Saka, Bukayo Saka). If several players match, the error lists them so you can be specific.
opponentstringOptional. Only this season's matches against that team.
last_ninteger 1-40Optional. Only the most recent N matches.

Returns this season's match-by-match record (opponent, home/away, score, minutes, goals, assists, clean sheets, bonus, xG, xA, points), totals for the matches shown, and season totals for every past season FPL has on record. "How has Haaland done against Arsenal this season?", "Show Saka's last five matches."

What FPL does and doesn't have. FPL serves match-by-match data for the current season only. Past seasons are one row of totals each. So "how did X perform against Arsenal over the last few seasons" cannot be answered, and the tool says so instead of implying the player never faced them.

get_gameweek_stats

ParameterTypeDescription
gameweekinteger 1-38Optional. Defaults to the latest gameweek with results.
positionGKP / DEF / MID / FWDOptional.
teamstringOptional.
sort_bystringtotal_points (default), goals_scored, assists, bonus, minutes, expected_goals, expected_assists. Highest first.
limitintegerRows to return (default 15, max 50).

Every player with minutes in that gameweek, ranked. A gameweek still in progress is labelled, since points and bonus can still change. "Top scorers last gameweek?", "Which defenders kept a clean sheet in GW9?"

get_manager_squad

ParameterTypeDescription
team_idintegerThe manager's FPL team ID: the number in the URL of their FPL Points page (fantasy.premierleague.com/entry/<id>/event/<gw>).
gameweekinteger 1-38Optional. Defaults to the manager's current gameweek.

Returns the 15-man squad with captain and vice-captain, bench, bank, squad value, transfers and any hit taken, the chip played that week, and every chip used so far this season. It reads only the public data FPL already shows anyone with the team ID; no login. "What chips has team 123456 used?"

get_live_availability

Current FPL injury, suspension and availability flags, fetched live from the FPL API. Use it before recommending or captaining a player, so a newly flagged player isn't missed.

Parameters (all optional)

ParameterTypeDescription
playersarray of stringsNames to look up, e.g. ["Saka", "Haaland"]. Case-insensitive; matches first, second or web name. Matching players are returned even when fully available.
statusesarray of stringsOnly return players with these FPL status codes: a available, d doubtful, i injured, s suspended, u unavailable, n not in squad.

With no arguments it returns every player who currently has a flag (any status other than a, or a news note), newest news first, capped at 100 rows. Each row has the player, team, position, status, FPL's chance of playing next round, the news note and when it was added.

Example prompts

  • "Is Saka fit for this gameweek?"
  • "Who has been suspended or ruled out in the last few days?"
  • "Before I set my captain, check that Haaland and Salah have no flags."

How it behaves

  • One request to FPL's bootstrap-static endpoint returns every player, and the response is cached in memory for 5 minutes, so heavy use costs FPL only a few calls an hour per server process.
  • If FPL can't be reached, the last cached copy is served and labelled as possibly out of date. With no cached copy it returns an error.

Prompts and resources

Prompts

Ready-made workflows. They contain instructions only, no data, so they never go stale: the tools fetch live FPL data when the prompt runs. Clients that support MCP prompts show them as slash commands (for example /mcp__fpl-context__captain_pick in Claude Code). Every argument is optional; without team_id the model asks for your squad or answers generally.

PromptArgumentsWhat it does
captain_pickteam_id, gameweekRanks candidates with get_xpts, checks fixtures, opponent history and availability, and recommends a captain, vice-captain and a differential
transfer_planteam_id, free_transfers, gameweeksFinds your weakest assets, compares fixture runs and expected points for replacements within budget, and recommends one or two transfers (and whether a hit is worth it)
chip_timingteam_id, chip (wildcard, freehit, bboost, 3xc)Looks for double and blank gameweeks and suggests when to play each chip you have left

Resources

URIContents
fpl://glossaryFPL status codes, FDR, positions, the data limits, and which tool answers what

Running tests

bash
pip install -e ".[dev]"pytest tests/ -v          # all mocked: no network access neededruff check . && ruff format .

Data sources and disclaimer

fpl-context-mcp is an independent open-source project. It is not affiliated with, endorsed by, or sponsored by the Premier League or Fantasy Premier League.

The package ships no data. It fetches it at run time, from your machine, from:

SourceUsed forNotes
Fantasy Premier League API (fantasy.premierleague.com/api)Players, teams, fixtures, match stats, manager squads, injury/availability newsUnofficial and undocumented; it can change or rate-limit without notice. Responses are cached in memory for a few minutes to keep traffic low.

You are responsible for complying with the source's terms of use for the data you retrieve and, if you host the server for other people, serve. This is especially relevant for commercial use and for public deployments. The MIT license below covers this project's code only, not any third-party content it retrieves.


License

MIT © 2026 Shubham Banthia

來源:README.md,提交 3988ecc

工具

9

get_live_availability

Live injury and suspension flags

Current FPL injury, suspension and availability flags, fetched live from the FPL API. Call this before recommending, picking or captaining any player, so a newly flagged or suspended player isn't missed. With no arguments it lists every player who currently has a flag, newest news first. Pass player names to check specific players (returned even when fully available), and/or statuses to filter. Status codes: a available, d doubtful, i injured, s suspended, u unavailable (left club / on loan), n not in squad. chance_of_playing is FPL's estimate for the next round.

輸入參數playersstatuses

get_current_gameweek

Current gameweek and deadline

The current and next FPL gameweek and the transfer deadline, live from the FPL API. Use it to anchor 'this week' / 'next week' questions and to say how long a manager has left to make transfers.

無需輸入參數。

get_fixtures

Fixtures with difficulty

FPL fixtures with difficulty ratings (FDR, 1 easiest to 5 hardest), live from the FPL API. With no arguments lists the next 5 gameweeks for every team. Pass team to see one team's run from its own point of view, gameweek for a single round, or gameweeks_ahead for a longer window.

輸入參數teamgameweekgameweeks_ahead

search_players

Search and rank players

Find and rank current-season FPL players, live from the FPL API: by name, team, position and maximum price, sorted by a chosen stat. Returns price, total points, form, ownership, FPL's expected points for the next gameweek (ep_next) and availability status. Use it for 'best midfielders under £8m', 'how is Palmer doing', or to find a replacement.

輸入參數nameteamlimitsort_bypositionmax_price

get_manager_squad

Manager squad and chips

A manager's FPL squad for a gameweek, with captain, bench, bank, squad value, transfers and the chips they have used, looked up by their FPL team ID (live from FPL's public API, no login needed). The team ID is the number in the URL of the manager's FPL Points page. Use it as the starting point for transfer, captain and chip advice on their actual team.

輸入參數team_id必填gameweek

get_fixture_run

Fixture run difficulty

How easy or hard a team's next few fixtures are, live from the FPL API: average FDR (1 easiest, 5 hardest), home/away split, and blank or double gameweeks. Pass team for its fixture-by-fixture run; omit it to rank all 20 teams, easiest run first. Prefer this over get_fixtures when judging transfers, captaincy or chip timing.

輸入參數teamgameweeks

get_xpts

Expected points ranking

Rank players by estimated expected points (xPts) for a gameweek, live from the FPL API. A transparent baseline built from season xG/xA/clean-sheet/save/bonus rates, expected minutes, availability and fixture difficulty, shown beside FPL's own ep_next. Filter by position, team and max price. Good for captain shortlists and finding transfer targets; it is noisy early in the season and ignores rotation, so cross-check availability with get_live_availability.

輸入參數teamlimitgameweekpositionmax_price

get_player_history

Player match history

A player's match-by-match record this season (minutes, goals, assists, clean sheets, bonus, xG/xA, points), optionally only against one opponent or the last N matches, plus their season totals for past seasons. Live from the FPL API. Use it for 'how has Saka done against Spurs this season' or 'is his form real'. FPL provides match-level data for the current season only; past seasons are totals, so opponent splits for earlier seasons do not exist.

輸入參數last_nplayer必填opponent

get_gameweek_stats

Gameweek stats ranking

Every player's stats for one gameweek, ranked (default: the latest gameweek with results, sorted by points). Live from the FPL API. Use it for 'top scorers last week', 'which defenders kept clean sheets in GW9' or 'who got the most bonus'. Filter by position and team.

輸入參數teamlimitsort_bygameweekposition

版本歷史

7
  1. v0.11.1最新Oct 22, 2026
  2. v0.11.0Oct 21, 2026
  3. v0.8.0Oct 9, 2026
  4. v0.7.1Sep 30, 2026
  5. v0.7.0Sep 29, 2026
  6. v0.6.3Sep 28, 2026
  7. v0.6.2Sep 26, 2026

評分

已滿足適用檢查項的 90%

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

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

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

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分