Logo de Statcast MCP Server

Statcast MCP Server

Comunidade
alex-rimerman

This repository is public, allowing users to pull down the Developing Baseball's Statcast MCP.

Publicado poralex-rimerman
Repositóriostatcast-mcp
IdiomaPython
Forks
2
Estrelas
36
Ferramentas disponíveis
0
Tipo de transportestdio
Categorias
Links
  • Conecte ferramentas a fluxos de trabalho de IA

    Statcast MCP Server disponibiliza recursos MCP que podem ser usados por clientes e agentes de IA compatíveis.

  • Ferramentas disponíveis: 0

    Confira abaixo as ações que o cliente MCP pode executar, com nomes e descrições quando fornecidos pelo servidor.

  • Configuração pronta para copiar

    Use os exemplos de instalação para configurar este servidor no seu cliente MCP preferido.

  • Indicadores da comunidade de código aberto

    Estrelas: 36 e forks: 2 no repositório vinculado.

Statcast MCP Server

A MCP (Model Context Protocol) server that lets you query MLB Statcast data using plain English. Ask your AI assistant about players, games, stats, leaderboards, and more — no coding required.

Built on pybaseball, this server gives AI assistants direct access to data from Baseball Savant, FanGraphs, and Baseball Reference.

What Can You Ask?

Once connected, just talk to your AI assistant naturally:

  • "How did Aaron Judge hit in July 2024?"
  • "Show me Gerrit Cole's pitch arsenal this season"
  • "Who had the highest exit velocity in 2024?"
  • "What were the NL standings at the end of 2023?"
  • "Find me the most undervalued hitters — compare xBA to actual BA"
  • "Expected stats for the whole Yankees lineup and their five starters" (use expected_stats_batch with comma-separated names)
  • "Who are the fastest players in baseball right now?"
  • "Show me every pitch from the Yankees-Red Sox game on July 4, 2024"

The AI translates your questions into the right data queries automatically.

Example: Prompt & Response

Here's what a typical exchange looks like when you use the Statcast MCP:

Prompt

"What were Gerrit Cole's arsenal statistics in 2023?"

Response

Pitch TypeUsagePitchesPABASLGWhiff%K%Run Val/100
4-Seam Fastball52.9%1,737427.202.33323.0%28.3%+1.7
Slider20.8%683175.186.25132.7%29.1%+1.4
Curveball12.1%39697.215.26924.4%27.8%+1.4
Cutter7.0%23165.262.37731.1%23.1%+1.6
Changeup7.1%23354.235.51028.6%13.0%−1.3

His 4-seam fastball was his primary weapon (52.9% usage) with a .202 BA against and +1.7 run value per 100 pitches. The changeup was his only negative pitch (−1.3 run value).


Another prompt

"Who had the highest exit velocity in 2024?"

Response

The AI calls statcast_batter_exitvelo_barrels(year=2024) and returns the leaderboard — Aaron Judge led with a 97.0 mph average exit velocity and 21.8% barrel rate, followed by [other top hitters]...


Available Tools

ToolWhat It Does
player_lookupFind any player's ID, years active, and database links (default 10 rows; up to 5000 if many fuzzy matches)
statcast_searchPitch-by-pitch data for a date range (optionally filtered by team); default 100 pitch rows, up to 5000
statcast_batterEvery pitch a specific batter saw in a date range (default 100 rows, up to 5000)
statcast_batter_pitch_arsenalBatting stats by pitch type (BA, SLG, wOBA vs fastballs, sliders, etc.)
statcast_pitcherEvery pitch a specific pitcher threw in a date range (default 100 rows, up to 5000)
season_batting_statsFull-season batting from FanGraphs (AVG, OPS, WAR, wRC+, …). max_output_rows (default 50, max 5000), optional sort_by / sort_descending for leaderboards. If FG fails, single-season queries fall back to Baseball Reference.
season_pitching_statsFull-season pitching stats from FanGraphs (ERA, FIP, K/9, WAR, …); default 50 rows, up to 5000 via max_output_rows
team_season_batting_statsTeam batting — full roster actual stats (FG, or BRef fallback); default 200 rows, up to 5000
team_season_pitching_statsTeam pitching — rotation + bullpen actual stats (FG, or BRef fallback); default 200 rows, up to 5000
statcast_batter_expected_statsxBA, xSLG, xwOBA leaderboard — who deserves better stats?
statcast_pitcher_expected_statsExpected stats allowed by pitchers
expected_stats_batchExpected stats for many batters and/or pitchers in one call (lineups, rotations)
statcast_batter_exitvelo_barrelsExit velocity and barrel rate leaders
statcast_pitcher_exitvelo_barrelsExit velocity and barrel rate allowed by pitchers
statcast_pitcher_pitch_arsenalPitch mix breakdown (% fastball, slider, curve, etc.)
statcast_pitcher_arsenal_statsPerformance stats per pitch type (whiff rate, BA against, etc.)
sprint_speed_leaderboardFastest players in baseball by sprint speed
team_standingsDivision standings for any season (15 teams per division table by default; adjustable via max_output_rows, max 5000 per division)
batter_percentile_ranksStatcast percentile ranks for hitters (exit velo, barrel%, xwOBA, etc.)
pitcher_percentile_ranksStatcast percentile ranks for pitchers (stuff, spin, whiff%, etc.)
outs_above_averageDefensive OAA leaderboard by position (SS, CF, ALL, etc.)
outfield_directional_oaaOutfield OAA by direction (back/in, L/R)
batting_stats_date_rangeBatting stats over any date range (Baseball Reference)
pitching_stats_date_rangePitching stats over any date range (Baseball Reference)

