MCP server
MLB MCP Server for Claude, Cursor and ChatGPT
The MLB MCP server is a hosted, read-only connector at https://mcp.sportsdatahq.com/mcp/mlb. It gives Claude, ChatGPT and Cursor 26 tools: every plate appearance and pitch since 2015, box scores, standings, ratings and sportsbook lines. A free key brings 1,000 credits a month. Nothing to install.
What your agent can do with it
Baseball questions tend to need two levels of detail. Season questions ask who leads the league or how a bullpen has held up. Moment questions ask what a pitcher threw with two strikes, or how the win probability moved after one swing. The MLB route answers both from the same URL.
The detail comes from plate appearances and pitches. Each plate appearance carries the base-out state before it, the result, the batted ball (trajectory and location), runs scored, the home team's win probability afterward and a run value (RE24). The win probability is our own model, built from inning, outs, runners, score, team ratings and the two starting pitchers, and it is calculated for every plate appearance since 2015. Pitch rows add type, velocity, location, count and result.
You can connect to either server. The SportsDataHQ route, https://mcp.sportsdatahq.com/mcp/mlb, uses the cross-sport key and 1,000 free credits a month. FastballAPI's own server, https://mcp.fastballapi.com/mcp, uses a baseball-only key with 500 free credits a month. Tools and credit prices are the same on both.
Connect it to your client
Sign up for a free SportsDataHQ key at app.sportsdatahq.com. (FastballAPI's server takes a FastballAPI key and uses the same config shapes.) Claude and ChatGPT connectors sign you in with OAuth the first time a tool runs, so no key sits in a chat. Command-line and editor clients send the key in an x-api-key header. Connecting and listing tools cost nothing; only a data call spends credits.
Claude Code
claude mcp add --transport http sportsdatahq-mlb https://mcp.sportsdatahq.com/mcp/mlb --header "x-api-key: YOUR_API_KEY"Run /mcp inside Claude Code to confirm the server shows as connected. Without the header, /mcp walks you through an OAuth sign-in instead.
Claude.ai and Claude Desktop
Open Customize, then Connectors (older versions: Settings, Connectors), choose Add custom connector, name it sportsdatahq-mlb and paste https://mcp.sportsdatahq.com/mcp/mlb. Sign in the first time a tool runs and press Allow. The local Claude Desktop config file starts programs rather than URLs, so it goes through the mcp-remote bridge:
{
"mcpServers": {
"sportsdatahq-mlb": {
"command": "npx",
"args": ["-y", "mcp-remote", "https://mcp.sportsdatahq.com/mcp/mlb", "--header", "x-api-key:YOUR_API_KEY"]
}
}
}Cursor
Paste this into ~/.cursor/mcp.json:
{
"mcpServers": {
"sportsdatahq-mlb": {
"url": "https://mcp.sportsdatahq.com/mcp/mlb",
"headers": { "x-api-key": "YOUR_API_KEY" }
}
}
}ChatGPT
ChatGPT adds outside MCP servers through developer mode, which OpenAI currently offers on workspace plans and which may need an admin to switch on. Create a custom MCP app or connector, paste https://mcp.sportsdatahq.com/mcp/mlb and choose OAuth. A sign-in page opens, you press Allow, and there is no key to copy. Without developer mode, call the REST API from your own machine and paste the response in, as in the curl examples below.
Example questions and the tools they call
| Question | Tools called | Credits |
|---|---|---|
| Who hit the most home runs last season, and what were their OPS and run value? | get_leaders | 5 |
| Find Tarik Skubal's id, then show his pitch mix: usage, velocity and whiff rate by pitch type. | search_players, get_pitch_mix | 1 + 5 |
| Show the first two plate appearances of the last World Series game, with win probability after each. | get_games, get_plate_appearances | 2 + 10 |
| Where did one batter hit the ball in play this season? | search_players, get_spray_chart | 1 + 10 |
| Which teams beat their Pythagorean record, and by how much? | get_standings | 2 |
| What were the moneyline, run line and total at each book for one game, opening and closing? | get_odds | 5 |
| How did the first-5-innings total move at each book before first pitch? | get_market_odds | 10 |
| How many rest days and travel miles did each team have before a series? | get_rest_and_travel | 5 |
Good agents resolve names first. list_teams and search_players cost 1 credit and return the ids every other tool wants, so the 10-credit pitch and plate-appearance calls only run once the agent knows the exact game or player.
Tool count and highlights
The MLB route lists 26 tools. The ones worth knowing about:
- `get_plate_appearances`. A whole game in order, or a batter's, pitcher's or team's season. Filter by result, inning or runners in scoring position.
- `get_pitches` and `get_pitch_mix`. Every pitch with count, type, velocity and location, or a pitcher's arsenal summarised: usage, average and top velocity, whiff rate per swing and ball rate.
- `get_spray_chart`. Where a batter or team hits the ball, regular season or postseason.
- `get_game`. One call returns batting and pitching lines for both teams and every book's line.
- `get_standings`. Records, home and away splits, run differential and Pythagorean win percentage, computed from final games.
- Market tools.
get_odds,get_line_movement,get_line_at_time,get_market_odds,get_alt_lines,get_player_props,get_prop_historyandget_prop_movement. They return prices and implied probabilities as information about the market. - `get_data_status`. One credit to see how fresh each dataset is.
Ratings are ours (Elo from final games), not a ranking.
Credit costs
| Credits | Tools |
|---|---|
| 1 | list_teams, search_players, get_data_status |
| 2 | get_games, get_schedule, get_standings, get_injuries, get_ratings |
| 5 | get_game, get_player, get_player_games, get_leaders, get_team_stats, get_pitch_mix, get_line_at_time, get_rest_and_travel, get_odds (one game) |
| 10 | get_plate_appearances, get_pitches, get_spray_chart, get_line_movement, get_player_props, get_prop_history, get_prop_movement, get_market_odds, get_alt_lines, get_odds (a whole day) |
get_player_props costs 10 credits for a game that has not started and 20 once it has been played, on accounts opened after October 30, 2026. A free account's 1,000 credits cover roughly 500 standings calls or 100 plate-appearance pulls.
Verified examples you can run now
Export your key as KEY first. Each of these was run against the live API on December 6, 2026 and returned HTTP 200.
Home run leaders for the 2026 season (5 credits):
curl -s -X POST https://api.sportsdatahq.com/v1/mlb/get_leaders \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"stat": "hr", "season": 2026, "limit": 3}'{
"data": {
"stat": "hr",
"season": 2026,
"qualifier": "502 plate appearances",
"leaders": [
{ "name": "Kyle Schwarber", "team": "PHI", "pa": 701, "ops": 0.857, "hr": 45, "re24": 36.5 },
{ "name": "Pete Crow-Armstrong", "team": "CHC", "pa": 726, "ops": 0.943, "hr": 45, "re24": 48.4 }
]
}
}The first two plate appearances of one postseason game, with win probability and run value (10 credits):
curl -s -X POST https://api.sportsdatahq.com/v1/mlb/get_plate_appearances \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"game_id": "401908046", "limit": 2}'A pitcher's arsenal (5 credits):
curl -s -X POST https://api.sportsdatahq.com/v1/mlb/get_pitch_mix \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"pitcher_id": "42409", "season": 2026}'That call returned 2,531 pitches with a four-seam fastball used 38% of the time at 96.4 mph on average and a changeup with a 46.8% whiff rate.
One game's sportsbook lines (5 credits):
curl -s -X POST https://api.sportsdatahq.com/v1/mlb/get_odds \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-d '{"game_id": "401908046"}'And the tool list your MCP client sees on the MLB route, which costs nothing:
curl -s -X POST https://mcp.sportsdatahq.com/mcp/mlb \
-H "x-api-key: $KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list"}'When not to use this
- You need in-play data. Odds and props are pre-game only, and
starts_atis the schedule time rather than the actual first pitch. - You want a raw feed to resell. You may store the data, train models, backtest and build products that show your users what you derive. You may not redistribute the data, or odds as a raw feed, as a dataset or API of its own.
- You need pitch rows before 2015, or complete ones before 2018. Pitch rows cover about 98% of games in 2015 to 2017.
- You need long prop or alternate-line history. Player props and first-5-innings lines start in May 2023, and alternate run lines and totals start with the 2023 season. Before July 2020 each book has one final pregame line.
- You want a pick. The tools return prices and probabilities as data about the market. They do not recommend a wager, work out a stake or place anything.
- You need a decade of pitches in bulk. Pulling history one call at a time is the expensive route. A Parquet data package delivers it in one download.
Source and related pages
Full tool arguments are on the FastballAPI docs. For other sports, see the free sports data MCP server, the NBA, NFL, NHL and soccer guides, and the free skills.
Try it
- Get a free key: 1,000 credits a month, no card.
- Skip the API and download a data package if you want a full season in a file.
FAQ
How many tools does the MLB MCP server have?
The MLB route on the SportsDataHQ server lists 26 tools, and FastballAPI's own server lists the same 26. They cover games, box scores, plate appearances, pitches, spray charts, standings, injuries, ratings, odds and player props.
How far back does the MLB data go?
Games and every plate appearance start in 2015. Pitch rows exist for about 98% of games in 2015 to 2017 and every game from 2018. Opening and closing sportsbook lines start in July 2020, and player prop lines start in May 2023.
Which season should I pass to the tools?
Seasons are calendar years, so 2026 means the 2026 season. Leave the season out and most tools use the latest one. Team ids and abbreviations come from list_teams, player ids from search_players, and game ids from get_games or get_schedule.
Should I use the SportsDataHQ server or FastballAPI's?
Both expose the same MLB tools at the same credit prices. The SportsDataHQ key works across nine sports with 1,000 free credits a month. FastballAPI's key is baseball only, with 500 free credits a month, which suits you if baseball is all you build.
Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.