MLB Stats Server — Claude Code MCP server: MLB game and player stats
MLB Stats Server — an MCP server that gives your agent MLB data: schedules, box scores, Statcast, FanGraphs and Baseball Reference stats. Useful for questions about games and players.
no license 4,958 installs ★ 34 updated 2026-09-20
claude mcp add --transport http mlb-mcp https://mlb-mcp--etweisberg.run.toolsWhat MLB Stats Server does
The server exposes baseball data as agent tools. The MLB Stats API side covers schedules, standings, rosters, box scores, line scores and league leaders, and lookup_player finds a player. Statcast comes through pybaseball: single-game pulls, batter and pitcher data, exit velocity and barrels, expected stats, percentile ranks and pitch arsenals.
Some tools draw matplotlib plots and hand them back as base64 images. It is a Python project built on mcp[cli], mlb-statsapi and httpx. To run it yourself you need uv, then uv pip install -e . and python -m mlb_stats_mcp.server. Logs go to stderr unless MLB_STATS_LOG_FILE points at a file.
With --http the server listens on $PORT (8081 by default) and serves MCP at /mcp. It accepts any Host and Origin out of the box, so a public deployment stays open until you restrict it. Set MLB_STATS_ALLOWED_HOSTS and MLB_STATS_ALLOWED_ORIGINS together, because hosts alone make the server reject every browser-based client.
What it helps with
- look up the score and date of a team's last or next game
- read the box score and line score of a specific game
- compare two pitchers by Statcast pitch arsenal
- check a batter's exit velocity and barrels
- plot
pybaseballdata and get the chart back as an image
Example prompts for the agent
- Use MLB Stats Server to show the standings and my team's next game
- Call
get_statcast_pitcher_pitch_arsenaland compare the arsenals of two pitchers - Find the player with
lookup_player, then pull his Statcast expected stats
How to install MLB Stats Server
Platform CLI: remote server
claude mcp add --transport http mlb-mcp https://mlb-mcp--etweisberg.run.toolsPlatform CLI: remote server
codex mcp add mlb-stats-server --url https://mlb-mcp--etweisberg.run.toolsConfig file
{
"mcpServers": {
"mlb-stats-server": {
"url": "https://mlb-mcp--etweisberg.run.tools"
}
}
}Config file
{
"servers": {
"mlb-stats-server": {
"type": "http",
"url": "https://mlb-mcp--etweisberg.run.tools"
}
}
}Platform CLI: remote server
gemini mcp add -t http mlb-stats-server https://mlb-mcp--etweisberg.run.toolsStep by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about MLB Stats Server
How do I install MLB Stats Server in Claude Code?
Run claude mcp add --transport http mlb-mcp https://mlb-mcp--etweisberg.run.tools. To register it as mlb-stats-server instead, use the same command with that name: claude mcp add --transport http mlb-stats-server https://mlb-mcp--etweisberg.run.tools.
What does MLB Stats Server do?
It is an MCP server that answers agent requests with MLB data: schedules, box scores, rosters, league leaders and several Statcast queries. A few tools produce charts.
Can I run MLB Stats Server locally?
Yes. Install uv, create a virtual environment, run uv pip install -e ., then start python -m mlb_stats_mcp.server. Add --http for the HTTP transport.