Basic information
About MLB Stats MCP Server
MCP server for advanced baseball analytics (statcast, fangraphs, baseball reference, mlb stats API)
MLB Stats MCP Server is a MCP server in the Other category listed in the AddMCP.net directory, published by etweisberg. Supported transport: stdio. Runtime: python. The repository has 28 GitHub stars. Source code is hosted on github.com. Related topics: baseball-analytics, baseball-data, baseball-statistics, fangraphs, mcp.
Setup
{
"mcpServers": {
"mlb-mcp": {
"command": "uv",
"args": [
"venv"
]
}
}
}
{
"mcpServers": {
"mlb-mcp": {
"command": "uv",
"args": [
"venv"
]
}
}
}
{
"servers": {
"mlb-mcp": {
"command": "uv",
"args": [
"venv"
]
}
}
}
MLB Stats MCP Server config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"mlb-mcp": {
"command": "uv",
"args": [
"venv"
]
}
}
}
MLB Stats MCP Server tools
Tool list not available yet
This listing does not currently have a tool list to display. This does not mean the server has no tools; check its documentation for supported capabilities.
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is MLB Stats MCP Server?
A Python project that implements a Model Context Protocol (MCP) server for accessing Major League Baseball statistics. It combines the MLB Stats API and the pybaseball library (Statcast, FanGraphs, Baseball Reference) to provide structured baseball data to MCP-compatible clients like Claude Desktop.
How to use MLB Stats MCP Server?
Install uv, create a virtual environment (uv venv), activate it, and install dependencies (uv pip install -e .). Set the ANTHROPIC_API_KEY environment variable and optionally configure logging. Then add the server to your MCP client (e.g., Claude Desktop) using the provided JSON configuration.
Key features of MLB Stats MCP Server
- Combines MLB Stats API, Statcast, FanGraphs, and Baseball Reference data.
- Generates matplotlib plots returned as base64-encoded images.
- Configurable logging via environment variables (
MLB_STATS_LOG_LEVEL,MLB_STATS_LOG_FILE). - Comprehensive test suite using pytest and pytest-asyncio.
- Linting and code formatting enforced by Ruff and pre-commit hooks.
- Option to install automatically via Smithery for Claude Desktop.
Use cases of MLB Stats MCP Server
- Query player statistics, game logs, and team data from multiple MLB sources.
- Retrieve Statcast metrics (exit velocity, launch angle, etc.) for advanced analysis.
- Generate and view matplotlib visualizations of baseball data.
- Integrate real-time baseball data into AI assistants using MCP protocol.
Frequently asked questions
1 What dependencies does the server require?
Python, uv (package manager), and libraries including mcp[cli], mlb-statsapi, httpx, pytest, pytest-asyncio, and matplotlib (for plotting).
2 How do I install the server?
Run uv venv && source .venv/bin/activate && uv pip install -e . in the project directory. Alternatively, install via Smithery with npx -y @smithery/cli install @etweisberg/mlb-mcp --client claude.
3 How do I configure the server for Claude Desktop?
Add an entry to claude_desktop_config.json with the command set to your uv path, args pointing to python -m mlb_stats_mcp.server, and env for logging and API key.
4 How do I configure logging?
Set the environment variables MLB_STATS_LOG_LEVEL (e.g., DEBUG, INFO) and MLB_STATS_LOG_FILE (path to log file). If the log file is not set, logs go to stdout.
5 What data sources are available through the tools?
The server provides tools for the MLB Stats API, Statcast data, and supplemental pybaseball functions for FanGraphs and Baseball Reference statistics.
Comments
No comments yet
Be the first to share feedback about this listing. Sign in to leave a comment.
Sign In