Skip to main content
MCP server CX Codex

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

Install into Claude Code · Platform CLI: remote server All methods and platforms ↓
claude mcp add --transport http mlb-mcp https://mlb-mcp--etweisberg.run.tools
Open on GitHub

What 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 pybaseball data 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_arsenal and 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.tools

Step 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.

Similar MCP servers

All MCP servers for Data and databases →

More in the catalog

Project sponsors

Companies that keep this analytics open