46 tools total. Most tables support optional max_output_rows (per-tool defaults: 10 / 50 / 100 / 200 / 250 — see REFERENCE.md); values are clamped to 5000 max. Core table above; extended tools add schedules, splits, Lahman history, draft/prospects, WAR files, extra Statcast defense/movement, league team totals, single-game pitch logs, and batter–pitcher matchup summaries. Call statcast_tool_directory for the full list, or see TOOLS_SUMMARY.md and REFERENCE.md.

Extended tools (high level)

ToolWhat it does
statcast_tool_directoryMarkdown catalog of all tools
team_scheduleTeam schedule & scores (Baseball Reference)
player_stat_splitsBRef splits (platoon, home/away, …)
statcast_game_pitchesEvery pitch in one game (game_pk)
batter_vs_pitcher_statcastStatcast summary for one batter vs one pitcher
lahman_season_batting / lahman_season_pitching / lahman_season_teamsLahman / Baseball Data Bank slices
top_prospects_mlbMLB Pipeline–style prospect list
amateur_draft_roundAmateur draft by year + round
war_daily_batting / war_daily_pitchingBRef WAR component files
season_fielding_statsFanGraphs fielding leaderboard
league_team_batting_totals / league_team_pitching_totalsFG team lines (league-wide)
statcast_running_splits_detail90 ft sprint splits
statcast_outfield_catch_probabilityOF catch prob / stars
statcast_outfield_jumpOF jump metric
statcast_catcher_framing / statcast_catcher_poptimeCatcher framing & pop time
statcast_pitcher_pitch_movement / statcast_pitcher_active_spin_leaderboardPitch movement & active spin (Statcast)

Team seasons: Use team_season_batting_stats / team_season_pitching_stats with a 3-letter code (PHI, NYY, …) for a full roster’s actual stats (lineup + staff). FanGraphs is tried first; Baseball Reference is used if FG fails or returns nothing.

Player search: Nearly every leaderboard/stat tool accepts optional player_name (e.g. "Aaron Judge") so you get that player’s full rows instead of only the first 50 in the table. For groups (full lineup + rotation, “all starters”), use expected_stats_batch with comma-separated names — the server does not pull MLB rosters automatically; list names explicitly or resolve them first (e.g. web / player_lookup). Pitch-level tools already take a name via statcast_batter / statcast_pitcher. team_standings is team-only.

Quick Start

Prerequisites

Option 1: Install from PyPI (Recommended)

bash
# Using uv (fastest)
uv pip install statcast-mcp

# Or using pip
pip install statcast-mcp

Option 2: Install from Source

bash
git clone https://github.com/YOUR_USERNAME/statcast-mcp.git
cd statcast-mcp
uv pip install .

Setup

Claude Desktop

Add this to your Claude Desktop configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
json
{
  "mcpServers": {
    "statcast": {
      "command": "statcast-mcp"
    }
  }
}

If you installed from source and want to run it directly:

json
{
  "mcpServers": {
    "statcast": {
      "command": "uv",
      "args": ["run", "--directory", "/absolute/path/to/statcast-mcp", "statcast-mcp"]
    }
  }
}

Cursor

Open Cursor Settings → MCP and add a new server:

  • Name: statcast
  • Type: command
  • Command: statcast-mcp

Or add to your .cursor/mcp.json:

json
{
  "mcpServers": {
    "statcast": {
      "command": "statcast-mcp"
    }
  }
}

VS Code (Copilot)

Add to your VS Code settings.json:

json
{
  "mcp": {
    "servers": {
      "statcast": {
        "command": "statcast-mcp"
      }
    }
  }
}

Example Queries

Looking Up a Player

"Look up Shohei Ohtani"

Returns the player's MLBAM ID, FanGraphs ID, Baseball Reference ID, and years active.

Pitch-Level Data

