home / mcp / nba player stats mcp server
A Model Context Protocol server for NBA player statistics from basketball-reference.com
Configuration
View docs{
"mcpServers": {
"ziyadmir-nba-player-stats-mcp": {
"command": "python",
"args": [
"src/server.py"
]
}
}
}You can query comprehensive NBA player statistics through this MCP server to get career totals, season-by-season breakdowns, advanced metrics, shooting splits, and even career milestones. It enables deep analytics and head-to-head comparisons using a consistent set of tools designed to answer questions about any NBA player.
Use an MCP client to invoke the available statistical tools. You can request career statistics, season-specific stats, advanced metrics, per-36 minute stats, shooting splits, playoff data, and head-to-head comparisons. You can also drill into game logs, monthly splits, clutch performances, and milestone tracking. For example, you can ask for a player’s career PER_GAME stats, look up a specific season’s shooting splits, compare two players side-by-side, or retrieve a player’s playoff statistics alongside their regular-season stats.
# Prerequisites
# Ensure you have Python 3.8 or higher and pip installed
# Install from PyPI
pip install nba-player-stats-mcp
# Install from source
# 1. Clone the repository or download the source
# 2. Create and activate a virtual environment
python -m venv venv
# On macOS/Linux
source venv/bin/activate
# On Windows
venv\Scripts\activate.bat
# 3. Install in development mode
pip install -e .
# Or with development dependencies
pip install -e .[dev]
# Run the server from PyPI
nba-player-stats-server
# Run the server from source
python src/server.pyConfiguration and usage details are provided here so you can run the MCP server locally and connect your client to it. If you run the server from Python source, you can start it with python src/server.py. If you install from PyPI, you can start the server with the nba-player-stats-server command. You can also configure a client to connect to the server using the standard MCP configuration shape shown in the example configuration.
Example client configuration (stdio) to run the server locally using Python: you can place this in your MCP client settings.
Basic career query: retrieve LeBron James’s career stats using the core tools. Seasonal specific query: fetch Stephen Curry’s 2016 season stats. Player comparison: compare Michael Jordan and LeBron James career stats. Per-36 stats: obtain Giannis Antetokounmpo’s per-36 minute stats. Advanced metrics: request Nikola Jokić’s PER and TS%.
This server includes automatic fixes for compatibility issues with basketball-reference_scraper when basketball-reference.com changes its page structure. The fixes adjust table IDs, handle deprecated pandas usage, and improve missing-data handling to keep stat queries reliable.
Some data may be limited for very old seasons or for certain advanced metrics. Names must match basketball-reference.com formatting exactly for accurate results. If you encounter a “No tables found” error, the issue is typically due to site structure changes and can be resolved by the server’s built-in fixes. If a player isn’t found, use exact full names as listed on basketball-reference.com.
Set up a local development environment to test new tools or changes. Use a Python virtual environment, install dependencies, and run tests as described in the development workflow. When adding new tools, implement the function in the server code, ensure thorough testing across players, and document any new endpoints.
Tools cover a wide range of data queries, including core statistics retrieval, season-focused stats, advanced metrics, shooting splits, playoff data, game logs, specific stat lookups, and various analytics layers. Each tool is designed to answer common questions about player performance across seasons, matchups, and milestones.
Get complete career statistics for an NBA player using core statistics tools.
Get statistics for a specific season, including season and optional playoff data.
Retrieve advanced statistics such as PER, TS%, WS, BPM, and VORP.
Get per-36-minute statistics (pace-adjusted) for a player.
Compare statistics between two players, either career or for a specific season.
Get detailed shooting statistics and splits for a player.
Get total statistics for a season or career (not averages).
Get playoff statistics with regular season comparison.
Retrieve the headshot URL from basketball-reference.com for a player.
Get career highlights and achievements for a player.
Get game-by-game statistics for a specific season, with optional playoffs.
Get a specific statistic for a player in a given season (e.g., 3P% in 2018).
Retrieve career statistics against a specific NBA team.
Get awards and voting history for a player.
Get statistics broken down by month for a season.
Get performance in clutch situations across seasons.
Get playoff statistics for a specific year for a player.
Analyze year-over-year progression and decline in chosen stats.
Query career-high performances and milestone games (40+ points, triple-doubles).
Get home/away, rest days, and win/loss situational splits.
Get quarter-by-quarter performance statistics including 4th quarter and OT.
Track progress toward career milestones with projections.
Retrieve all-time rankings in various stat categories for a player.