API-Football MCP server

Provides a bridge to API-Football for accessing soccer data including league standings, team fixtures, player statistics, and live match information through specialized tools that retrieve both historical and real-time data.
Back to servers
Setup instructions
Provider
Obino Paul
Release date
Mar 20, 2025
Language
Python
Stats
4 stars

The Soccer MCP Server provides a comprehensive interface to football (soccer) statistics and live match data using the API-Football service. It allows applications to access league standings, team information, player statistics, and real-time match data through a standardized Model Context Protocol implementation.

Installation

Prerequisites

  • Python 3.6+
  • API key from RapidAPI for the API-Football service

Getting an API Key

  1. Create an account on RapidAPI
  2. Subscribe to the API-Football API
  3. Copy your API key from your RapidAPI dashboard

Installation Methods

Docker Installation (Recommended)

  1. Clone the repository:

    git clone https://github.com/obinopaul/soccer-mcp-server.git
    cd soccer-mcp-server
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Build the Docker image:

    docker build -t soccer_server .
    
  4. Run the Docker container:

    docker run -d -p 5000:5000 -e RAPID_API_KEY_FOOTBALL=your_api_key_here --name soccer_server soccer_server
    

Direct Python Installation

  1. Clone the repository:

    git clone https://github.com/obinopaul/soccer-mcp-server.git
    cd soccer-mcp-server
    
  2. Install dependencies:

    pip install -r requirements.txt
    
  3. Set the API key environment variable:

    export RAPID_API_KEY_FOOTBALL=your_api_key_here
    

Usage

Starting the Server

Start the server using one of these commands:

python soccer_server.py
# or
mcp run soccer-server.py

Configuring with Claude Desktop

Docker Configuration

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "soccer_server": {
      "command": "docker",
      "args": [
        "exec",
        "-i",
        "soccer_server",
        "python",
        "soccer_server.py"
      ],
      "env": {
        "RAPID_API_KEY_FOOTBALL": "your_api_key_here"
      }
    }
  }
}

Direct Python Configuration

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "soccer_server": {
      "command": "/path/to/your/python",
      "args": [
        "/path/to/soccer_server.py"
      ],
      "env": {
        "RAPID_API_KEY_FOOTBALL": "your_api_key_here"
      }
    }
  }
}

After adding your configuration, restart Claude Desktop to load the soccer server.

Available Tools

League Data Tools

Getting League Information

# Get a league ID by name
get_league_id_by_name(league_name="Premier League")

# Get all leagues (optionally filtered by country)
get_all_leagues_id(country=["England", "Spain"])

# Get detailed league information
get_league_info(league_name="Champions League")

League Standings and Fixtures

# Get standings for multiple leagues and seasons
get_standings(league_id=[39, 140], season=[2022, 2023])

# Get all fixtures for a league and season
get_league_fixtures(league_id=39, season=2023)

# Get league schedule for specific dates
get_league_schedule_by_date(
    league_name="Premier League", 
    date=["2024-03-08", "2024-03-09"], 
    season="2023"
)

Player Data Tools

# Find player IDs by name
get_player_id(player_name="Messi")

# Get a player's profile
get_player_profile(player_name="Messi")

# Get player statistics by name
get_player_statistics(
    player_id=154, 
    seasons=[2022, 2023], 
    league_name="La Liga"
)

# Get player statistics by league ID
get_player_statistics_2(
    player_id=154, 
    seasons=[2022, 2023], 
    league_id=140
)

Team Data Tools

# Get basic team information
get_team_info(team_name="Real Madrid")

# Get past or upcoming fixtures
get_team_fixtures(
    team_name="Manchester United", 
    type="past", 
    limit=3
)

# Get fixtures within a date range
get_team_fixtures_by_date_range(
    team_name="Liverpool", 
    from_date="2023-09-01", 
    to_date="2023-09-30", 
    season="2023"
)

Match/Fixture Data Tools

# Get detailed match statistics
get_fixture_statistics(fixture_id=867946)

# Get all match events (goals, cards, substitutions)
get_fixture_events(fixture_id=867946)

# Get statistics for multiple fixtures
get_multiple_fixtures_stats(fixture_ids=[867946, 867947, 867948])

Live Match Data Tools

# Check if a team is currently playing
get_live_match_for_team(team_name="Chelsea")

# Get live match statistics
get_live_stats_for_team(team_name="Liverpool")

# Get real-time match event timeline
get_live_match_timeline(team_name="Manchester City")

Troubleshooting

  • If you encounter API rate limits, consider upgrading your RapidAPI subscription
  • Ensure your API key is correctly set as an environment variable
  • The server runs with a 30-second timeout for reliability
  • Use Ctrl+C for graceful shutdown

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "soccer_server" '{"command":"docker","args":["exec","-i","soccer_server","python","soccer_server.py"],"env":{"RAPID_API_KEY_FOOTBALL":"your_api_key_here"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "soccer_server": {
            "command": "docker",
            "args": [
                "exec",
                "-i",
                "soccer_server",
                "python",
                "soccer_server.py"
            ],
            "env": {
                "RAPID_API_KEY_FOOTBALL": "your_api_key_here"
            }
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "soccer_server": {
            "command": "docker",
            "args": [
                "exec",
                "-i",
                "soccer_server",
                "python",
                "soccer_server.py"
            ],
            "env": {
                "RAPID_API_KEY_FOOTBALL": "your_api_key_here"
            }
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later