NBA MCP Server logo

NBA MCP Server

Community
labeveryday

NBA MCP server to get nba stats and data

Publisherlabeveryday
Repositorynba-stats-mcp
LanguagePython
Forks
3
Stars
10
Available tools
0
Transport typestdio, streamable-http
Categories
LicenseMIT
Links
  • Connect tools to AI workflows

    NBA MCP Server exposes MCP capabilities that can be used by compatible AI clients and agents.

  • 0 available tools

    Browse the callable actions below, including names and descriptions when provided by the server.

  • Ready-to-copy setup

    Use the installation snippets to configure this server in your preferred MCP client.

  • Open source signals

    10 stars and 3 forks from the linked repository.

🏀 NBA MCP Server

PyPI version Python 3.10+ License: MIT Tests Code style: ruff

Access comprehensive NBA statistics via Model Context Protocol

A Model Context Protocol (MCP) server that provides access to live and historical NBA data including player stats, game scores, team information, and advanced analytics. v0.3.0: All 21 tools accept human names (not just IDs), return structured data + compact text, and default season to current. Optimized for both large and small LLM clients.

Quick Start with Claude Desktop

  1. Install the server:
bash
# Using uvx (recommended - no install required)
uvx nba-stats-mcp

# Or using pip
pip install nba-stats-mcp

# Or from source
git clone https://github.com/labeveryday/nba-stats-mcp.git
cd nba-stats-mcp
uv sync
  1. Add to your Claude Desktop config file:

MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%/Claude/claude_desktop_config.json

json
{
  "mcpServers": {
    "nba-stats": {
      "command": "uvx",
      "args": ["nba-stats-mcp"]
    }
  }
}

Or if you installed from source:

json
{
  "mcpServers": {
    "nba-stats": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/nba-stats-mcp/",
        "run",
        "nba-stats-mcp"
      ]
    }
  }
}
  1. Restart Claude Desktop

What You Can Ask

  • "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"

Available Tools (21 total)

All tools accept human names — no need to resolve IDs first. Every response includes structured data + compact text.

Player Tools

  • get_player_info(player) - Player bio and details (accepts name or ID)
  • get_player_stats(player, stat_type) - Season, career, game log, hustle, defense, or advanced stats
  • get_player_awards(player) - All awards and accolades
  • get_shooting_data(player, data_type) - Shot chart or shooting splits

Team Tools

  • get_team_roster(team) - Team roster (accepts team name or ID)
  • get_team_advanced_stats(team) - Team efficiency metrics (ORtg, DRtg, pace)
  • get_schedule(team) - Upcoming games
  • get_standings() - League standings by conference

Game Tools

  • get_scoreboard(date?) - Games for a date (defaults to today)
  • find_game(team1, team2?, date?) - Find game_id by team matchup
  • get_game_details(game_id) - Live game info with team stats
  • get_box_score(game_id) - Full box score with player stats
  • get_play_by_play(game_id) - Play-by-play with timestamps
  • get_game_rotation(game_id) - Player rotation/substitution data

League Tools

  • get_leaders(category, scope) - Current season, all-time, or hustle leaders
  • get_season_awards(season?) - Season MVP and major awards

Composite Tools (new in v0.3.0)

  • compare_players(player1, player2) - Side-by-side player comparison
  • daily_summary(date?) - All games + scores for a date
  • team_overview(team) - Roster + record + upcoming schedule

Resolution Tools

  • resolve_player_id(query) - Fuzzy match player name to ID
  • resolve_team_id(query) - Fuzzy match team name to ID

Visual Assets (Public NBA CDN)

This MCP server also returns public NBA CDN asset URLs (no API key) alongside IDs in several tool responses, so UI clients can render visuals.

  • Player headshots:
    • Full size: https://cdn.nba.com/headshots/nba/latest/1040x760/{playerId}.png
    • Thumbnail: https://cdn.nba.com/headshots/nba/latest/260x190/{playerId}.png
  • Team logos (SVG):
    • https://cdn.nba.com/logos/nba/{teamId}/global/L/logo.svg

Tools that include these URLs:

  • players: resolve_player_id, get_player_info, get_player_stats
  • teams: resolve_team_id, get_standings, get_team_roster

Installation Options

With uv (recommended)

bash
git clone https://github.com/labeveryday/nba-stats-mcp.git
cd nba-stats-mcp
uv sync

With pip

bash
pip install nba-stats-mcp

From source

bash
git clone https://github.com/labeveryday/nba-stats-mcp.git
cd nba-stats-mcp
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install -e .

Usage with Other MCP Clients

Python/Strands

python
from mcp import stdio_client, StdioServerParameters
from strands.tools.mcp import MCPClient

mcp_client = MCPClient(lambda: stdio_client(
    StdioServerParameters(
        command="uvx",
        args=["nba-stats-mcp"]
    )
))

Running Standalone (for testing)

bash
# If installed via pip/uvx (stdio, default)
nba-stats-mcp

# Or from source
uv run nba-stats-mcp
# or
python -m nba_mcp_server

