Skip to main content
Glama

⚽ FPL MCP — 面向梦幻英超的模型上下文协议服务器

Python 3.11+ MCP Standard License: MIT Built with uv

一个面向梦幻英超(FPL)的异步模型上下文协议(MCP)服务器。为 AI 编程助手和智能体框架(Antigravity、Claude Desktop、Cursor、Custom Agents)提供33 个专用工具,用于分析赛程、挖掘冷门球员、管理阵容、追踪实时比分、监控价格波动,以及优化转会与队长选择。


🌟 核心特性

  • 🚀 33 个专用工具:完整覆盖官方 FPL 接口(Bootstrap、赛程、FDR、阵容、历史、筹码、实时比赛周比分、迷你联赛、定位球主罚者、冷门球员和价格变动)。

  • 🔒 安全且只读:专注于深度分析和 AI 建议,不进行有风险的自动转会操作。

  • ⚡ 内存 TTL 缓存:智能的按接口缓存机制,避免触发 FPL 服务器的限流,同时保持实时比赛周比分的新鲜度。

  • 🛡️ 支持公开与私有数据:仅凭球队 ID 即可立即使用公开数据。支持会话认证 / Cookie 以访问私有阵容。

  • 🔌 标准 stdio 传输:可与任何符合 MCP 规范的客户端即插即用。


Related MCP server: MCP Eleven

🏗️ 架构

fpl-mcp/
├── src/fpl_mcp/
│   ├── server.py          # MCP Server entrypoint (stdio transport)
│   ├── client.py          # Async FPL HTTP client with TTL caching
│   ├── auth.py            # Session cookie & credential manager
│   ├── cache.py           # In-memory thread-safe TTL cache
│   ├── constants.py       # API endpoints, TTLs, positions & chip maps
│   └── tools/
│       ├── registry.py    # Aggregator & dynamic tool dispatcher
│       ├── bootstrap.py   # Players, teams, and season status
│       ├── fixtures.py    # Fixtures schedule & FDR matrix
│       ├── squad.py       # Team picks, history, and manager info
│       ├── players.py     # Deep player statistics (xG, xA, ICT, PPG)
│       ├── transfers.py   # Transfer history, bank, and AI transfer scout
│       ├── chips.py       # Chip tracker & Double/Blank GW strategy engine
│       ├── live.py        # Real-time provisional GW scores & bonus points
│       ├── leagues.py     # Classic & Head-to-Head mini-league tables
│       ├── news.py        # Injury reports, bans, and set-piece takers
│       ├── picks.py       # Algorithmically ranked captain picks & differentials
│       └── prices.py      # Predicted price risers/fallers & confirmed changes
├── pyproject.toml
└── README.md

🚀 快速开始

1. 环境要求

  • Python 3.11+

  • uv(推荐)或 pip

2. 安装

# Clone the repository
git clone https://github.com/dexhamter/fpl-mcp.git
cd fpl-mcp

# Install dependencies into virtual environment
uv sync

3. 配置

复制示例环境文件:

cp .env.example .env

使用你的球队信息编辑 .env:

# Your FPL Team ID (found in the URL: https://fantasy.premierleague.com/entry/{ID}/event/1)
FPL_TEAM_ID=1234567

# Optional: FPL login credentials or browser session cookie for private team data
FPL_EMAIL=your@email.com
FPL_PASSWORD=your_password
# FPL_COOKIE=pl_profile=...

⚙️ 连接 MCP 客户端

🤖 Antigravity / Gemini CLI

将服务器添加到你的 ~/.gemini/config/mcp_config.json:

{
  "mcpServers": {
    "fpl": {
      "command": "C:/Users/your_user/Documents/fpl/.venv/Scripts/python.exe",
      "args": ["-m", "fpl_mcp.server"],
      "env": {
        "PYTHONPATH": "C:/Users/your_user/Documents/fpl/src"
      }
    }
  }
}

🟣 Claude Desktop

添加到你的 claude_desktop_config.json:

{
  "mcpServers": {
    "fpl": {
      "command": "uv",
      "args": [
        "--directory",
        "/path/to/fpl-mcp",
        "run",
        "fpl-mcp"
      ]
    }
  }
}

💻 Cursor / Windsurf

在 Settings -> Features -> MCP Servers 中:

  • 类型:command

  • 命令:uv --directory /path/to/fpl-mcp run fpl-mcp


🛠️ 工具目录(33 个工具)

1. 通用与 Bootstrap 数据

工具

参数

描述

get_all_players

position、team、max_price、min_form

查询所有活跃球员,支持筛选与排序

search_player

query(必填)

按部分或完整名称搜索球员

get_all_teams

无

获取全部 20 支英超球队及其实力评级

get_game_settings

无

比赛周截止时间、平均得分、顶尖经理

2. 赛程与难度(FDR)

工具

参数

描述

get_fixtures

gameweek

全部或指定比赛周的赛程安排

get_team_fixtures

team_name(必填)、next_n

球队未来赛程及 FDR 评级

get_fdr_table

next_n

