Repository avatar
Monitoring
v1.1.0
active

mcp

io.balldontlie/mcp

Provides access to live sports data and analytics from BALLDONTLIE: The Sports API

Documentation

BALLDONTLIE Sports MCP Server

A Model Context Protocol (MCP) server that provides access to comprehensive sports data from the BALLDONTLIE API, including NBA, WNBA, NFL, MLB, EPL, NHL, and NCAAF statistics, player information, game data, and more.

Features

  • 99 Sports Endpoints: Complete access to all BALLDONTLIE API endpoints
  • 7 Major Sports: NBA, WNBA, NFL, MLB, EPL, NHL, NCAAF
  • Comprehensive Data: Teams, players, games, statistics, standings, injuries, and advanced analytics
  • Authentication: Seamless API key forwarding to backend
  • Pagination: Full support for cursor-based pagination
  • Error Handling: Proper error forwarding and handling
  • TypeScript: Full type safety and IntelliSense support

Installation

npm install @balldontlie/mcp-server

Quick Start

1. Get API Key

Sign up at BALLDONTLIE to get your free API key.

2. Configure MCP Client

Option A: Use Hosted Remote Server (Recommended)

Add to your MCP client configuration (e.g., Claude Desktop) to use the hosted server:

{
  "mcpServers": {
    "balldontlie-api": {
      "url": "https://mcp.balldontlie.io/mcp",
      "transport": "http",
      "headers": {
        "Authorization": "<YOUR_BALLDONTLIE_API_KEY>"
      }
    }
  }
}

Replace <YOUR_BALLDONTLIE_API_KEY> with your actual API key from BALLDONTLIE.

Option B: Run from Source

Clone and run from source code:

git clone https://github.com/balldontlie-api/mcp-server.git
cd mcp-server
npm install
npm run build
npm start

Configure your MCP client to connect to the local server:

{
  "mcpServers": {
    "balldontlie-api": {
      "url": "http://localhost:3000/mcp",
      "transport": "http",
      "headers": {
        "Authorization": "<YOUR_BALLDONTLIE_API_KEY>"
      }
    }
  }
}

3. Use in Your MCP Client

The server will automatically provide all available tools. You can ask your AI assistant things like:

  • "Get the current NBA standings"
  • "Show me LeBron James' season stats"
  • "What are today's NFL games?"
  • "Get Manchester United's recent EPL matches"
  • "Show me A'ja Wilson's WNBA season stats"
  • "What are the current WNBA standings?"

Environment Variables

VariableDefaultDescription
PORT3000Server port when running locally
BACKEND_API_URLhttps://api.balldontlie.ioBALLDONTLIE API base URL
API_TIMEOUT30000Request timeout in milliseconds
LOG_LEVELinfoLogging level (error, warn, info, debug)
NODE_ENVdevelopmentEnvironment (development, production, test)
ENABLE_DEBUGfalseEnable debug logging
ENABLE_TRACINGfalseEnable DataDog APM tracing (requires DD_AGENT_HOST)
DD_AGENT_HOST-DataDog agent hostname for APM tracing
DD_PROFILING_ENABLEDfalseEnable DataDog profiling
SERVICE_VERSION1.0.0Service version for tracing

Available Tools

NBA (15 tools)

ToolDescriptionParameters
nba_get_teamsGet all NBA teamsdivision, conference
nba_get_team_by_idGet specific NBA teamid (required)
nba_get_playersGet NBA players with filterssearch, first_name, last_name, team_ids, player_ids, pagination
nba_get_player_by_idGet specific NBA playerid (required)
nba_get_active_playersGet active NBA playersSame as nba_get_players
nba_get_gamesGet NBA gamesdates, seasons, team_ids, postseason, start_date, end_date, pagination
nba_get_game_by_idGet specific NBA gameid (required)
nba_get_statsGet NBA statisticsdates, seasons, team_ids, player_ids, game_ids, postseason, pagination
nba_get_season_averagesGet season averagesseason (required), category (required), type (required), player_ids, season_type
nba_get_advanced_statsGet advanced statisticsSame as nba_get_stats
nba_get_box_scoresGet box scoresdates, seasons, team_ids, game_ids, postseason, pagination
nba_get_live_box_scoresGet live box scoresSame as nba_get_box_scores
nba_get_standingsGet team standingsseason, conference, division
nba_get_leadersGet statistical leadersseason, stat_type, per_page
nba_get_player_injuriesGet player injuriesplayer_ids, team_ids, pagination