Streamable HTTP Transport (new in v0.2.0)

bash
# Run as an HTTP server instead of stdio
nba-stats-mcp --transport streamable-http --host 127.0.0.1 --port 8000

# Also supports SSE transport
nba-stats-mcp --transport sse --port 8000

MCP Inspector

bash
npx @modelcontextprotocol/inspector
# In the Inspector UI, configure a stdio server:
# - Command: uv
# - Args: --directory /absolute/path/to/nba-stats-mcp run nba-stats-mcp
#   (or Command: python, Args: -m nba_mcp_server)

JSON Response Format (v3.0)

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

  • tool_name: tool that ran
  • arguments: arguments passed
  • text: compact 1-3 line summary (clean — no IDs or CDN URLs)
  • data: structured dict with all machine-readable values (primary output for programmatic use)
  • entities: extracted IDs + asset URLs for UI rendering

Visual Assets (Public NBA CDN)

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

  • 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

Configuration

Logging Levels

Control logging verbosity with the NBA_MCP_LOG_LEVEL environment variable (default: WARNING):

bash
export NBA_MCP_LOG_LEVEL=INFO  # For debugging
nba-stats-mcp

In Claude Desktop config:

json
{
  "mcpServers": {
    "nba-stats": {
      "command": "uvx",
      "args": ["nba-stats-mcp"],
      "env": {
        "NBA_MCP_LOG_LEVEL": "INFO"
      }
    }
  }
}

Performance & Reliability Tuning

You can tune request behavior (helpful when agents do parallel tool calls) via env vars:

  • NBA_MCP_HTTP_TIMEOUT_SECONDS: Per-request timeout (default: 30)
  • NBA_MCP_MAX_CONCURRENCY: Max concurrent outbound NBA API requests (default: 8)
  • NBA_MCP_RETRIES: Retries for transient failures (429 / 5xx / network) (default: 2)
  • NBA_MCP_CACHE_TTL_SECONDS: Cache TTL for stats endpoints (default: 120)
  • NBA_MCP_LIVE_CACHE_TTL_SECONDS: Cache TTL for live endpoints (default: 5)
  • NBA_MCP_TLS_VERIFY: TLS verification enabled (default: 1). If you see PermissionError reading CA bundles (common in sandboxed/macOS privacy contexts), set to 0.

Example Claude Desktop config:

json
{
  "mcpServers": {
    "nba-stats": {
      "command": "uvx",
      "args": ["nba-stats-mcp"],
      "env": {
        "NBA_MCP_LOG_LEVEL": "INFO",
        "NBA_MCP_MAX_CONCURRENCY": "8",
        "NBA_MCP_CACHE_TTL_SECONDS": "120",
        "NBA_MCP_LIVE_CACHE_TTL_SECONDS": "5",
        "NBA_MCP_RETRIES": "2",
        "NBA_MCP_HTTP_TIMEOUT_SECONDS": "30"
      }
    }
  }
}

Data Sources

This server uses official NBA APIs:

  • Live Data API - Real-time scores and game data
  • Stats API - Player stats, team info, historical data
  • Schedule API - Full season schedule including future games

Development

Running Tests

bash
uv sync --all-extras
uv run pytest
uv run pytest --cov=nba_mcp_server --cov-report=html

Code Quality

bash
uv run ruff check src/
uv run ruff format src/

Security (Bandit)

Static security analysis:

bash
uv sync --all-extras
uv run bandit -c pyproject.toml -r src/

Releasing to PyPI

This project uses Hatchling for builds. Recommended release steps:

bash
# 1) Ensure clean env + tests
uv sync --all-extras
uv run pytest
uv run ruff check src/ tests/
uv run bandit -c pyproject.toml -r src/

# 2) Build distributions
uv run python -m build

