An easy-to-use wrapper for nba_api to easily find data for a player, game, team, or season
Project description
NBAStatPy
Overview
A simple, easy-to-use wrapper for the nba_api package to access NBA data for players, games, teams, and seasons.
Quick Start
from nbastatpy.player import Player
# Create a player object
player = Player("Giannis", season="2023", playoffs=True)
# Get data
awards = player.get_awards()
stats = player.get_career_stats()
Main Classes
- Player - Access player stats, career data, and awards
- Game - Get boxscores, play-by-play, and game details
- League - Query league-wide stats, lineups, and tracking data
- Team - Retrieve team rosters, stats, and splits
Standalone Usage
from nbastatpy.standardize import standardize_dataframe
df = standardize_dataframe(df, data_type='player')
MCP Server
NBAStatPy includes a Model Context Protocol (MCP) server that allows AI assistants like Claude to access NBA statistics data.
Quick Start (No Installation Required)
Using uvx, you can run the MCP server directly without installing:
uvx nbastatpy
Adding to Claude Code
Option 1: CLI Command (Recommended)
claude mcp add nbastatpy -- uvx nbastatpy
Option 2: Manual Configuration
Add to your ~/.claude.json (user-level) or .mcp.json (project-level):
{
"mcpServers": {
"nbastatpy": {
"type": "stdio",
"command": "uvx",
"args": ["nbastatpy"]
}
}
}
Option 3: With pip install
{
"mcpServers": {
"nbastatpy": {
"command": "python",
"args": ["-m", "nbastatpy.mcp.server"]
}
}
}
Available Tools
The MCP server provides tools for accessing NBA data:
| Tool | Description |
|---|---|
get_player_salary |
Get player salary data by name |
get_player_game_logs |
Get recent game logs for a player |
get_player_career_stats |
Get season-by-season career statistics |
get_player_play_type_stats |
Get play type (synergy) stats for a player |
get_player_tracking_stats |
Get tracking stats (drives, touches, etc.) |
get_league_leaders |
Get league leaders for any stat category |
get_team_recent_games |
Get recent games for a team |
get_team_play_type_stats |
Get play type stats for a team |
get_team_tracking_stats |
Get tracking stats for a team |
get_recent_games_summary |
Get summary of recent NBA games |
get_recent_games_player_stats |
Get player stats from recent games |
Installation
Pip
pip install nbastatpy
UV
uv add nbastatpy
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nbastatpy-0.4.1.tar.gz.
File metadata
- Download URL: nbastatpy-0.4.1.tar.gz
- Upload date:
- Size: 212.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa42f43e26b8045e465a88b8598a83358168f4a7efcbc1e436c7c3b2597509de
|
|
| MD5 |
4629f71851ec354c474d7934b2d58c0e
|
|
| BLAKE2b-256 |
51597edc42afe5a442e58407bc221fd11ce61eb1ef670d09d64ced928c101c22
|
Provenance
The following attestation bundles were made for nbastatpy-0.4.1.tar.gz:
Publisher:
publish.yml on aberghammer-analytics/NBAStatPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbastatpy-0.4.1.tar.gz -
Subject digest:
aa42f43e26b8045e465a88b8598a83358168f4a7efcbc1e436c7c3b2597509de - Sigstore transparency entry: 840161625
- Sigstore integration time:
-
Permalink:
aberghammer-analytics/NBAStatPy@d44acaec705312fee39b21d7e3c02b1215f4e257 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/aberghammer-analytics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d44acaec705312fee39b21d7e3c02b1215f4e257 -
Trigger Event:
release
-
Statement type:
File details
Details for the file nbastatpy-0.4.1-py3-none-any.whl.
File metadata
- Download URL: nbastatpy-0.4.1-py3-none-any.whl
- Upload date:
- Size: 42.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
996fa9ec90223a143932c4fd971b86f80b9b5137684c19fcd3bfe2e53bb97471
|
|
| MD5 |
e02859491eeb3b4ad1de06d06fb69d6e
|
|
| BLAKE2b-256 |
a805e0a74cf7c6e0cea5c3d3a7c18d3d2052d6c8f63efe4a78369d4230a3dc65
|
Provenance
The following attestation bundles were made for nbastatpy-0.4.1-py3-none-any.whl:
Publisher:
publish.yml on aberghammer-analytics/NBAStatPy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
nbastatpy-0.4.1-py3-none-any.whl -
Subject digest:
996fa9ec90223a143932c4fd971b86f80b9b5137684c19fcd3bfe2e53bb97471 - Sigstore transparency entry: 840161649
- Sigstore integration time:
-
Permalink:
aberghammer-analytics/NBAStatPy@d44acaec705312fee39b21d7e3c02b1215f4e257 -
Branch / Tag:
refs/tags/v0.4.1 - Owner: https://github.com/aberghammer-analytics
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d44acaec705312fee39b21d7e3c02b1215f4e257 -
Trigger Event:
release
-
Statement type: