# MLB Stats Server

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 vi…

## Quick Start

```bash
# Connect this server (installs CLI if needed)
npx -y @smithery/cli@latest mcp add etweisberg/mlb-mcp

# Browse available tools
npx -y @smithery/cli@latest tool list etweisberg/mlb-mcp

# Get full schema for a tool
npx -y @smithery/cli@latest tool get etweisberg/mlb-mcp get_stats

# Call a tool
npx -y @smithery/cli@latest tool call etweisberg/mlb-mcp get_stats '{}'
```

## Direct MCP Connection

Endpoint: `https://mlb-mcp--etweisberg.run.tools`

## Tools (46)

- `get_stats`
- `get_schedule`
- `get_player_stats`
- `get_standings`
- `get_team_leaders`
- `lookup_player` — Get data about players based on first, last, or full name.
- `get_boxscore` — Get a formatted boxscore for a given game.
- `get_team_roster` — Get the roster for a given team.
- `get_game_pace` — Returns data about pace of game for a given season (back to 1999).
- `get_meta` — Get available values from StatsAPI for use in other queries,
- `get_available_endpoints` — Get MLB StatsAPI endpoints directly
- `get_notes` — Get additional notes on an endpoint
- `get_game_scoring_play_data` — Returns a dictionary of scoring plays for a given game containing 3 keys:
- `get_last_game` — Get the gamePk (game_id) for the given team's most recent completed game.
- `get_league_leader_data` — Returns a list of stat leaders overall or for a given league (103=AL, 104=NL).
- `get_linescore` — Get formatted linescore data for a specific MLB game.
- `get_next_game` — Get the game ID for a team's next scheduled game.
- `get_game_highlight_data` — Returns a list of highlight data for a given game.
- `get_statcast_data` — Pulls statcast play-level data from Baseball Savant for a given date range.
- `get_statcast_batter_data`
- `get_statcast_pitcher_data`
- `get_statcast_batter_exitvelo_barrels`
- `get_statcast_pitcher_exitvelo_barrels`
- `get_statcast_batter_expected_stats`
- `get_statcast_pitcher_expected_stats`
- `get_statcast_batter_percentile_ranks`
- `get_statcast_pitcher_percentile_ranks`
- `get_statcast_batter_pitch_arsenal`
- `get_statcast_pitcher_pitch_arsenal`
- `get_statcast_single_game`
- `create_strike_zone_plot`
- `create_spraychart_plot`
- `create_bb_profile_plot` — Plots a given StatCast parameter split by bb_type
- `create_teams_plot` — Plots a scatter plot with each MLB team
- `get_pitching_stats_bref`
- `get_pitching_stats_range`
- `get_pitching_stats`
- `get_playerid_lookup` — Lookup playerIDs (MLB AM, bbref, retrosheet, FG) for a given player
- `reverse_lookup_player` — Retrieve a table of player information given a list of player ids
- `get_schedule_and_record`
- `get_player_splits`
- `get_pybaseball_standings`
- `get_team_batting`
- `get_team_fielding`
- `get_team_pitching`
- `get_top_prospects`

```bash
# Get full input/output schema for a tool
npx -y @smithery/cli@latest tool get etweisberg/mlb-mcp <tool-name>
```

## Prompts (9)

- `cd_game_recap` (date, team1, team2)
- `cd_player_report` (player_name, season)
- `cd_statistical_deep_dive` (stat_category, season, min_qualifier)
- `cd_team_comparison` (team1, team2, focus_area)
- `web_ui_game_analysis_plots` (date, team1, team2)
- `web_ui_player_plots` (player_name, season)
- `web_ui_season_trends_plots` (focus_area, season)
- `web_ui_statistical_analysis_plots` (stat_category, season, min_qualifier)
- `web_ui_team_comparison_plots` (team1, team2, focus_area)

---

Source: https://github.com/etweisberg/mlb-mcp