NFL (14 tools)

ToolDescriptionParameters
nfl_get_teamsGet all NFL teamsdivision, conference
nfl_get_team_by_idGet specific NFL teamid (required)
nfl_get_playersGet NFL playerssearch, first_name, last_name, team_ids, player_ids, position, pagination
nfl_get_player_by_idGet specific NFL playerid (required)
nfl_get_active_playersGet active NFL playersSame as nfl_get_players
nfl_get_gamesGet NFL gamesdates, seasons, team_ids, weeks, postseason, start_date, end_date, pagination
nfl_get_game_by_idGet specific NFL gameid (required)
nfl_get_statsGet NFL statisticsdates, seasons, team_ids, player_ids, game_ids, weeks, postseason, pagination
nfl_get_season_statsGet season statisticsseason, player_ids, team_ids, postseason, pagination
nfl_get_standingsGet team standingsseason, conference, division
nfl_get_player_injuriesGet player injuriesplayer_ids, team_ids, pagination
nfl_get_advanced_rushing_statsGet advanced rushing statsseason, week, player_ids, team_ids, position, pagination
nfl_get_advanced_passing_statsGet advanced passing statsSame as rushing
nfl_get_advanced_receiving_statsGet advanced receiving statsSame as rushing

MLB (12 tools)

ToolDescriptionParameters
mlb_get_teamsGet all MLB teamsdivision, league
mlb_get_team_by_idGet specific MLB teamid (required)
mlb_get_playersGet MLB playerssearch, first_name, last_name, team_ids, player_ids, position, active, pagination
mlb_get_player_by_idGet specific MLB playerid (required)
mlb_get_active_playersGet active MLB playersSame as mlb_get_players
mlb_get_gamesGet MLB gamesdates, seasons, team_ids, postseason, start_date, end_date, pagination
mlb_get_game_by_idGet specific MLB gameid (required)
mlb_get_statsGet MLB statisticsdates, seasons, team_ids, player_ids, game_ids, postseason, pagination
mlb_get_season_statsGet season statisticsseason, player_ids, team_ids, postseason, pagination
mlb_get_team_season_statsGet team season statsseason, team_ids, postseason, pagination
mlb_get_standingsGet team standingsseason, league, division
mlb_get_player_injuriesGet player injuriesplayer_ids, team_ids, pagination

EPL (16 tools)

ToolDescriptionParameters
epl_get_teamsGet all EPL teamspagination
epl_get_team_by_idGet specific EPL teamid (required)
epl_get_team_playersGet team playersid (required), pagination
epl_get_team_season_statsGet team season statsid (required), season, stat_types
epl_get_team_stats_leadersGet team stat leadersseason, stat_type, per_page
epl_get_standingsGet EPL standingsseason
epl_get_playersGet EPL playerssearch, team_ids, player_ids, position, pagination
epl_get_player_by_idGet specific EPL playerid (required)
epl_get_player_season_statsGet player season statsid (required), season, stat_types
epl_get_player_stats_leadersGet player stat leadersseason, stat_type, per_page
epl_get_gamesGet EPL gamesdates, seasons, team_ids, weeks, start_date, end_date, pagination
epl_get_game_by_idGet specific EPL gameid (required)
epl_get_game_lineupsGet game lineupsid (required)
epl_get_game_goalsGet game goalsid (required)
epl_get_game_team_statsGet game team statsid (required)
epl_get_game_player_statsGet game player statsid (required)

NHL (12 tools)

