英雄联盟-MCP
一个通过Riot Games API提供《英雄联盟》游戏数据访问的模型上下文协议(MCP)服务器,包括PUUID查找、比赛历史和详细比赛信息等功能。
MCP 服务配置
复制以下 JSON 到 OPClaw 或其他 MCP 客户端的配置文件中即可使用
{
"mcpServers": {
"League-Data-MCP": {
"args": [
"league-data-mcp@latest"
],
"command": "uvx",
"env": {
"API": "Your Riot API key here"
}
}
}
}
该服务需要配置环境变量:API
可用工具 (4 个)
该服务在 MCP 协议中暴露的工具,AI 可按需调用
get_puuid 1 个参数 需填 1 项
Get player's PUUID by their gamename and tagline (supports batch query) Args: players (List[dict]): List of player dicts with 'game_name' and 'tag_line' keys e.g., [{"game_name": "Faker", "tag_line": "KR1"}, {"game_name": "Untargetable", "tag_line": "666"}] Returns: List of PUUIDs or None values for failed requests
必填参数:players
get_match_list 3 个参数 需填 1 项
Get a list of match for a player by their PUUID Args: puuid (str): Player's PUUID type (str): Optional match type filter (normal, ranked, etc.) count (str): Optional number of matches to return Returns: List of match IDs or None if failed
必填参数:puuid
get_match_detail 1 个参数 需填 1 项
Get single match detailed data by match ID Args: match_id (str): Match ID (e.g., NA1_5354690210) Returns: A single match detailed data or None if failed
必填参数:match_id
get_match_summary 2 个参数 需填 2 项
Get match summaries for multiple matches (max 10 matches) Returns truncated match data (first 32 lines of JSON) + context around the specified game_name Args: match_ids (List[str]): List of match IDs (e.g., ["NA1_5354690210", "NA1_5354690211"]) game_name (str): Player's game name to search for additional context Returns: List of truncated match data with game_name context or None values for failed requests
必填参数:match_ids、game_name
服务介绍
League-Data-MCP
一个通过Riot Games API提供《英雄联盟》游戏数据访问的模型上下文协议(MCP)服务器。
功能
- 玩家PUUID查询:使用游戏名称和标签行获取玩家的PUUID
- 比赛历史列表:检索玩家的比赛列表,并可选择性过滤
- 比赛详情:获取包括统计数据和游戏数据在内的详细比赛信息
- 比赛摘要列表:获取带有玩家特定上下文的截断比赛数据(针对大数据集优化)
前提条件
- Python 3.13+
- Riot Games API密钥(从Riot开发者门户获取)
- 兼容MCP的客户端(如Claude Desktop)
安装
方法1:从PyPI安装(推荐)
bash
pip install league-data-mcp
方法2:使用uvx安装
bash
uvx install league-data-mcp
方法3:开发安装
-
克隆仓库
bash
git clone https://github.com/syy674998887/league-data-mcp.git
cd league-data-mcp -
安装依赖
bash
uv sync -
设置环境变量
bash
export API="Your Riot API key here"
配置
对于Claude Desktop/Cherry Studio等
- 配置MCP客户端
将服务器配置添加到您的MCP客户端中:
json
{
"mcpServers": {
"League-Data-MCP": {
"command": "uvx",
"args": ["league-data-mcp@latest"],
"env": {
"API": "Your Riot API key here"
}
}
}
}
可用工具
get_puuid
通过游戏名称和标签行获取玩家PUUID(支持批量查询)。
参数:
players(List[dict]): 包含game_name和tag_line键的玩家字典列表
示例:
python
get_puuid([
{"game_name": "Faker", "tag_line": "KR1"},
{"game_name": "Untargetable", "tag_line": "666"}
])
get_match_list
通过玩家的PUUID获取其比赛列表。
参数:
puuid(str): 玩家的PUUIDtype(str, 可选): 比赛类型过滤器(normal, ranked等)count(str, 可选): 返回的比赛数量
示例:
python
get_match_list(
puuid="Player's Puuid",
type="ranked",
count="20"
)
get_match_detail
通过比赛ID获取详细的比赛数据。
参数:
match_id(str): 比赛ID(例如:"NA1_5354690210")
示例:
python
get_match_detail(match_id="NA1_5354690210")
get_match_summary
获取最多10场比赛的截断比赛摘要,包含玩家特定上下文。
参数:
match_ids(List[str]): 比赛ID列表game_name(str): 用于搜索额外上下文的玩家游戏名称
示例:
python
get_match_summary(
match_ids=["NA1_5354690210", "NA1_5354690211"],
game_name="Faker"
)
速率限制
服务器遵守Riot Games API的速率限制。如果您遇到速率限制问题,请考虑实现额外的重试逻辑或请求节流。
错误处理
服务器包括全面的错误处理:
- API错误会记录状态码和错误消息
- 网络故障被捕获并记录
- 无效请求返回
None值
许可证
本项目根据MIT许可证发布 - 详情请参阅LICENSE文件。
免责声明
本项目与Riot Games无关。《英雄联盟》是Riot Games, Inc.的商标。
支持
对于问题和疑问:
- 查看Riot Games API文档
- 在此仓库中提出问题