# 3) Upload
uv run twine upload dist/*

Tip: for TestPyPI uploads, use twine upload --repository testpypi dist/*.

Requirements

  • Python 3.10+
  • mcp >= 1.23.0
  • httpx >= 0.27.0

License

MIT License - see LICENSE file for details.

Contributing

Contributions welcome! Please submit a Pull Request.

About the Author

This project was created by Du'An Lightfoot, a developer passionate about AI agents, cloud infrastructure, and teaching in public.

Learn more and connect:

Installation

TypingMind
Prerequisites:

Node.js 18+

{
  "mcpServers": {
    "labeveryday-nba-stats-mcp": {
      "command": "",
      "args": []
    }
  }
}

Use NBA MCP Server MCP with multiple AI models

TypingMind connects MCP tools at the workspace level, so once NBA MCP Server is connected, you can use it with different AI models in TypingMind instead of setting it up separately for each model. You can run MCP locally on your device or connect to a remote MCP server URL.

Option 1: Use the local connector

Use this when the MCP server needs access to local files, apps, or private resources on your computer.

1

Open the MCP settings

In TypingMind, go to Settings, Advanced Settings, then Model Context Protocol and choose Setup Connector.

  1. Open TypingMind in your browser.
  2. Click the Settings icon.
  3. Go to Advanced Settings.
  4. Open the Model Context Protocol section.
  5. Click Setup Connector and choose This Device.
TypingMind MCP connector setup screen with This Device selected
2

Run the connector command

Choose This Device, copy the command from TypingMind, and run it in Terminal. Keep the process running while you use MCP.

  1. Copy the setup command shown by TypingMind.
  2. Open Terminal on macOS or Windows Terminal on Windows.
  3. Paste and run the command.
  4. Approve the package install if Terminal asks you to proceed.
  5. Keep the Terminal window running while using MCP tools.
3

Add NBA MCP Server as a server

When the connector status is Ready, click Edit Servers and paste the MCP server configuration.

  1. Wait until the connector status shows Ready.
  2. Click Edit Servers.
  3. Paste the NBA MCP Server MCP server configuration.
  4. Save the server list.
  5. Refresh if you want to confirm the connector is still ready.
TypingMind MCP settings showing active server and Edit Servers button
{
  "mcpServers": {
    "labeveryday-nba-stats-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "nba-stats-mcp"
      ]
    }
  }
}
4

Use it across models

Save the server list, open Plugins, enable the NBA MCP Server MCP tools, then select any supported AI model in TypingMind and use the tools in chat or assign them to an AI agent.

  1. Open the Plugins page in TypingMind.
  2. Enable the NBA MCP Server MCP tools.
  3. Start a chat and choose the AI model you want to use.
  4. Use the MCP tools in chat or assign them to an AI agent.
  5. Switch to another AI model whenever needed without reconnecting MCP.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use NBA MCP Server to help me with this task?
NBA MCP Server
Sure. I read it.
Here is what I found using NBA MCP Server.

Option 2: Add an MCP server URL

Use this when NBA MCP Server is already hosted remotely or your team wants one shared connector that multiple users can access.

1

Open MCP connectors

In TypingMind, go to Plugins, open MCP connectors, then choose Add URL.

  1. Open TypingMind in your browser.
  2. Go to Plugins.
  3. Open MCP connectors.
  4. Click Add URL.
TypingMind Add Custom MCP Server URL form
2

Paste the server URL

Enter your server URL in the Server URL field. Add a connection name, description, icon, custom HTTP headers, or OAuth client settings if the server requires them.

  1. Paste your server URL into the Server URL field.
  2. Enter a connection name for NBA MCP Server.
  3. Add a description and icon if you want it to be easier to identify.
  4. Add custom HTTP headers or OAuth client details if the server requires authentication.
3

Create the connection

Click Create connection, then return to the Plugins list and confirm the new MCP connection is active.

  1. Click Create connection.
  2. Return to the MCP connectors list.
  3. Confirm the NBA MCP Server connection appears as active.
  4. Refresh the plugin list if the connection does not appear immediately.
4

Switch models without reconnecting

Start a chat with your preferred model, enable the NBA MCP Server tools from Plugins, and switch to another model whenever needed. The MCP connection stays available to the TypingMind workspace.

  1. Start a new chat in TypingMind.
  2. Select the AI model you want to use.
  3. Enable the NBA MCP Server tools from Plugins.
  4. Ask the model to use the tool when needed.
  5. Switch to another AI model and reuse the same MCP connection.
TypingMind chat using enabled MCP tools with a selected AI model
Can you use NBA MCP Server to help me with this task?
NBA MCP Server
Sure. I read it.
Here is what I found using NBA MCP Server.

Frequently asked questions

What is the NBA MCP Server MCP server used for?

NBA MCP Server is an MCP server that lets compatible AI clients connect to external tools and context. In TypingMind, you can add this MCP server once and make its tools available in your AI workspace.

Can I use NBA MCP Server MCP with multiple AI models in TypingMind?

Yes. TypingMind connects MCP tools at the workspace level, so you can use NBA MCP Server with different AI models such as Claude, ChatGPT, Gemini, or other models you have configured in TypingMind without setting up the MCP server separately for each model.

Why use NBA MCP Server MCP with TypingMind?

TypingMind is one of the best frontends for LLM chat because it brings multiple AI models, prompts, plugins, AI agents, API keys, and MCP tools into one workspace. With NBA MCP Server connected, you can use its MCP tools across your preferred models while keeping your chat workflow organized in TypingMind.

How do I connect NBA MCP Server MCP to TypingMind?

NBA MCP Server can be connected in TypingMind with the local MCP connector or by adding a remote MCP server URL. Use the local connector when the server needs access to files, apps, or private resources on your device, and use a server URL when the MCP server is hosted remotely.

What tools does NBA MCP Server MCP provide in TypingMind?

NBA MCP Server exposes MCP capabilities that can be enabled from the TypingMind Plugins page and used in chat or assigned to AI agents.

Do I need to share my API keys with TypingMind to use NBA MCP Server MCP?

No. TypingMind is local-first and lets you keep your model providers, API keys, prompts, and MCP configuration under your control. If NBA MCP Server requires authentication, add the required headers, OAuth settings, or local configuration for that MCP server when you create the connection.

Related MCP Servers

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