The Baseball MCP Server provides comprehensive MLB data through the Model Context Protocol (MCP). Access it via HTTPS/SSE through compatible clients like Claude Desktop or Gemini CLI.
Configure the Baseball MCP server in your MCP client with your API key:
{
"mcpServers": {
"baseball-mcp": {
"command": "npx",
"args": ["@baseballmcp/server"],
"env": {
"BASEBALL_MCP_API_KEY": "your_api_key_here"
}
}
}
}
Get all MLB teams or a specific team by ID.
Tool: get_teams
team_id
(integer, optional) - Team ID to get specific team info// Ask Claude or Gemini CLI:
"Get all MLB teams"
// Or for a specific team:
"Get information about the New York Yankees (team ID 147)"
// The MCP server will call get_teams tool with:
{
"team_id": 147 // optional
}
Get roster for a specific team.
GET /api/teams/roster
team_id
(integer, required) - Team IDseason
(integer, optional) - Season yearconst roster = await fetch('https://api.baseballmcp.com/v1/teams/roster?team_id=147', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
Get recent bullpen usage for a team (last 7 days).
GET /api/teams/bullpen
team_id
(integer, required) - MLB team IDdays
(integer, optional) - Number of days to look back (default: 7)Search for players by name.
GET /api/players/search
query
(string, required) - Player name to search forconst players = await fetch('https://api.baseballmcp.com/v1/players/search?query=Mike Trout', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
Get statistics for a specific player.
GET /api/players/stats
player_id
(integer, required) - Player IDgroup
(string, optional) - Stats group: hitting, pitching, or fieldingtype
(string, optional) - Stats type: season or career// Get Mike Trout's hitting stats
const stats = await fetch('https://api.baseballmcp.com/v1/players/stats?player_id=545361&group=hitting&type=season', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
Get detailed information for one or more players.
GET /api/players/info
player_ids
(integer or array, required) - Player ID(s)Get MLB game schedule.
GET /api/schedule
date
(string, optional) - Date for schedule (YYYY-MM-DD)start_date
(string, optional) - Start date for rangeend_date
(string, optional) - End date for rangeteam_id
(integer, optional) - Team ID to filter by// Get today's games
const schedule = await fetch('https://api.baseballmcp.com/v1/schedule', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
// Get Yankees games for a date range
const yankeeGames = await fetch('https://api.baseballmcp.com/v1/schedule?start_date=2024-07-01&end_date=2024-07-31&team_id=147', {
headers: {
'Authorization': 'Bearer YOUR_API_KEY'
}
});
Get boxscore for a specific game.
GET /api/games/boxscore
game_id
(integer, required) - Game IDGet head-to-head series statistics between two MLB teams.
GET /api/games/h2h
team1_id
(integer, required) - First team IDteam2_id
(integer, required) - Second team IDseason
(integer, optional) - Specific seasonstart_date
(string, optional) - Start date (YYYY-MM-DD)end_date
(string, optional) - End date (YYYY-MM-DD)Get comprehensive batting statistics for players or teams.
GET /api/stats/batting
player_ids
(array, optional) - List of player IDsteam_ids
(array, optional) - List of team IDsseason
(integer, optional) - Season yearstat_type
(string, optional) - season, career, monthly, last7, last15, last30include_advanced
(boolean, optional) - Include OPS+, wRC+, WARsort_by
(string, optional) - avg, hr, rbi, ops, war, hits, runsGet Statcast metrics from Baseball Savant.
GET /api/stats/statcast
player_ids
(integer or array, required) - Player ID(s)season
(integer, optional) - Season yearmetric_type
(string, optional) - exit_velocity, barrel_rate, hard_hit_rate, whiff_rate, chase_rate, all// Get Statcast data for multiple players
const statcast = await fetch('https://api.baseballmcp.com/v1/stats/statcast', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
player_ids: [545361, 592450], // Mike Trout, Mookie Betts
metric_type: 'all'
})
});
Get current MLB standings with comprehensive team records.
GET /api/standings
league_id
(integer, optional) - League ID (103=AL, 104=NL)season
(integer, optional) - Season yeardivision
(string, optional) - Filter by division (e.g., 'AL East')Get current weather conditions for MLB stadiums.
GET /api/weather
venue_id
(integer, required) - MLB venue IDgame_date
(string, optional) - Game date (YYYY-MM-DD)Rate limits are enforced on a monthly basis. Exceeding your limit will result in API requests being rejected with a 429 status code.
The API uses conventional HTTP response codes to indicate the success or failure of requests.
200
- Success400
- Bad Request - Invalid parameters401
- Unauthorized - Invalid API key403
- Forbidden - API key lacks permissions404
- Not Found - Resource not found429
- Too Many Requests - Rate limit exceeded500
- Internal Server ErrorNeed help? Our support team is here to assist you.