"Show me all the pitches from the Dodgers game on October 15, 2024"

statcast_search(start_date="2024-10-15", team="LAD")

Batter Analysis

"What pitches did Juan Soto see from July 1 to July 31, 2024?"

statcast_batter(player_name="Juan Soto", start_date="2024-07-01", end_date="2024-07-31")

"How does Aaron Judge hit against different pitch types?" (e.g. 2023, 106 games)

statcast_batter_pitch_arsenal(year=2023, player_name="Aaron Judge")

Season Leaderboards

"Who were the top hitters in 2024 by wRC+?"

season_batting_stats(start_season=2024)

"Top 200 hitters in 2023 by slugging, min 100 PA"

season_batting_stats(
    start_season=2023,
    min_plate_appearances=100,
    sort_by="SLG",
    max_output_rows=200,
)

Expected Stats (Find Undervalued Players)

"Show me batters whose expected stats were way higher than their actual stats in 2024"

statcast_batter_expected_stats(year=2024)

"What are Aaron Judge's expected stats vs actual in 2025?"

statcast_batter_expected_stats(year=2025, player_name="Aaron Judge")

Exit Velocity Leaders

"Who hit the ball hardest in 2024?"

statcast_batter_exitvelo_barrels(year=2024)

Pitcher Arsenal

"What pitches does Spencer Strider throw and how effective are they?"

statcast_pitcher_pitch_arsenal(year=2024)
statcast_pitcher_arsenal_stats(year=2024)

Sprint Speed

"Who are the fastest players in baseball?"

sprint_speed_leaderboard(year=2024)

Standings

"Show me the 2024 MLB standings"

team_standings(season=2024)

Percentile ranks & defense

"What are Aaron Judge's Statcast percentile ranks in 2024?"

batter_percentile_ranks(year=2024, player_name="Aaron Judge")

"Who were the best defensive shortstops by OAA in 2024?"

outs_above_average(year=2024, position="SS")

Hot streaks (date ranges)

"Who hit the best from July 1 to July 31, 2024?"

batting_stats_date_range(start_date="2024-07-01", end_date="2024-07-31")

Data Sources

All data is sourced from:

  • Baseball Savant — Statcast pitch-level and leaderboard data (2008+)
  • FanGraphs — Season-level batting and pitching statistics
  • Baseball Reference — Player identification, daily stat ranges, and cross-references

Reference Guide

For detailed tool-by-tool documentation, row limits, parameters, and usage patterns, see REFERENCE.md.

Social / sharing: Short descriptions and hashtag ideas for posts are in TOOLS_SUMMARY.md.

Notes

  • Date ranges: Statcast data is available from 2008 onward. Some metrics (exit velocity, launch angle) are only available from 2015+.
  • Query speed: Shorter date ranges return faster. For pitch-level data, keep ranges to 1-5 days when possible.
  • Rate limits: Baseball Savant limits individual requests to ~30,000 rows. The server handles splitting larger queries automatically.
  • Markdown row display: Each tool’s markdown table is capped by max_output_rows (defaults vary; hard maximum 5000 per limits.py) so responses stay bounded in chat clients.
  • Player names: Tools accept names like "Mike Trout", "Trout, Mike", or "Shohei Ohtani". The server resolves names to MLB IDs automatically.

Development

bash
# Clone the repo
git clone https://github.com/YOUR_USERNAME/statcast-mcp.git
cd statcast-mcp

# Create a virtual environment and install in editable mode
uv venv
uv pip install -e ".[dev]"

# Run the server locally
statcast-mcp

# Test with the MCP Inspector
npx @modelcontextprotocol/inspector statcast-mcp

# Smoke-test all 46 tools (needs network; ~2024 fixtures)
PYTHONPATH=src python scripts/verify_tools.py

Contributing

Contributions are welcome! Some ideas:

  • Add more tools (game scores, team batting/pitching, historical data)
  • Improve player name resolution
  • Add data caching for faster repeated queries
  • Create prompt templates for common analyses

License

MIT

Instalação

TypingMind
Pré-requisitos:

Node.js 18+

{
  "mcpServers": {
    "alex-rimerman-statcast-mcp": {
      "command": "uvx",
      "args": [
        "statcast-mcp"
      ]
    }
  }
}

Use o MCP de Statcast MCP Server com vários modelos de IA

O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho. Assim, após conectar Statcast MCP Server, é possível usá-lo com diferentes modelos de IA no TypingMind, em vez de configurá-lo separadamente para cada modelo. Este MCP é executado localmente no seu dispositivo por meio do conector MCP do TypingMind.

Guia de configuração para usar o conector local

Use esta opção quando o servidor MCP precisar acessar arquivos locais, aplicativos ou recursos privados no seu computador.

1

