Hosted MCP server · #112 most used on Smithery

MLB Stats Server

etweisberg/mlb-mcp

Provide structured access to Major League Baseball statistics through an MCP server. Query and retrieve detailed baseball data including statcast, fangraphs, and baseball reference stats. Generate visualizations and integrate seamlessly with MCP-compatible clients for enhanced baseball analytics.

Uses
5.0k
Tools
46
Runs
Hosted
Prompts
9
Listed
1.4y ago

Get started

Add it to your agent

npx -y @smithery/cli@latest install etweisberg/mlb-mcp --client claude

Swap --client claude for cursor, vscode, windsurf or another client. The CLI asks for any required settings.

What it can do

46 tools

get_stats2 params
ParameterTypeDescription
paramsobject
endpointstring
get_schedule9 params Get list of games for a given date/range and/or team/opponent.
ParameterTypeDescription
date
season
game_id
team_id
end_date
sport_idinteger
start_date
opponent_id
include_series_statusboolean
get_player_stats4 params Returns a list of current season or career stat data for a given player.
ParameterTypeDescription
groupstring
statsstring
season
player_idinteger
get_standings4 params Returns a dict of standings data for a given league/division and season.
ParameterTypeDescription
season
league_id
division_id
standings_typesstring
get_team_leaders5 params Returns a python list of stat leader data for a given team
ParameterTypeDescription
limit
season
team_idinteger
leader_categorystring
leader_game_typestring
lookup_player1 paramGet data about players based on first, last, or full name.
ParameterTypeDescription
namestring
get_boxscore2 paramsGet a formatted boxscore for a given game.
ParameterTypeDescription
game_idinteger
timecode
get_team_roster4 paramsGet the roster for a given team.
ParameterTypeDescription
date
seasoninteger
team_idinteger
roster_typestring
get_game_pace1 paramReturns data about pace of game for a given season (back to 1999).
ParameterTypeDescription
season
get_meta2 paramsGet available values from StatsAPI for use in other queries, or look up descriptions for values found in API results. For example, to get…

Get available values from StatsAPI for use in other queries, or look up descriptions for values found in API results. For example, to get a list of leader categories to use when calling team_leaders(): statsapi.meta('leagueLeaderTypes')

ParameterTypeDescription
fields
type_namestring
get_available_endpointsGet MLB StatsAPI endpoints directly
get_notes1 paramGet additional notes on an endpoint
ParameterTypeDescription
endpointstring
get_game_scoring_play_data1 paramReturns a dictionary of scoring plays for a given game containing 3 keys: * home - home team data * away - away team data * plays - sorte…

Returns a dictionary of scoring plays for a given game containing 3 keys: * home - home team data * away - away team data * plays - sorted list of scoring play data

ParameterTypeDescription
game_idinteger
get_last_game1 paramGet the gamePk (game_id) for the given team's most recent completed game.
ParameterTypeDescription
team_idinteger
get_league_leader_data6 paramsReturns a list of stat leaders overall or for a given league (103=AL, 104=NL).
ParameterTypeDescription
limit
season
league_id
game_types
stat_group
leader_categoriesstring
get_linescore1 paramGet formatted linescore data for a specific MLB game.
ParameterTypeDescription
game_idinteger
get_next_game1 paramGet the game ID for a team's next scheduled game.
ParameterTypeDescription
team_idinteger
get_game_highlight_data1 paramReturns a list of highlight data for a given game.
ParameterTypeDescription
game_idinteger
get_statcast_data7 paramsPulls statcast play-level data from Baseball Savant for a given date range. INPUTS: start_dt: YYYY-MM-DD : the first date for which you w…

Pulls statcast play-level data from Baseball Savant for a given date range. INPUTS: start_dt: YYYY-MM-DD : the first date for which you want statcast data end_dt: YYYY-MM-DD : the last date for which you want statcast data team: optional (defaults to None) : city abbreviation of the team you want data for (e.g. SEA or BOS) verbose: bool (defaults to True) : whether to print updates on query progress parallel: bool (defaults to True) : whether to parallelize HTTP requests in large queries start_r

