MLB SportRadar MCP Server

MLB SportRadar MCP Server

Connects Claude to the SportRadar MLB API to access real-time baseball data including game schedules, live scores, player statistics, team standings, injury reports, and play-by-play information through natural language queries.

Category
访问服务器

README

MLB SportRadar MCP Server

Model Context Protocol (MCP) server for connecting Claude with the SportRadar MLB API. It provides tools for accessing MLB game data, standings, player statistics, and more through the SportRadar API.

Requirements

  • Python 3.12 or higher
  • Model Context Protocol (MCP) Python SDK
  • httpx
  • python-dotenv
  • SportRadar API key

Setup

1. Get SportRadar API Key

  1. Sign up at SportRadar Developer Portal
  2. Get your MLB API key (trial or production)

2. Install uv (recommended)

curl -LsSf https://astral.sh/uv/install.sh | sh

3. Clone this repository

git clone https://github.com/yourusername/mlb-sportradar-mcp.git
cd mlb-sportradar-mcp

4. Create and activate a virtual environment

# Create virtual environment
uv venv

# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate

5. Install dependencies

# Option 1: Using uv (recommended)
uv sync

# Option 2: Using pip with requirements.txt
pip install -r requirements.txt

# Option 3: Install as editable package
uv pip install -e .

6. Set up environment variables

Create a .env file in the project root with your SportRadar API key:

SPORTRADAR_API_KEY=your_api_key_here

Usage

1. Configure Claude Desktop

First, install the MCP CLI globally:

uv tool install "mcp[cli]"

Then add this server to your Claude Desktop configuration file (~/Library/Application Support/Claude/claude_desktop_config.json on macOS):

{
  "mcpServers": {
    "MLB SportRadar": {
      "command": "/Users/<USERNAME>/.local/share/uv/tools/mcp/bin/mcp",
      "args": ["run", "/full/path/to/mlb-sportradar-mcp/src/mlb_sportradar_mcp/server.py"]
    }
  }
}

Important: Replace /full/path/to/ with the actual absolute path to your mlb-sportradar-mcp directory.

Restart Claude Desktop after saving the configuration.

2. Use the MCP server with Claude

Once configured, Claude Desktop will have access to these MLB SportRadar tools:

Game Data:

  • get_daily_schedule: Get MLB schedule for a specific date or today
  • get_game_summary: Get summary information for a specific game
  • get_game_boxscore: Get detailed boxscore for a specific game
  • get_game_play_by_play: Get detailed play-by-play data for a game
  • get_game_pitch_metrics: Get pitch-level metrics and Statcast data

Team & League:

  • get_standings: Get MLB standings for a specific year and league
  • get_team_profile: Get detailed team information
  • get_team_roster: Get current roster for a specific team
  • get_team_hierarchy: Get complete MLB team hierarchy with divisions
  • get_seasonal_statistics: Get seasonal statistics for a team

Player Data:

  • get_player_profile: Get detailed player information
  • get_player_seasonal_stats: Get seasonal statistics for a player
  • get_seasonal_splits: Get player splits (home/away, vs lefty/righty, etc.)
  • get_league_leaders: Get MLB league leaders in various categories

League Information:

  • get_injuries: Get current MLB injury report
  • get_transactions: Get MLB transactions for a specific date
  • get_draft_summary: Get MLB draft summary for a specific year

Example queries to try with Claude:

  • "Show me today's MLB schedule"
  • "Get the current AL standings"
  • "What are the current batting leaders in MLB?"
  • "Show me the injury report for MLB"
  • "Get play-by-play data for game [game_id]"
  • "Show me pitch metrics for the latest game"
  • "Get player splits for [player_name]"
  • "What transactions happened today in MLB?"

Development and testing

Install development dependencies and run the test suite with:

uv sync --all-extras
pytest -v tests

Running the server locally

To start the server manually (useful when developing or testing), run:

mlb-sportradar-mcp

Alternatively, you can run it directly with:

uv run python src/mlb_sportradar_mcp/server.py

Installing MCP CLI globally

If you want to use mcp run commands, install the MCP CLI globally:

uv tool install "mcp[cli]"

Then you can run:

mcp run src/mlb_sportradar_mcp/server.py

API Endpoints

This MCP server uses the SportRadar MLB API v8 endpoints:

  • Schedule: /en/games/{year}/{month}/{day}/schedule.json
  • Game Summary: /en/games/{game_id}/summary.json
  • Game Boxscore: /en/games/{game_id}/boxscore.json
  • Standings: /en/seasons/{year}/standings.json
  • Player Profile: /en/players/{player_id}/profile.json
  • Team Profile: /en/teams/{team_id}/profile.json
  • League Leaders: /en/seasons/{year}/leaders.json
  • Team Roster: /en/teams/{team_id}/roster.json
  • Injuries: /en/injuries.json

Rate Limits

Please be aware of SportRadar's API rate limits. The trial API typically has lower limits than production keys. Monitor your usage to avoid hitting rate limits.

License

MIT

Test change

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选