baseball-mcp
Provides access to MLB Stats API for retrieving game schedules, game results, team information, scoring plays, highlights, and player lookup with fuzzy matching support.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@baseball-mcp show me the Yankees schedule for this week"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
baseball-mcp: An MLB Stats API Wrapper for MCP
This project provides an MCP (Model Context Protocol) that acts as a wrapper for the MLB Stats API. It allows you to easily access and process various MLB data points, including schedules, game results, and team information. This server is designed for efficient data retrieval and processing within an MCP framework.
Demo Videos
Here are a couple of demo videos showcasing the capabilities of mcp_mlb_statsapi:
Demo 1: MCP MLB Stats API - Quick Overview
Demo 2: MCP MLB Stats API - 輸入中文也可以
Related MCP server: Formula One MCP Server
Features
Game Schedules: Retrieve MLB game schedules for specified date ranges, optionally filtering by team.
Game Results: Fetch daily game results, including scores, winning/losing teams, and winning pitcher.
Team Results: Get detailed results for a specific team's most recent game, including scoring plays and highlights.
Player Lookup: Look up player IDs using last name, first name, or a combination of both. Supports fuzzy matching.
Installation
Prerequisites
Python 3.10 or newer
uv package manager:
If you're on Mac, please install uv as
brew install uvOn Windows
powershell -c "irm https://astral.sh/uv/install.ps1 | iex" Otherwise installation instructions are on their website: Install uv
Install via PyPI
The mcp_mlb_statsapi package is available on PyPI and can be installed using pip:
pip install mcp_mlb_statsapiInstall via Github
or you can clone this repo, run it with soruce code.
uv venv
source .venv/bin/activate
uv pip install -r requirements.txtClaude for Desktop Integration
Go to Claude > Settings > Developer > Edit Config > claude_desktop_config.json to include the following:
{
"mcpServers": {
"mcp_mlb_statsapi": {
"command": "{YOUR_PYTHON_EXECUTABLE_PATH}/python",
"args": ["-m",
"mcp_mlb_statsapi"]
}
}
}If you install it via source code
{
"mcpServers": {
"mcp_mlb_statsapi": {
"command": "{YOUR_UV_EXECUTABLE_PATH}/uv",
"args": [
"--directory",
"{YOUR_PROJECT_PATH}/src/mcp_mlb_statsapi",
"run",
"mcp_mlb_statsapi"
]
}
}
}Contributing
Contributions are welcome! Please open an issue or submit a pull request.
License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
References
This project utilizes the following external libraries and resources:
MLB-StatsAPI: https://github.com/toddrob99/MLB-StatsAPI - A Python library providing access to the MLB Stats API. This project relies heavily on
mlb-statsapifor data retrieval.
Available Tools
3 toolsget_daily_resultsB
Fetch MLB game results for a given date (default is today) Args: date (str): The date for fetching game results. Returns: list: A list of dictionaries containing game details.
Inputs: date.
get_mlb_scheduleA
Retrieves the MLB game schedule for a specified date range, optionally for a specific team.
Args:
start_date (str, optional): The start date for the schedule (YYYY-MM-DD). Defaults to today.
end_date (str, optional): The end date for the schedule (YYYY-MM-DD). Defaults to today.
team_id (int, optional): The ID of the team to get the schedule for. Defaults to None (all teams).
Returns:
list: A list of dictionaries, where each dictionary represents a game in the schedule.
Each game dictionary contains details like game ID, date, time, home team, away team, etc.
Inputs: start_date, end_date, team_id.
mlb_team_resultA
Retrieves the results (scoring plays and highlights) for a specific MLB team's most recent game.
Args:
team_name (str): The name of the MLB team (e.g., "Los Angeles Dodgers").
date (str, optional): The date for the schedule (YYYY-MM-DD). Defaults to today.
Returns:
dict or None: A dictionary containing the scoring plays and game highlights for the team's most recent game,
or None if no game is found for the team.
The dictionary has the following structure:
{
"scoring_plays": list, # List of scoring plays
"game_highlights": list # List of game highlights
}
Inputs: team_name (required), date.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
The three tools have distinct primary purposes: get_daily_results focuses on game outcomes for all teams on a date, get_mlb_schedule provides scheduling information across a date range, and mlb_team_result delivers detailed scoring/highlights for a specific team's recent game. However, there is some overlap between get_daily_results and mlb_team_result in that both can return game results for a date, which could cause minor confusion for an agent.
The naming is mixed: get_daily_results and get_mlb_schedule follow a consistent verb_noun pattern, but mlb_team_result deviates by placing the domain prefix first and using a noun_verb structure. This inconsistency reduces predictability, though the names remain readable and descriptive.
With only 3 tools, the server feels thin for covering the MLB domain comprehensively. While the tools address key aspects like results, schedules, and team details, the limited count may hinder complex agent workflows, such as accessing player stats, standings, or historical data, making it borderline appropriate.
The tool set has significant gaps for a baseball server. It lacks essential operations like retrieving team standings, player statistics, game box scores, or live scores, and there is no CRUD coverage for user interactions (e.g., favorites or predictions). This incompleteness will likely cause agent failures when handling common baseball queries beyond basic scheduling and results.
Maintenance
Related MCP Connectors
MLB Stats API MCP — official MLB statistics (keyless).
Provides easy access to MLB, Baseball Savant, Statcast, and Fangraphs baseball data. Query detaile…
Live sports stats and pre-computed analysis for AI assistants across NBA, MLB, NFL, and NHL.
Sports MCP — wraps TheSportsDB API (free tier, test key 3, no auth required)
Related MCP Servers
- AlicenseBqualityDmaintenanceEnables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.74MIT
- AlicenseBqualityDmaintenanceProvides Formula One data and statistics through a Model Context Protocol interface, allowing users to access race calendars, session results, driver statistics, telemetry data, and championship standings.811MIT
- AlicenseBqualityDmaintenanceProvides structured access to NHL data including teams, players, standings, schedules, and statistics through the Model-Context Protocol pattern.255MIT
- AlicenseNot gradedqualityDmaintenanceProvides real-time access to football (soccer) data including fixtures, standings, teams, players, transfers, and injuries through the API-Football service via the Model Context Protocol.4ISC

