MCP-Riot 是一个由社区开发的 模型上下文协议 (MCP) 服务器,它整合了 Riot Games API,旨在通过自然语言查询为 AI 助手提供《英雄联盟》(League of Legends)的数据。该项目让 AI 模型能够检索玩家信息、排位统计数据、英雄熟练度和近期比赛摘要等内容。
免责声明:这是一个开源项目,未得到 Riot Games 的关联或支持。《英雄联盟》(League of Legends®)是 Riot Games, Inc. 的注册商标。
git clone https://github.com/jifrozen0110/mcp-riot.git
cd mcp-riot
# 安装依赖项(使用 uv 或 pip)
uv sync
创建 .env 文件,包含您的 Riot API 密钥:
RIOT_API_KEY=your_riot_api_key
您可以在 https://developer.riotgames.com/ 获取密钥。
在您的 MCP 客户端中注册此服务器(例如,Claude for Desktop)。
编辑 ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"amadeus": {
"command": "/ABSOLUTE/PATH/TO/PARENT/FOLDER/uv",
"args": [
"--directory",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER",
"run",
"--env-file",
"/ABSOLUTE/PATH/TO/PARENT/FOLDER/.env",
"riot.py"
]
}
}
}
用实际项目文件夹路径替换
/ABSOLUTE/PATH/TO/PARENT/FOLDER/。
例如:
{
"mcpServers": {
"amadeus": {
"command": "/Users/user123/mcproto/mcp-riot/uv",
"args": [
"--directory",
"/Users/user123/mcproto/mcp-riot",
"run",
"--env-file",
"/Users/user123/mcproto/mcp-riot/.env",
"python src/main.py"
]
}
}
}
重启 Claude 应用以应用更改。
"Hide on bush 的当前等级和排名以及顶级英雄是什么?" 提供玩家的:
"他在哪些英雄上最强?" 返回基于掌握点数的前 N 名英雄。
"他用 Ahri 多强?" 返回特定英雄的详细掌握度数据。
"展示这个召唤师的最近 3 场比赛" 列出最近的比赛,包括使用的英雄、K/D/A 和结果。
"总结给定比赛 ID 的比赛" 返回玩家的比赛统计数据,如 KDA、伤害、视野和结果。
# 查询玩家信息
curl -X POST "http://localhost:1234/_/query-player" -H "Content-Type: application/json" -d '{"player_name":"example_player"}'
# 获取玩家的顶级英雄
curl -X POST "http://localhost:1234/_/get-top-champions" -H "Content-Type: application/json" -d '{"player_name":"example_player", "limit":3}'
# 获取玩家的比赛历史
curl -X POST "http://localhost:1234/_/match-history" -H "Content-Type: application/json" -d '{"player_name":"example_player", "limit":5}'
以下是服务器暴露的工具:
query-player(查询玩家)# 示例:查询玩家信息
curl -X POST "http://localhost:1234/_/query-player" -H "Content-Type: application/json" -d '{"player_name":"example_player"}'
get-top-champions(获取顶级英雄)# 示例:获取玩家的顶级英雄
curl -X POST "http://localhost:1234/_/get-top-champions" -H "Content-Type: application/json" -d '{"player_name":"example_player", "limit":3}'
match-history(比赛历史)# 示例:获取玩家的比赛历史
curl -X POST "http://localhost:1234/_/match-history" -H "Content-Type: application/json" -d '{"player_name":"example_player", "limit":5}'
MIT License
Copyright (c) 2024 jifrozen
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
⚠️ 重要提示
如果您在配置过程中遇到问题,请检查:
.env文件路径是否正确。- API 密钥是否有效。
- 项目文件夹权限是否允许访问。 如果仍然有问题,可以在 GitHub Issues 提交问题。