api-football-mcp-server
Enables natural language querying of football/soccer data via the API-Football service, providing access to leagues, teams, players, fixtures, standings, and statistics.
README
API-Football MCP Server
A Model Context Protocol (MCP) server that provides access to football/soccer data through the API-Football service. This creates a standardised way for language models to interact with this API, and users a way to query in natural language.

Architecture
graph TD
LLM["`**LLM with MCP Client**
Claude/GPT-4/etc.`"]
subgraph Server ["`**MCP Server**
Football Data Gateway`"]
direction TB
MCP["`**MCP Protocol Handler**
Request Router & Response Manager`"]
subgraph Functions ["`**Available Functions**`"]
direction LR
API1["`**get_leagues**
Fetch league data`"]
API2["`**get_teams**
Fetch team data`"]
API3["`**get_players**
Fetch player data`"]
API4["`**get_fixtures**
Fetch match data`"]
end
MCP --> Functions
end
ExtAPI["`**API-Football**
External Sports Data API`"]
%% Main connections
LLM <===> MCP
%% Function connections to external API
API1 <--> ExtAPI
API2 <--> ExtAPI
API3 <--> ExtAPI
API4 <--> ExtAPI
%% Styling with improved colors
classDef llm fill:#4CAF50,stroke:#2E7D32,stroke-width:3px,color:#fff
classDef mcp fill:#2196F3,stroke:#1565C0,stroke-width:2px,color:#fff
classDef functions fill:#FF9800,stroke:#F57C00,stroke-width:2px,color:#fff
classDef external fill:#9C27B0,stroke:#6A1B9A,stroke-width:3px,color:#fff
classDef server fill:#E3F2FD,stroke:#1976D2,stroke-width:2px,color:#1976D2
class LLM llm
class MCP mcp
class API1,API2,API3,API4 functions
class ExtAPI external
class Server server
1. Clone and Setup
Clone the repository:
git clone https://github.com/danknight/api-football-mcp-server.git
cd api-football-mcp-server
Install dependencies:
pip install -r requirements.txt
2. Get Your API Key and Set Environment
Create a .env file with your credentials:
API_FOOTBALL_KEY=your_api_key_here
Sign up on API-Football to get an API key.
3. Configure MCP Client
Register this server in your MCP client (e.g. Cursor, Claude for Desktop).
{
"mcpServers": {
"api-football": {
"command": "python",
"args": ["absolute/path/to/server.py"],
"env": {
"API_FOOTBALL_KEY": "YOUR_API_KEY"
}
}
}
}
Or run directly from the command line and explore with Inspector:
python server.py
Tools
The following tools are exposed to MCP clients:
League Information
| Tool Name | Description | Parameters |
|---|---|---|
get_leagues |
Get available leagues | country (str, optional), season (int, optional) |
get_league_info |
Get detailed league information | league_id (int) |
get_countries |
Get available countries | None |
get_standings |
Get league standings | league_id (int), season (int) |
Team Information
| Tool Name | Description | Parameters |
|---|---|---|
get_teams |
Get teams in a league | league_id (int), season (int, optional) |
get_team_stats |
Get statistics for a team | team_id (int), league_id (int), season (int, optional) |
get_team_id_by_name |
Get team ID by team name | team_name (str), league_id (int, optional), season (int, optional) |
get_team_transfers |
Get transfer information for a team | team_id (int) |
Player Information
| Tool Name | Description | Parameters |
|---|---|---|
get_players |
Get players in a team | team_id (int), season (int) |
get_player_stats |
Get statistics for a player | player_id (int), season (int) |
Match/Fixture Information
| Tool Name | Description | Parameters |
|---|---|---|
get_fixtures |
Get fixtures/matches | league_id (int, optional), team_id (int, optional), season (int, optional), date (str, optional), next (int, optional), last (int, optional) |
get_fixture_stats |
Get statistics for a fixture | fixture_id (int) |
get_predictions |
Get predictions for a fixture | fixture_id (int) |
get_head_to_head |
Get head-to-head statistics between teams | team1_id (int), team2_id (int) |
Player Statistics
| Tool Name | Description | Parameters |
|---|---|---|
get_top_scorers |
Get top scorers in a league | league_id (int), season (int) |
get_top_assists |
Get top assisters in a league | league_id (int), season (int) |
Other Information
| Tool Name | Description | Parameters |
|---|---|---|
get_venue |
Get venue information | venue_id (int) |
get_injuries |
Get injury information | team_id (int), player_id (int), season (int) |
Usage Examples
Get leagues in a specific country
get_leagues(country="England")
Get teams in a specific league
get_teams(league_id=39, season=2023) # Premier League 2023
Get team statistics
get_team_stats(team_id=42, league_id=39, season=2023) # Arsenal stats
Get fixtures for a team
get_fixtures(team_id=42, next=5) # Next 5 Arsenal matches
Get top scorers in a league
get_top_scorers(league_id=39, season=2023) # Premier League top scorers
Development
Running Tests
Currently, no tests are implemented. To add tests:
- Create a
tests/directory - Add test files following the naming convention
test_*.py - Run tests with
python -m pytest
Adding New Tools
To add a new tool:
- Add a new function in
main.pydecorated with@mcp.tool() - Implement the API call using
make_api_request() - Update this README with the new tool information
- Test the tool with the MCP Inspector
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。