Logo di NBA MCP Server

NBA MCP Server

Community
labeveryday

NBA MCP server to get nba stats and data

Pubblicato dalabeveryday
Repositorynba-stats-mcp
LinguaPython
Fork
3
Stelle
10
Strumenti disponibili
0
Tipo di trasportostdio, streamable-http
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    NBA MCP Server mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • Strumenti disponibili: 0

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni se il server li fornisce.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse della comunità open source

    Stelle: 10; fork: 3 (repository collegato).

🏀 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:

Installazione

TypingMind
Prerequisiti:

Node.js 18+

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

Usa NBA MCP Server MCP con più modelli AI

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso NBA MCP Server, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Puoi eseguire MCP localmente sul tuo dispositivo o connetterti all'URL di un server MCP remoto.

Opzione 1: usa il connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura connettore.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura connettore e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con l’opzione «Questo dispositivo» selezionata
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi NBA MCP Server come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di NBA MCP Server.
  4. Salva l'elenco dei server.
  5. Se vuoi verificare che il connettore sia ancora pronto, aggiorna la pagina.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "labeveryday-nba-stats-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "nba-stats-mcp"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di NBA MCP Server, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di NBA MCP Server.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare NBA MCP Server per aiutarmi con questa attività?
NBA MCP Server
Certo. L’ho letto.
Ecco cosa ho trovato con NBA MCP Server.

Opzione 2: aggiungi l'URL di un server MCP

Usa questo metodo se NBA MCP Server è già ospitato in remoto o se il tuo team vuole un unico connettore condiviso accessibile a più utenti.

1

Apri Connettori MCP

In TypingMind, vai su Plugin, apri Connettori MCP e scegli Aggiungi URL.

  1. Apri TypingMind nel tuo browser.
  2. Vai a Plugin.
  3. Apri Connettori MCP.
  4. Fai clic su Aggiungi URL.
Modulo di TypingMind per aggiungere l'URL di un server MCP personalizzato
2

Incolla l'URL del server

Inserisci URL del tuo server nel campo URL del server. Aggiungi un nome per la connessione, una descrizione, un'icona, header HTTP personalizzati o le impostazioni del client OAuth se richiesti dal server.

  1. Incolla URL del tuo server nel campo URL del server.
  2. Inserisci un nome per la connessione a NBA MCP Server.
  3. Se vuoi riconoscere più facilmente la connessione, aggiungi una descrizione e un’icona.
  4. Aggiungi header HTTP personalizzati o i dati del client OAuth se il server richiede l'autenticazione.
3

Crea la connessione

Fai clic su Crea connessione, poi torna all'elenco dei plugin e verifica che la nuova connessione MCP sia attiva.

  1. Fai clic su Crea connessione.
  2. Torna all'elenco dei connettori MCP.
  3. Verifica che la connessione NBA MCP Server risulti attiva.
  4. Aggiorna l'elenco dei plugin se la connessione non appare subito.
4

Cambia modello senza dover ristabilire la connessione MCP

Avvia una chat con il tuo modello preferito, abilita gli strumenti di NBA MCP Server dalla sezione Plugin e passa a un altro modello quando serve. La connessione MCP rimane disponibile nell'area di lavoro di TypingMind.

  1. Avvia una nuova chat in TypingMind.
  2. Seleziona il modello IA che vuoi usare.
  3. Abilita gli strumenti di NBA MCP Server dalla sezione Plugin.
  4. Chiedi al modello di usare lo strumento quando serve.
  5. Passa a un altro modello IA e riutilizza la stessa connessione MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare NBA MCP Server per aiutarmi con questa attività?
NBA MCP Server
Certo. L’ho letto.
Ecco cosa ho trovato con NBA MCP Server.

Domande frequenti

A cosa serve il server MCP NBA MCP Server?

NBA MCP Server è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare il server MCP NBA MCP Server con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare NBA MCP Server con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP NBA MCP Server con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando NBA MCP Server, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego il server MCP NBA MCP Server a TypingMind?

Puoi collegare NBA MCP Server a TypingMind con il connettore MCP locale oppure aggiungendo l'URL di un server MCP remoto. Usa il connettore locale quando il server deve accedere a file, app o risorse private sul tuo dispositivo; usa invece l'URL del server quando il server MCP è ospitato in remoto.

Quali strumenti offre il server MCP NBA MCP Server in TypingMind?

NBA MCP Server mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare il server MCP NBA MCP Server?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se NBA MCP Server richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Elenco completo

Crea subito il tuo spazio di lavoro AI

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