MCP.so
Sign In

Pybaseball MCP Server

@jweingardt12

About Pybaseball MCP Server

MCP server to fetch basic (and complex!) baseball-related stats.

Basic information

Category

Other

Runtime

python

Transports

stdio

Publisher

jweingardt12

Config

Add this server to your MCP-compatible client using the configuration below.

{
  "mcpServers": {
    "mlb_mcp": {
      "command": "python",
      "args": [
        "mcp_stdio_wrapper.py"
      ]
    }
  }
}

Tools

No tools detected

We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.

Overview

What is Pybaseball MCP Server?

Pybaseball MCP Server is a FastAPI-based MCP (Model Context Protocol) server that exposes MLB and Fangraphs baseball data via the pybaseballstats library. It is intended for developers and applications that need programmatic access to baseball statistics through an MCP interface.

How to use Pybaseball MCP Server?

Install dependencies with pip install -r requirements.txt, then start the server with uvicorn main:app --reload. The server provides three HTTP GET endpoints: /player (Statcast data by name), /team_stats (team batting or pitching stats by team and year), and /leaderboard (MLB leaderboard by stat, season, and league). For an MCP STDIO interface, run the FastAPI server and then execute python mcp_stdio_wrapper.py.

Key features of Pybaseball MCP Server

  • Query player Statcast data by name with optional date range.
  • Retrieve team batting or pitching stats for a given year.
  • Access MLB leaderboards by stat, season, and league.
  • Supports both HTTP and MCP STDIO transports.
  • Interactive API docs at /docs when server is running.
  • Ready for deployment on MCP‑compatible platforms like Smithery.

Use cases of Pybaseball MCP Server

  • Analyze a specific player’s performance over a custom date range.
  • Compare team‑level batting or pitching statistics across seasons.
  • Build leaderboard dashboards for a single stat, league, and season.
  • Integrate baseball data into MCP‑aware AI agents or workflows.

FAQ from Pybaseball MCP Server

What dependencies does Pybaseball MCP Server require?

It requires the pybaseballstats, pandas, and numpy Python packages, as listed in the README.

How do I start the Pybaseball MCP Server?

Run uvicorn main:app --reload in the project directory after installing dependencies.

How can I expose an MCP STDIO interface?

First start the FastAPI server (e.g., uvicorn main:app --host 0.0.0.0 --port 8000 &), then run python mcp_stdio_wrapper.py.

How do I list available tools on the server?

Use HTTP POST to http://localhost:8000/tools/list or send a JSON‑RPC request via the STDIO wrapper: echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | python mcp_stdio_wrapper.py.

Where can I find the API documentation?

Once the server is running, interactive API docs are available at http://127.0.0.1:8000/docs.

Comments

More Other MCP servers