mlb-mcp

etweisberg/mlb-mcp

3.3

If you are the rightful owner of mlb-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The MLB Stats MCP Server is a Python-based server that provides structured API access to MLB statistics using the MLB Stats API and the `pybaseball` library.

The MLB Stats MCP Server is designed to facilitate access to comprehensive Major League Baseball statistics through a Model Context Protocol (MCP) server. By leveraging the MLB Stats API and the `pybaseball` library, this server offers a robust platform for retrieving a wide range of baseball statistics, including data from statcast, fangraphs, and baseball reference. The server is built with a modular architecture, allowing for easy integration with MCP-compatible clients. It supports configurable logging and can be seamlessly integrated with platforms like Claude Desktop. The project is equipped with a suite of tools for data retrieval and visualization, and it includes comprehensive testing to ensure reliability and accuracy. With its focus on providing structured and efficient access to baseball data, the MLB Stats MCP Server is an invaluable resource for developers and analysts working with baseball statistics.

Features

  • Structured API access to MLB statistics
  • Integration with MLB Stats API and `pybaseball` library
  • Support for configurable logging
  • Comprehensive testing with pytest
  • Seamless integration with MCP-compatible clients

Usages

usage with Claude Desktop

"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"
  }
}

Tools

  1. mlb_statsapi_tools

    MLB StatsAPI tool definitions

  2. statcast_tools

    Statcast data tool definitions

  3. pybaseball_plotting_tools

    Tools for generating matplotlib plots and returning base64 encoded images

  4. pybaseball_supp_tools

    Supplemental functions for interfacing with fangraphs, baseball reference, and other data sources