NBA Stats MCP server

Provides a Python-based interface to NBA statistics and live game data, offering tools for accessing game information, player statistics, team data, and league standings without requiring knowledge of the underlying API structure.
Back to servers
Setup instructions
Provider
Obino Paul
Release date
Mar 20, 2025
Language
Python
Stats
2 stars

This NBA MCP server provides access to NBA statistics and live game data through the Model Context Protocol (MCP), serving as a bridge between applications and the NBA's data services.

Installation

Using Docker (Recommended)

  1. Clone the repository:

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

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

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

    docker run -d -p 5000:5000 --name nba_mcp_server nba_mcp_server
    
  5. Add this to your claude_desktop_config.json:

    {
      "mcpServers": {
        "nba_mcp_server": {
          "command": "docker",
          "args": [
            "exec",
            "-i",
            "nba_mcp_server",
            "python",
            "nba_server.py"
          ]
        }
      }
    }
    

Direct Python Execution

  1. Clone the repository:

    git clone https://github.com/obinopaul/nba-mcp-server.git
    cd nba-mcp-server
    
  2. Create a new environment:

    conda create --name your_env_name python=3.13
    conda activate your_env_name
    
  3. Install dependencies:

    pip install -r requirements.txt
    
  4. Run the NBA MCP server:

    mcp run nba_server.py
    
  5. Add this to your claude_desktop_config.json:

    {
      "mcpServers": {
        "nba_mcp_server": {
          "command": "/path/to/your/python",
          "args": [
            "/path/to/nba_server.py"
          ]
        }
      }
    }
    

After configuration, restart Claude Desktop to load the NBA server.

Available Tools

Live Game Data

  • nba_live_scoreboard: Fetches today's NBA scoreboard with game IDs, start times, scores, and broadcast details
  • nba_live_boxscore: Retrieves real-time box score for a given NBA game ID with detailed player and team statistics
  • nba_live_play_by_play: Gets live play-by-play actions for a specific game including scoring plays, fouls, timeouts, and substitutions

Player Information

  • nba_common_player_info: Retrieves basic information about a player (biographical data, height, weight, team, position)
  • nba_player_career_stats: Obtains a player's career statistics in different formats (per game, totals, per 36 minutes)
  • nba_list_active_players: Returns a list of all currently active NBA players
  • nba_player_game_logs: Obtains a player's game statistics within a specified date range

Team Data

  • nba_team_game_logs_by_name: Fetches a team's game logs using the team name
  • nba_fetch_game_results: Fetches game results for a given team ID and date range
  • nba_team_standings: Fetches NBA team standings for a given season and season type
  • nba_team_stats_by_name: Fetches team statistics using the team name with different aggregation methods
  • nba_all_teams_stats: Fetches statistics for all NBA teams across multiple seasons

Schedule Information

  • nba_list_todays_games: Returns scoreboard data for any specific date

Usage

Start the server:

python nba_server.py
# or
mcp run nba_server.py

The server runs with a 30-second timeout for more reliable operation and includes signal handlers for graceful shutdown (Ctrl+C).

Once configured and running, you can use all the NBA data tools in your conversations with Claude through Claude Desktop.

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 "nba_mcp_server" '{"command":"docker","args":["exec","-i","nba_mcp_server","python","nba_server.py"]}'

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": {
        "nba_mcp_server": {
            "command": "docker",
            "args": [
                "exec",
                "-i",
                "nba_mcp_server",
                "python",
                "nba_server.py"
            ]
        }
    }
}

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": {
        "nba_mcp_server": {
            "command": "docker",
            "args": [
                "exec",
                "-i",
                "nba_mcp_server",
                "python",
                "nba_server.py"
            ]
        }
    }
}

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