MCPSERV.CLUB
etweisberg

MLB Stats MCP Server

MCP Server

Real‑time MLB stats via a lightweight MCP interface

Stale(60)
8stars
1views
Updated 23 days ago

About

A Python MCP server that exposes MLB statistics from the MLB Stats API and pybaseball, providing structured access to statcast, fangraphs, and baseball‑reference data for MCP clients.

Capabilities

Resources
Access data sources
Tools
Execute functions
Prompts
Pre-built templates
Sampling
AI model interactions

MLB Stats MCP Server in Action

The MLB Stats MCP Server bridges the gap between baseball analytics and conversational AI by exposing a rich set of statistical data through the Model Context Protocol. It pulls information from the official MLB Stats API and the versatile library, which includes Statcast, Fangraphs, and Baseball‑Reference datasets. Developers can query player performance, team standings, advanced metrics, or generate visualizations—all without leaving the AI assistant’s environment. This unified interface eliminates the need to manage multiple API keys, data pipelines, or custom parsing logic, allowing teams and analysts to focus on insight generation rather than integration overhead.

At its core, the server offers a collection of MCP tools that mirror common baseball queries: “Get the latest batting averages for the American League,” “Show a pitch‑type distribution chart for a given pitcher,” or “Retrieve career WAR values from Fangraphs.” Each tool translates a natural‑language request into an HTTP call to the appropriate endpoint, processes the JSON response, and returns a structured payload. For visual data, the server generates Matplotlib plots on demand, encodes them as base64 strings, and hands them back to the client. This capability is especially useful for AI assistants that can embed images directly in responses, turning raw numbers into instantly interpretable graphics.

The server’s design emphasizes reliability and observability. Environment variables control logging levels and output destinations, while automated tests cover every tool’s happy path and error handling. Integration with Claude Desktop is straightforward—once the server is running, the assistant can invoke any tool by name and receive typed or visual results in real time. The Smithery installation command further streamlines deployment, ensuring that the MCP server is available as a first‑class plugin for the Claude ecosystem.

Use cases span from fantasy baseball analysts who need up‑to‑date projections, to sports journalists crafting data‑driven stories, to academic researchers conducting sabermetric studies. In each scenario, the MCP server removes latency and friction: an AI assistant can fetch the latest statcast data for a game, generate a pitch‑type heatmap, and embed it in an article or presentation—all within a single conversational turn. Developers benefit from the server’s modular toolset, clear API contracts, and seamless integration with existing AI workflows. The standout advantage is the server’s ability to deliver both raw statistical tables and ready‑made visualizations, empowering AI assistants to present insights in the most effective format for any audience.