SuperAPIAI Directory

nba_mcp_server

github.com · AI developer platforms

Live and historical NBA statistics: player stats, game scores, team data and advanced analytics.

Open website Alternatives
PricingOpen source开源项目(可免费自部署)
PlatformsmacOS

About this tool

NBA MCP Server is a Model Context Protocol (MCP) server designed to provide access to real-time and historical NBA data through the MCP protocol, covering player statistics, game scores, team information, and advanced analytics. The project was created by Du'An Lightfoot, is licensed under the MIT License, and its source code is hosted on GitHub.

Main Capabilities

The server provides 21 tools, all of which accept human-readable names (not just IDs) and return structured data along with compact text. The default season is the current season. The tools are divided into the following categories:

  • Player-related: get_player_info (player profile and detailed information), get_player_stats (season, career, game log, hustle, defensive, or advanced statistics), get_player_awards (all awards and honors), get_shooting_data (shot chart or shot distribution).
  • Team-related: get_team_roster (team roster), get_team_advanced_stats (team efficiency metrics such as ORtg, DRtg, pace), get_schedule (upcoming games), get_standings (standings by conference and division).
  • Game-related: get_scoreboard (games on a specified date, defaulting to today), find_game (find game_id by team matchup), get_game_details (live game information and team statistics), get_box_score (full box score), get_play_by_play (timestamped play-by-play data), get_game_rotation (player rotation/substitution data).
  • Leaderboards and Awards: get_leaders (current season, all-time, or hustle leaderboards), get_season_awards (season MVP and major awards).
  • Composite tools (new in v0.3.0): compare_players (side-by-side player comparison), daily_summary (all games and scores on a given day), team_overview (roster + record + upcoming schedule).
  • Resolution tools: resolve_player_id (fuzzy match player name to ID), resolve_team_id (fuzzy match team name to ID).

Usage

Quick Start (Claude Desktop)

  1. Install the server.
  2. Add it to the Claude Desktop configuration file:
    • MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%/Claude/claude_desktop_config.json
  3. Restart Claude Desktop.

Installation Options

  • Use uv (recommended).
  • Install from source.

Other MCP Clients

The server can also be used with other MCP clients and supports standalone operation (for testing) as well as Streamable HTTP transport (new in v0.2.0).

Example Queries

  • "Show me today's NBA games"
  • "What are LeBron James' stats this season?"
  • "Get the box score for Lakers vs Warriors"
  • "Who are the top 10 scorers this season?"
  • "Show me all-time assists leaders"
  • "When do the Celtics play next?"
  • "Get Stephen Curry's shot chart"
  • "Who are the league leaders in deflections?"
  • "Show me Giannis' career awards"

Response Format

All tools return a single JSON object (encoded as an MCP TextContent.text string). The top-level schema includes:

  • tool_name: the tool that was run
  • arguments: the arguments passed
  • text: a compact 1-3 line summary (clean, with no IDs or CDN URLs)
  • data: a structured dictionary containing all machine-readable values(the primary output for programmatic use)
  • entities: extracted IDs and asset URLs for UI rendering

The server includes public CDN URLs in entities (no API key required):

  • Player headshots:
    • headshot_url:https://cdn.nba.com/headshots/nba/latest/1040x760/{playerId}.png
    • thumbnail_url:https://cdn.nba.com/headshots/nba/latest/260x190/{playerId}.png
  • Team logos:
    • team_logo_url:https://cdn.nba.com/logos/nba/{teamId}/global/L/logo.svg

Tools containing these URLs:

  • Players: resolve_player_id, get_player_info, get_player_stats
  • Teams: resolve_team_id, get_standings, get_team_roster

Configuration and Tuning

Log verbosity and request behavior can be controlled via environment variables:

  • NBA_MCP_LOG_LEVEL: log level (default: WARNING)
  • NBA_MCP_HTTP_TIMEOUT_SECONDS: per-request timeout (default: 30)
  • NBA_MCP_MAX_CONCURRENCY: maximum number of concurrent outbound NBA API requests (default: 8)
  • NBA_MCP_RETRIES: number of retries for transient failures (429 / 5xx / network) (default: 2)
  • NBA_MCP_CACHE_TTL_SECONDS: stats endpoint cache TTL (default: 120)
  • NBA_MCP_LIVE_CACHE_TTL_SECONDS: live endpoint cache TTL (default: 5)
  • NBA_MCP_TLS_VERIFY: TLS verification enabled (default: 1). If you encounter a PermissionError when reading the CA bundle (common in sandbox/macOS privacy contexts), you can set it to 0.

Data Sources

This server uses the official NBA API:

  • Live Data API: live scores and game data
  • Stats API: player stats, team information, historical data
  • Schedule API: full season schedule, including future games

Security and Release

  • Static security analysis using Bandit.
  • Publishing to PyPI: the project is built with Hatchling. Recommended release steps (specific steps not provided in the materials). For TestPyPI upload, use twine upload --repository testpypi dist/*.

Dependencies and License

  • Dependency: httpx >= 0.27.0
  • License: MIT License (see the LICENSE file for details)

Use Cases

This server is suitable for scenarios that require integrating NBA data into AI agents or chat clients, for example querying live scores, player stats, team information, etc. via Claude Desktop. It is also suitable for developers building applications that need NBA data.

Limitations

  • The materials do not provide specific installation command details (such as the specific uv installation command).
  • The materials do not provide pricing or fee information.
  • The materials do not provide a complete list of platform compatibility.
  • The materials do not provide performance benchmarks or effectiveness data.
  • The materials do not provide detailed usage steps (such as the specific steps for installing from source).

Contributions: Pull Requests are welcome.

Up/Down to navigate · Enter to open · ESC to closeBrowse all tools