所有球队的 FDR 对比网格

3. 阵容与经理概览

工具

参数

描述

get_my_squad

无

当前 15 人阵容、首发、替补、队长

get_entry_info

team_id

总排名、总积分、银行余额和球队价值

get_gw_picks

gameweek(必填)、team_id

任意已完成比赛周的阵容排布

get_season_history

team_id

逐比赛周的排名和积分走势

4. 球员分析

工具

参数

描述

get_player_stats

player_id、player_name

xG、xA、ICT 指数、奖励积分、出场时间、状态

get_player_history

player_id、player_name

球员逐比赛周的详细比赛记录

get_top_performers

sort_by、position、max_price、limit

按积分、状态、场均得分或 ICT 排名的榜单

5. 转会与预算

工具

参数

描述

get_transfer_history

team_id

完整赛季转会记录,含买入/卖出成本

get_bank_balance

无

可用银行资金、免费转会次数、球队价值

get_transfer_suggestions

position、max_price、next_n_gws

综合算法,根据状态与 FDR 挖掘转会建议

6. 筹码策略

工具

参数

描述

get_chip_status

无

追踪 Wildcards、Free Hit、Bench Boost、Triple Captain

get_chip_advice

next_n

双赛周/空赛周检测及最佳筹码使用时机

7. 实时比赛周比分

工具

参数

描述

get_live_gw_scores

gameweek、sort_by、limit

实时临时球员积分、进球、助攻

get_my_live_score

gameweek

你的阵容实时累计总分,含队长加倍系数

8. 迷你联赛与排名

工具

参数

描述

get_my_leagues

无

你的球队参与的所有经典和一对一迷你联赛

get_classic_league_standings

league_id(必填)、page

完整排行榜表格,含排名和比赛周得分

get_h2h_league_standings

league_id(必填)、page

一对一战绩(胜/平/负、比赛积分)

9. 球队新闻与定位球

工具

参数

描述

get_player_news

status

筛选受伤、停赛或存疑状态的球员

get_set_piece_takers

team_name

指定的点球、任意球和角球主罚者

check_my_squad_news

无

对全部 15 名球员进行健康检查并发出状态提醒

10. 队长与冷门球员

工具

参数

描述

get_captain_suggestions

from_my_squad、gameweek、top_n

多因素加权队长评分(状态、ICT、FDR、主场)

get_differentials

max_ownership、position、max_price

高潜力低持有率球员推荐(默认 <15%)

get_ownership_stats

position、sort_by、limit

持有率百分比、转会动向和净变化

11. 价格变动

工具

参数

描述

get_price_risers

position、limit

基于净转入转会的即将涨价球员

get_price_fallers

position、limit

基于净转出转会的即将降价球员

get_price_changes

direction、since

本比赛周或本赛季已确认的价格调整


💡 示例助手提示词

配置好智能体后,你可以用自然语言提问,例如:

  • “第 1 比赛周我该选谁当队长?根据赛程和预期进球参与度比较我的最佳选项。”

  • “在截止时间前检查我的阵容是否有伤病隐患。”

  • “我有 £0.5m 的银行余额,需要换掉一名 £7.5m 以下且未来赛程轻松的中场球员。你有什么建议?”

  • “给我看看持有率低于 10% 的经理人中最值得关注的 5 名冷门前锋。”

  • “本赛季阿森纳和利物浦的点球主罚者是谁?”

  • “我们在双赛周和空赛周的策略是什么?什么时候应该考虑使用 Bench Boost?”


⏱️ 缓存策略

为保持低延迟并遵守 FPL 服务器使用规范,数据在内存中缓存:

接口类型

默认 TTL

实时比赛周比分(live.py)

60 秒

阵容与参赛信息(squad.py)

120 - 300 秒

Bootstrap 与球员数据(bootstrap.py、players.py)

300 秒(5 分钟)

赛程与安排(fixtures.py)

600 秒(10 分钟)


📜 许可证

本项目基于 MIT 许可证 授权。


⚽ 免责声明

本工具与英超联赛或梦幻英超无官方关联,亦未获得其认可。所有数据均从公开的 FPL API 接口获取。

Related MCP Connectors

Related MCP Servers

  • A
    license
    B
    quality
    B
    maintenance
    A Model Context Protocol server that provides access to Fantasy Premier League data, allowing users to compare players, find team information, view gameweek data, and get FPL-related advice through Claude for Desktop and other MCP-compatible clients.
    23
    94 PyPI
    80
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    An open-source MCP server that turns any AI assistant into a football data analytics and scouting platform, enabling natural language queries over 40+ stats, 20+ leagues, and 10,000+ players.
    1
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    MCP server for the Fantasy Premier League API, enabling querying of players, teams, fixtures, and your FPL team through any MCP-compatible client.
    -
  • A
    license
    A
    quality
    C
    maintenance
    An MCP server for Fantasy Premier League that allows querying gameweek info, player recommendations, squad management, and executing transfers via FPL's public API with optional cookie authentication.
    4
    10 npm
    1
    ISC