Soccer Mcp Server

Soccer Mcp Server

🚀 足球 MCP 服务器

本足球 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"

✨ 主要特性

数据类型

  • 比赛数据:涵盖比分、进球时间、黄牌、红牌等详细信息。
  • 球队信息:包含球队排名、积分、胜负记录等关键数据。
  • 球员统计:提供射门次数、传球成功率、抢断数等球员表现数据。
  • 联赛详情:展示各联赛的最新 standings 和赛程安排。

示例接口

# 获取比赛结果
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

🔧 技术细节

  • 使用 FastAPI 框架构建,保证了服务器的高性能和可扩展性。
  • 数据来源于 API-Football,确保数据的准确性和实时性。
  • 通过 Pydantic 进行数据验证,提高了数据的可靠性。

📄 许可证

该服务器的源代码遵循 MIT 许可证。

  • 0 关注
  • 0 收藏,15 浏览
  • system 提出于 2025-09-21 03:18

相似服务问题

相关AI产品