Back to MCP directory
publicPublicdnsLocal runtime

soccer-mcp-server

一个基于Python的足球数据服务,通过API-Football提供全球足球联赛、球队和球员的实时与历史数据

article

README

🚀 足球 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 许可证。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client