本足球 MCP 服务器基于 API-Football(现名为 Squawka)构建,借助模型定制平台(Model Customization Platform, MCP)提供接口。用户可通过此服务器获取实时和历史的足球数据,为足球数据的分析和应用提供有力支持。
本服务器使用前需进行依赖安装、服务器启动以及环境变量的设置。具体步骤如下:
pip install fastapi python-multipart requests typing-extensions pydantic[dotenv]
uvicorn app:app --reload
设置以下环境变量:
export API_KEY="your_api_key_here"
# 获取比赛结果
match_data = client.get_match_by_id(349078)
print(match_data)
# 获取球队排名
standings = client.get_standings()
print(standings)
# 获取球员统计数据
player_stats = client.get_player_stats("messi")
print(player_stats)
from fastapi import HTTPClient
client = HTTPClient()
response = client.get("http://localhost:8000/match/349078")
print(response.json())
curl http://localhost:8000/standings
该服务器的源代码遵循 MIT 许可证。