mlb-mcp
by etweisberg·★ 25·Score 44
Python MCP server for MLB baseball analytics with API access to statcast, fangraphs, and baseball reference data.
Overview
The MLB Stats MCP Server is a comprehensive Python implementation that provides structured access to Major League Baseball statistics through multiple data sources. It integrates with the MLB Stats API, pybaseball library, and other baseball data providers to deliver detailed analytics. The server features well-organized code structure with separate modules for tools (MLB StatsAPI, Statcast, pybaseball plotting) and utilities, making it modular and maintainable.
Try asking AI
After installing, here are 5 things you can ask your AI assistant:
When to choose this
Choose this server if you need comprehensive baseball statistics access through multiple data sources and want to integrate them into MCP-compatible applications.
When NOT to choose this
Avoid this if you need access to sports data outside of baseball, as it's specialized solely for MLB statistics and won't support other sports analytics.
Tools this server exposes
4 tools extracted from the READMEmlb_statsapi_toolsMLB StatsAPI tool definitions for accessing MLB statistics
statcast_toolsStatcast data tool definitions for advanced baseball analytics
pybaseball_plotting_toolsGenerate matplotlib plots and return base64 encoded images
pybaseball_supp_toolsSupplemental pybaseball functions for Fangraphs, Baseball Reference, and other data sources
Note: Tool names were inferred from the project structure and directory organization, as the README doesn't provide explicit documentation of individual tools or their signatures.
Comparable tools
Installation
Installation
- Install uv if you haven't already:
curl -LsSf https://astral.sh/uv/install.sh | sh- Create and activate a virtual environment:
uv venv
source .venv/bin/activate # On Unix/macOS
# or
.venv\Scripts\activate # On Windows- Install dependencies:
uv pip install -e .Claude Desktop Integration
To connect this MCP server to Claude Desktop, add a configuration to your claude_desktop_config.json file:
"mcp-baseball-stats": {
"command": "{PATH_TO_UV}",
"args": [
"--directory",
"{PROJECT_DIRECTORY}",
"run",
"python",
"-m",
"mlb_stats_mcp.server"
],
"env": {
"MLB_STATS_LOG_FILE": "{LOG_FILE_PATH}",
"MLB_STATS_LOG_LEVEL": "DEBUG"
}
}FAQ
- What data sources does this MCP server integrate with?
- The server integrates with MLB Stats API, pybaseball library for statcast data, Fangraphs, and Baseball Reference.
- Does the server support generating visualizations?
- Yes, it includes matplotlib plotting tools that can generate and return base64 encoded images.
Compare mlb-mcp with
Last updated · Auto-generated from public README + GitHub signals.