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
Provider
Obino Paul
Release date
Mar 20, 2025
Language
Python
Stats
2 stars

This MCP server provides access to NBA statistics and live game data through the Model Context Protocol. It bridges the gap between applications and NBA's data services, offering comprehensive information from live scores to historical player statistics.

Installation

Using Docker (Recommended)

  1. Clone the repository
git clone https://github.com/obinopaul/nba-mcp-server.git
cd nba-mcp-server
  1. Install dependencies
pip install -r requirements.txt
  1. Build the Docker image
docker build -t nba_mcp_server .
  1. Run the Docker container
docker run -d -p 5000:5000 --name nba_mcp_server nba_mcp_server
  1. Configure Claude Desktop by adding 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
  1. Create a new environment
conda create --name your_env_name python=3.13
conda activate your_env_name
  1. Install dependencies
pip install -r requirements.txt
  1. Run the NBA MCP server
mcp run nba_server.py
  1. Configure Claude Desktop by adding this to your claude_desktop_config.json:
{
  "mcpServers": {
    "nba_mcp_server": {
      "command": "/path/to/your/python",
      "args": [
        "/path/to/nba_server.py"
      ]
    }
  }
}

After configuring, restart Claude Desktop to enable the NBA server tools in your conversations.

Available Tools

Live Game Data

  • nba_live_scoreboard: Fetch today's NBA scoreboard with game IDs, start times, scores, and broadcast details
  • nba_live_boxscore: Get real-time box score statistics for a specific game ID
  • nba_live_play_by_play: View live play-by-play actions for a game, including scoring plays, fouls, and timeouts

Player Information

  • nba_common_player_info: Access player biographical data, height, weight, team, and position
  • nba_player_career_stats: View player career statistics in various formats (per game, totals, per 36 minutes)
  • nba_list_active_players: Get a complete list of all currently active NBA players
  • nba_player_game_logs: Retrieve a player's game statistics within a specified date range

Team Data

  • nba_team_game_logs_by_name: Access team game logs using just the team name
  • nba_fetch_game_results: Get game results for a specific team ID and date range
  • nba_team_standings: View NBA team standings for any season and season type
  • nba_team_stats_by_name: Access team statistics using the team name with different aggregation methods
  • nba_all_teams_stats: Get statistics for all NBA teams across multiple seasons

Schedule Information

  • nba_list_todays_games: View scoreboard data for any specific date

Usage Examples

Starting the Server

You can run the server directly with Python:

python nba_server.py

Or using the MCP command:

mcp run nba_server.py

Server Configuration

The server runs with a 30-second timeout for reliability and includes signal handlers for graceful shutdown with Ctrl+C.

Once the server is running and configured in Claude Desktop, you can directly ask Claude for NBA information, and it will utilize these tools to provide accurate, up-to-date data.

How to add this MCP server to 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 > MCP and click "Add new global MCP server".

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

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

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 explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

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