ParameterTypeDescription
team
end_dt
end_row
verboseboolean
parallelboolean
start_dt
start_row
get_statcast_batter_data5 params Pulls statcast pitch-level data from Baseball Savant for a given batter. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you …

Pulls statcast pitch-level data from Baseball Savant for a given batter. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data player_id : INT : the player's MLBAM ID. Find this by via the get_playerid_lookup tool, finding the correct player, and selecting their key_mlbam. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row: option

ParameterTypeDescription
end_dt
end_row
start_dt
player_idinteger
start_row
get_statcast_pitcher_data5 params Pulls statcast pitch-level data from Baseball Savant for a given pitcher. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you…

Pulls statcast pitch-level data from Baseball Savant for a given pitcher. ARGUMENTS start_dt : YYYY-MM-DD : the first date for which you want a player's statcast data end_dt : YYYY-MM-DD : the final date for which you want data player_id : INT : the player's MLBAM ID. Find this by calling pthe get_playerid_lookup tool, finding the correct player, and selecting their key_mlbam. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row:

ParameterTypeDescription
end_dt
end_row
start_dt
player_idinteger
start_row
get_statcast_batter_exitvelo_barrels4 params Retrieves batted ball data for all batters in a given year. ARGUMENTS year: The year for which you wish to retrieve batted ball data. Fo…