ToolDescriptionParameters
nhl_get_teamsGet all NHL teamsconference, division, pagination
nhl_get_team_by_idGet specific NHL teamid (required)
nhl_get_team_season_statsGet team season statsid (required), season
nhl_get_team_stats_leadersGet team stat leadersseason, stat_type, per_page
nhl_get_playersGet NHL playerssearch, team_ids, player_ids, position, pagination
nhl_get_player_by_idGet specific NHL playerid (required)
nhl_get_player_season_statsGet player season statsid (required), season
nhl_get_player_stats_leadersGet player stat leadersseason, stat_type, per_page
nhl_get_gamesGet NHL gamesdates, seasons, team_ids, season_type, start_date, end_date, pagination
nhl_get_game_by_idGet specific NHL gameid (required)
nhl_get_standingsGet NHL standingsseason, conference, division
nhl_get_box_scoresGet NHL box scoresdates, seasons, team_ids, game_ids, season_type, pagination

WNBA (14 tools)

ToolDescriptionParameters
wnba_get_teamsGet all WNBA teamsconference
wnba_get_team_by_idGet specific WNBA teamid (required)
wnba_get_playersGet WNBA playerssearch, first_name, last_name, team_ids, player_ids, pagination
wnba_get_player_by_idGet specific WNBA playerid (required)
wnba_get_active_playersGet active WNBA playersSame as wnba_get_players
wnba_get_gamesGet WNBA gamesdates, seasons, team_ids, season_type, start_date, end_date, pagination
wnba_get_game_by_idGet specific WNBA gameid (required)
wnba_get_player_statsGet player game statisticsgame_ids, dates, seasons, player_ids, team_ids, pagination
wnba_get_team_statsGet team game statisticsgame_ids, dates, seasons, team_ids, pagination
wnba_get_player_season_statsGet player season statsplayer_ids, team_ids, season, season_type, pagination
wnba_get_team_season_statsGet team season statsteam_ids, season, season_type, pagination
wnba_get_standingsGet WNBA standingsseason, conference
wnba_get_player_injuriesGet player injuriesplayer_ids, team_ids, pagination
wnba_get_playsGet play-by-play datagame_id (required)

NCAAF (16 tools)

ToolDescriptionParameters
ncaaf_get_conferencesGet all NCAAF conferences-
ncaaf_get_conference_by_idGet specific NCAAF conferenceid (required)
ncaaf_get_teamsGet all NCAAF teamsconference, pagination
ncaaf_get_team_by_idGet specific NCAAF teamid (required)
ncaaf_get_playersGet NCAAF playerssearch, first_name, last_name, team_ids, player_ids, position, pagination
ncaaf_get_active_playersGet active NCAAF playersSame as ncaaf_get_players
ncaaf_get_player_by_idGet specific NCAAF playerid (required)
ncaaf_get_standingsGet NCAAF standingsseason, conference_id, pagination
ncaaf_get_gamesGet NCAAF gamesdates, seasons, team_ids, weeks, start_date, end_date, pagination
ncaaf_get_game_by_idGet specific NCAAF gameid (required)
ncaaf_get_rankingsGet NCAAF rankingsseason, week, pagination
ncaaf_get_playsGet play-by-play datagame_id (required)
ncaaf_get_player_statsGet player game statisticsgame_ids, dates, seasons, player_ids, team_ids, weeks, pagination
ncaaf_get_team_statsGet team game statisticsgame_ids, dates, seasons, team_ids, weeks, pagination
ncaaf_get_player_season_statsGet player season statsseason (required), player_ids, team_ids, pagination
ncaaf_get_team_season_statsGet team season statsseason (required), team_ids, pagination

Authentication

The server forwards Authorization headers to the BALLDONTLIE API. Your MCP client should include the API key in requests:

Authorization: YOUR_API_KEY

Error Handling

The server provides detailed error information:

  • Authentication Errors (401): Missing or invalid API key
  • Authorization Errors (403): Insufficient tier access
  • Validation Errors (400): Invalid parameters
  • Rate Limiting (429): Request rate exceeded
  • Server Errors (5xx): Backend API issues

Development

# Clone and install
git clone <repository>
cd mcp-server
npm install

# Build
npm run build

# Run in development
npm run dev

# Clean build
npm run clean

API Tiers

BALLDONTLIE offers different tiers with varying access levels:

  • Free: Basic endpoints (teams, players, games)
  • ALL-STAR ($9.99/mo): Includes stats, injuries, standings
  • GOAT ($39.99/mo): Full access including advanced stats, box scores, betting odds

Support

License

MIT