Abra as configurações de MCP

No TypingMind, acesse Configurações > Configurações avançadas > Model Context Protocol e selecione Configurar conector.

  1. Abra o TypingMind no navegador.
  2. Clique no ícone de Configurações.
  3. Acesse Configurações avançadas.
  4. Abra a seção Model Context Protocol.
  5. Clique em Configurar conector e selecione Este dispositivo.
Tela de configuração do conector MCP do TypingMind com a opção Este dispositivo selecionada
2

Execute o comando do conector

Selecione Este dispositivo, copie o comando do TypingMind e execute-o no Terminal. Mantenha o processo em execução enquanto usa o MCP.

  1. Copie o comando de configuração exibido pelo TypingMind.
  2. Abra o Terminal no macOS ou o Windows Terminal no Windows.
  3. Cole e execute o comando.
  4. Autorize a instalação do pacote se o Terminal pedir confirmação para continuar.
  5. Mantenha o processo em execução na janela do Terminal enquanto usa as ferramentas MCP.
3

Adicione Statcast MCP Server como servidor

Quando o status do conector for Pronto, clique em Editar servidores e cole a configuração do servidor MCP.

  1. Aguarde até que o status do conector mostre Pronto.
  2. Clique em Editar servidores.
  3. Cole a configuração do servidor MCP de Statcast MCP Server.
  4. Salve a lista de servidores.
  5. Se quiser confirmar que o conector ainda está pronto para uso, atualize a página.
Configurações de MCP do TypingMind mostrando um servidor ativo e o botão Editar servidores
{
  "mcpServers": {
    "alex-rimerman-statcast-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "statcast-mcp"
      ]
    }
  }
}
4

Use a conexão com diferentes modelos

Salve a lista de servidores, abra Plugins, ative as ferramentas MCP de Statcast MCP Server, selecione qualquer modelo de IA compatível no TypingMind e use as ferramentas no chat ou atribua-as a um agente de IA.

  1. Abra a página Plugins no TypingMind.
  2. Ative as ferramentas MCP de Statcast MCP Server.
  3. Inicie um chat e escolha o modelo de IA que deseja usar.
  4. Use as ferramentas MCP no chat ou atribua-as a um agente de IA.
  5. Mude para outro modelo de IA sempre que necessário, sem reconectar o MCP.
Chat do TypingMind usando ferramentas MCP ativadas com um modelo de IA selecionado
Pode usar Statcast MCP Server para me ajudar nesta tarefa?
Statcast MCP Server
Claro. Já li.
Veja o que encontrei usando Statcast MCP Server.

Perguntas frequentes

Para que serve o servidor MCP Statcast MCP Server?

Statcast MCP Server é um servidor MCP que permite que aplicativos de IA compatíveis se conectem a ferramentas externas e informações de contexto. No TypingMind, basta adicionar esse servidor MCP uma vez para disponibilizar suas ferramentas no seu espaço de trabalho com IA.

Posso usar o MCP Statcast MCP Server com vários modelos de IA no TypingMind?

Sim. O TypingMind conecta as ferramentas MCP no nível do espaço de trabalho, permitindo usar Statcast MCP Server com diferentes modelos de IA, como Claude, ChatGPT, Gemini ou outros modelos configurados no TypingMind, sem configurar o servidor MCP separadamente para cada modelo.

Por que usar o MCP Statcast MCP Server com o TypingMind?

O TypingMind é uma das melhores interfaces de chat com LLMs porque reúne vários modelos de IA, prompts, plugins, agentes de IA, chaves de API e ferramentas MCP em um só espaço de trabalho. Com Statcast MCP Server conectado, é possível usar suas ferramentas MCP nos seus modelos preferidos e manter seu fluxo de trabalho de chat organizado no TypingMind.

Como conecto o MCP Statcast MCP Server ao TypingMind?

Statcast MCP Server funciona por meio do conector MCP local do TypingMind. Essa é a melhor opção quando o servidor MCP precisa acessar arquivos locais, apps de desktop, ferramentas de linha de comando ou recursos privados no seu computador.

Quais ferramentas o MCP Statcast MCP Server oferece no TypingMind?

Statcast MCP Server disponibiliza recursos MCP que podem ser ativados na página Plugins do TypingMind e usados no chat ou atribuídos a agentes de IA.

Preciso compartilhar minhas chaves de API com o TypingMind para usar o MCP Statcast MCP Server?

Não. O TypingMind prioriza o uso local e permite manter seus provedores de modelos, chaves de API, prompts e configuração MCP sob seu controle. Se Statcast MCP Server exigir autenticação, adicione os cabeçalhos, as configurações OAuth ou a configuração local exigidos por esse servidor MCP ao criar a conexão.

Servidores MCP relacionados

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