Retrieves batted ball data for all batters in a given year. ARGUMENTS year: The year for which you wish to retrieve batted ball data. Format: YYYY. minBBE: The minimum number of batted ball events for each player. If a player falls below this threshold, they will be excluded from the results. If no value is specified, only qualified batters will be returned. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row: optional (defaults

ParameterTypeDescription
yearinteger
minBBE
end_row
start_row
get_statcast_pitcher_exitvelo_barrels4 params Retrieves batted ball against data for all qualified pitchers in a given year. ARGUMENTS year: The year for which you wish to retrieve b…

Retrieves batted ball against data for all qualified pitchers in a given year. ARGUMENTS year: The year for which you wish to retrieve batted ball against data. Format: YYYY. minBBE: The minimum number of batted ball against events for each pitcher. If a player falls below this threshold, they will be excluded from the results. If no value is specified, only qualified pitchers will be returned. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, in

ParameterTypeDescription
yearinteger
minBBE
end_row
start_row
get_statcast_batter_expected_stats4 params Retrieves expected stats based on quality of batted ball contact in a given year. ARGUMENTS year: The year for which you wish to retriev…

Retrieves expected stats based on quality of batted ball contact in a given year. ARGUMENTS year: The year for which you wish to retrieve expected stats data. Format: YYYY. minPA: The minimum number of plate appearances for each player. If a player falls below this threshold, they will be excluded from the results. If no value is specified, only qualified batters will be returned. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_r

ParameterTypeDescription
yearinteger
minPA
end_row
start_row
get_statcast_pitcher_expected_stats4 params Retrieves expected stats based on quality of batted ball contact against in a given year. ARGUMENTS year: The year for which you wish to…

Retrieves expected stats based on quality of batted ball contact against in a given year. ARGUMENTS year: The year for which you wish to retrieve expected stats data. Format: YYYY. minPA: The minimum number of plate appearances against for each pitcher. If a player falls below this threshold, they will be excluded from the results. If no value is specified, only qualified pitchers will be returned. start_row: optional (defaults to None) : starting row index for truncating large results (0-based

ParameterTypeDescription
yearinteger
minPA
end_row
start_row
get_statcast_batter_percentile_ranks3 params Retrieves percentile ranks for batters in a given year. ARGUMENTS year: The year for which you wish to retrieve percentile data. Format:…

Retrieves percentile ranks for batters in a given year. ARGUMENTS year: The year for which you wish to retrieve percentile data. Format: YYYY. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row: optional (defaults to None) : ending row index for truncating large results (0-based, exclusive) Use start_row and end_row to limit response size when dealing with large datasets.

ParameterTypeDescription
yearinteger
end_row
start_row
get_statcast_pitcher_percentile_ranks3 params Retrieves percentile ranks for each player in a given year, including batters with 2.1 PA per team game and 1.25 for pitchers. It includ…

Retrieves percentile ranks for each player in a given year, including batters with 2.1 PA per team game and 1.25 for pitchers. It includes percentiles on expected stats, batted ball data, and spin rates, among others. ARGUMENTS year: The year for which you wish to retrieve percentile data. Format: YYYY. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row: optional (defaults to None) : ending row index for truncating large results

ParameterTypeDescription
yearinteger
end_row
start_row
get_statcast_batter_pitch_arsenal4 params Retrieves outcome data for batters split by the pitch type in a given year. ARGUMENTS year: The year for which you wish to retrieve pitc…

Retrieves outcome data for batters split by the pitch type in a given year. ARGUMENTS year: The year for which you wish to retrieve pitch arsenal data. Format: YYYY. minPA: The minimum number of plate appearances for each player. If a player falls below this threshold, they will be excluded from the results. If no value is specified, the default number of plate appearances is 25. start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_ro

ParameterTypeDescription
yearinteger
minPAinteger
end_row
start_row
get_statcast_pitcher_pitch_arsenal5 params Retrieves high level stats on each pitcher's arsenal in a given year. ARGUMENTS year: The year for which you wish to retrieve expected s…

Retrieves high level stats on each pitcher's arsenal in a given year. ARGUMENTS year: The year for which you wish to retrieve expected stats data. Format: YYYY. minP: The minimum number of pitches thrown. If a player falls below this threshold, they will be excluded from the results. If no value is specified, only qualified pitchers will be returned. arsenal_type: The type of stat to retrieve for the pitchers' arsenals. Options include ["average_speed", "n_", "average_spin"], where "n_" corresp

ParameterTypeDescription
minP
yearinteger
end_row
start_row
arsenal_typestring
get_statcast_single_game3 params Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data) INPUTS: …

Pulls statcast play-level data from Baseball Savant for a single game, identified by its MLB game ID (game_pk in statcast data) INPUTS: game_pk : 6-digit integer MLB game ID to retrieve start_row: optional (defaults to None) : starting row index for truncating large results (0-based, inclusive) end_row: optional (defaults to None) : ending row index for truncating large results (0-based, exclusive) Use start_row and end_row to limit response size when dealing with large datasets.

ParameterTypeDescription
end_row
game_pkinteger
start_row
create_strike_zone_plot5 params Produces a pitches overlaid on a strike zone using StatCast data Args: data: (pandas.DataFrame) StatCast pandas.DataFrame of StatCast pi…

Produces a pitches overlaid on a strike zone using StatCast data Args: data: (pandas.DataFrame) StatCast pandas.DataFrame of StatCast pitcher data title: (str), default = '' Optional: Title of plot colorby: (str), default = 'pitch_type' Optional: Which category to color the mark with. 'pitch_type', 'pitcher', 'description' or a column within data legend_title: (str), default = based on colorby Optional: Title for the legend annotation: (str), default = 'pitch_type' Optional: What to annotate in

ParameterTypeDescription
dataobject
titlestring
colorbystring
annotationstring
legend_titlestring
create_spraychart_plot8 params Produces a spraychart using statcast data overlayed on specified stadium Args: data: (pandas.DataFrame) StatCast pandas.DataFrame of Sta…

Produces a spraychart using statcast data overlayed on specified stadium Args: data: (pandas.DataFrame) StatCast pandas.DataFrame of StatCast batter data team_stadium: (str) Team whose stadium the hits will be overlaid on title: (str), default = '' Optional: Title of plot size: (int), default = 100 Optional: Size of hit circles on plot colorby: (str), default = 'events' Optional: Which category to color the mark with. 'events','player', or a column within data legend_title: (str), default = bas

ParameterTypeDescription
dataobject
sizeinteger
titlestring
widthinteger
heightinteger
colorbystring
legend_titlestring
team_stadiumstring
create_bb_profile_plot2 paramsPlots a given StatCast parameter split by bb_type Args: df: (pandas.DataFrame) pandas.DataFrame of StatCast batter data (retrieved throug…

Plots a given StatCast parameter split by bb_type Args: df: (pandas.DataFrame) pandas.DataFrame of StatCast batter data (retrieved through statcast, statcast_batter, etc) parameter: (str), default = 'launch_angle' Optional: Parameter to plot

ParameterTypeDescription
dataobject
parameterstring
create_teams_plot4 paramsPlots a scatter plot with each MLB team Args: data: (pandas.DataFrame) pandas.DataFrame of Fangraphs team data (retrieved through team_ba…

Plots a scatter plot with each MLB team Args: data: (pandas.DataFrame) pandas.DataFrame of Fangraphs team data (retrieved through team_batting or team_pitching) x_axis: (str) Stat name to be plotted as the x_axis of the chart y_axis: (str) Stat name to be plotted as the y_axis of the chart title: (str), default = None Optional: Title of the plot

ParameterTypeDescription
dataobject
title
x_axisstring
y_axisstring
get_pitching_stats_bref1 param Get all pitching stats for a set season. If no argument is supplied, gives stats for current season to date.
ParameterTypeDescription
season
get_pitching_stats_range2 params Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end dat…

Get all pitching stats for a set time range. This can be the past week, the month of August, anything. Just supply the start and end date in YYYY-MM-DD format.

ParameterTypeDescription
end_dt
start_dtstring
get_pitching_stats5 params Get season-level pitching data from FanGraphs. Args: start_season: First season to retrieve data from end_season: Final season to retrie…

Get season-level pitching data from FanGraphs. Args: start_season: First season to retrieve data from end_season: Final season to retrieve data from. If None, returns only start_season. league: Either "all", "nl", "al", or "mnl" qual: Minimum number of plate appearances to be included ind: 1 for individual season level, 0 for aggregate data Returns: Dictionary containing pitching stats from FanGraphs

ParameterTypeDescription
indinteger
qual
leaguestring
end_season
start_seasoninteger
get_playerid_lookup3 paramsLookup playerIDs (MLB AM, bbref, retrosheet, FG) for a given player Args: last (str, required): Player's last name. first (str, optional)…

Lookup playerIDs (MLB AM, bbref, retrosheet, FG) for a given player Args: last (str, required): Player's last name. first (str, optional): Player's first name. Defaults to None. fuzzy (bool, optional): In case of typos, returns players with names close to input. Defaults to False. Returns: pd.DataFrame: DataFrame of playerIDs, name, years played

ParameterTypeDescription
laststring
first
fuzzyboolean
reverse_lookup_player2 paramsRetrieve a table of player information given a list of player ids :param player_ids: list of player ids :type player_ids: list :param key…

Retrieve a table of player information given a list of player ids :param player_ids: list of player ids :type player_ids: list :param key_type: name of the key type being looked up (one of "mlbam", "retro", "bbref", or "fangraphs") :type key_type: str :rtype: :class:`pandas.core.frame.DataFrame`

ParameterTypeDescription
key_typestring
player_idsarray
get_schedule_and_record2 params Retrieve a team's game-level results for a given season, including win/loss/tie result, score, attendance, and winning/losing/saving pit…

Retrieve a team's game-level results for a given season, including win/loss/tie result, score, attendance, and winning/losing/saving pitcher. If the season is incomplete, it will provide scheduling information for future games. ARGUMENTS season: Integer. The season for which you want a team's record data. team: String. The abbreviation of the team for which you are requesting data (e.g. "PHI", "BOS", "LAD").

ParameterTypeDescription
teamstring
seasoninteger
get_player_splits4 params Returns a dataframe of all split stats for a given player. If player_info is True, this will also return a dictionary that includes play…

Returns a dataframe of all split stats for a given player. If player_info is True, this will also return a dictionary that includes player position, handedness, height, weight, position, and team

ParameterTypeDescription
year
playeridstring
player_infoboolean
pitching_splitsboolean
get_pybaseball_standings1 param Returns a pandas DataFrame of the standings for a given MLB season, or the most recent standings if the date is not specified. ARGUMENTS…

Returns a pandas DataFrame of the standings for a given MLB season, or the most recent standings if the date is not specified. ARGUMENTS season (int): the year of the season

ParameterTypeDescription
season
get_team_batting4 params Get season-level Batting Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY…

Get season-level Batting Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for

ParameterTypeDescription
indinteger
leaguestring
end_season
start_seasoninteger
get_team_fielding4 params Get season-level Fielding Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e., 'N…

Get season-level Fielding Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e., 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for

ParameterTypeDescription
indinteger
leaguestring
end_season
start_seasoninteger
get_team_pitching4 params Get season-level Pitching Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NY…

Get season-level Pitching Statistics for Specific Team (from Baseball-Reference) ARGUMENTS: team : str : The Team Abbreviation (i.e. 'NYY' for Yankees) of the Team you want data for start_season : int : first season you want data for (or the only season if you do not specify an end_season) end_season : int : final season you want data for

ParameterTypeDescription
indinteger
leaguestring
end_season
start_seasoninteger
get_top_prospects2 params Retrieves the top prospects by team or leaguewide. It can return top prospect pitchers, batters, or both. ARGUMENTS team: The team name …

Retrieves the top prospects by team or leaguewide. It can return top prospect pitchers, batters, or both. ARGUMENTS team: The team name for which you wish to retrieve top prospects. If not specified, the function will return leaguewide top prospects. playerType: Either "pitchers" or "batters". If not specified, the function will return top prospects for both pitchers and batters.

ParameterTypeDescription
team
player_type

Ready-made

Prompts

  • cd_game_recap Generate a comprehensive game recap scouting report as an artifact for Claude Desktop. Args: date: Game date in YYYY-MM-DD format team1: First team abbreviation (e.g., "NYY",
  • cd_player_report Generate a comprehensive player scouting report as an artifact for Claude Desktop. Args: player_name: Full name or partial name of the player season: Season year (defaults to
  • cd_statistical_deep_dive Generate an in-depth statistical analysis report as an artifact for Claude Desktop. Args: stat_category: Statistical category to analyze (e.g., "home_runs", "era", "steals")
  • cd_team_comparison Generate a comprehensive team comparison report as an artifact for Claude Desktop. Args: team1: First team abbreviation (e.g., "NYY", "BOS") team2: Second team abbreviation
  • web_ui_game_analysis_plots Generate structured plot data for game analysis in Web UI format. Args: date: Game date in YYYY-MM-DD format team1: First team abbreviation (e.g., "NYY", "BOS") team2
  • web_ui_player_plots Generate structured plot data for player analysis in Web UI format. Args: player_name: Full name or partial name of the player season: Season year (defaults to current season
  • web_ui_season_trends_plots Generate structured plot data for season trend analysis in Web UI format. Args: focus_area: Area to analyze ("league", "team_rankings", "individual_leaders") season: Season t
  • web_ui_statistical_analysis_plots Generate structured plot data for statistical analysis in Web UI format. Args: stat_category: Statistical category to analyze (e.g., "home_runs", "era", "steals") season: Sea
  • web_ui_team_comparison_plots Generate structured plot data for team comparison in Web UI format. Args: team1: First team abbreviation (e.g., "NYY", "BOS") team2: Second team abbreviation focus_ar