MCP Server
Read-only access to over 150 years of Major League Baseball data through the Model Context Protocol, for use with AI assistants and agents.
What's new — October 2026
The server now has 25 read-only tools, up from 17. Everything the site's browsers show, an AI assistant can now query too:
- list_all_star_years get_all_star_year Every All-Star season and roster, including the Negro Leagues East-West Game, matching the All-Star browser.
- list_negro_leagues get_negro_league get_negro_league_season The seven recognized leagues, their champions and clubs, and season standings with leaders, matching the Negro Leagues hub.
- get_this_day Birthdays, debuts, and final games on any date — the home page’s This Day in Baseball.
- list_managers Browse managers by career wins or name, matching the Managers browser.
- get_player_advanced_stats Season PA, BABIP, OPS vs. league, K/9, WHIP and more from the player page’s advanced tables.
-
search_playersnow takes the Players browser’sposition,era, andsortfilters;list_franchisestakesqueryandera; andget_playeradds career OPS vs. league, All-Star selection years, and whether the player managed. -
Stricter arguments. A tool call with an argument the tool doesn’t declare now
fails with a message naming the unknown argument and the supported ones, instead of quietly running on
defaults. Invalid values come back with the specific problem, such as
month and day must be passed together.
September 2026
The server just grew from 12 to 17 read-only tools, shipping alongside a wave of six new features across the site. Everything the new browsers show, an AI assistant can now query directly:
- search_parks get_park Every ballpark since 1871 — locations, former names, home-team tenures, and season-by-season attendance, matching the new Ballpark Browser.
- get_manager Full managerial careers with pennant and World Series flags, player-manager stints, and Manager of the Year awards, matching the new Managers Browser.
- get_player_postseason Postseason batting and pitching lines for any player, ordered the way a series run actually unfolded — wild card through World Series.
- get_player_fielding Season-by-season fielding plus career totals by position.
The same release brought the site the Negro Leagues hub
(the seven recognized leagues, 1920–1948, with standings and leaders), the
All-Star roster browser (including the East-West Game), and the
daily This Day in Baseball widget — all built on the same data
this server exposes. The
baseball-history://server/workflow-guide resource routes the new question
types, so connected assistants discover the expanded surface automatically.
How it works
The server exposes 25 read-only tools and 6 JSON resources over
streamable HTTP. The hosted endpoint is https://baseball-history-mcp.azurewebsites.net/; point your
MCP client at that URL and it is ready to use. If you prefer to run your own copy, start it with
dotnet run --project baseball-history-mcp (or let the Aspire AppHost host it) and it
listens at http://localhost:5190. Health endpoints are available at /healthz
and /alive on either instance.
- The hosted instance is already connected to the database. A locally run copy requires a
ConnectionStrings:Lahmanvalue at startup; placeholder strings containing<are rejected. - Every tool is read-only; the server never mutates data.
- Start with the
get_server_diagnosticstool or thebaseball-history://server/inforesource to discover the surface before calling domain tools.
Connecting
Point your MCP client at the hosted endpoint https://baseball-history-mcp.azurewebsites.net/. There is
nothing to install, no server process to start, and no connection string or API key to supply.
Claude Desktop / Claude Code
Add the server to your MCP configuration:
{
"mcpServers": {
"baseball-history": {
"type": "http",
"url": "https://baseball-history-mcp.azurewebsites.net/"
}
}
}
VS Code
Add a .vscode/mcp.json file:
{
"servers": {
"baseball-history": {
"type": "http",
"url": "https://baseball-history-mcp.azurewebsites.net/"
}
}
}
Running your own copy instead
To run the server locally, supply a database connection string through the
ConnectionStrings__Lahman environment variable (the .NET double-underscore convention)
or user-secrets, start the server, and swap http://localhost:5190/ into the
url value above. The client never supplies the connection string.
ConnectionStrings__Lahman="Host=your-host;Database=baseball-history;Username=user;Password=secret" \
dotnet run --project /path/to/baseball-history-mcp
Example prompts
Once connected, ask your AI assistant questions like these. It will choose and call the right tool:
| Ask your AI assistant | Tool(s) used |
|---|---|
| “Find players whose last name starts with R” | search_players |
| “Show me Babe Ruth's career stats” | get_player |
| “Career home run leaders since 2000” | get_batting_leaders |
| “Lowest career ERA, minimum 1000 innings” | get_pitching_leaders |
| “Who was inducted into the Hall of Fame in 1999?” | list_hall_of_fame_inductees |
| “Mike Trout's salary history” | get_player_salary_history |
| “How did Derek Jeter hit in the postseason?” | get_player_postseason |
| “What was Connie Mack's managerial record?” | get_manager |
| “Who called Fenway Park home?” | search_parks then get_park |
| “Which 1920s shortstops hit the most home runs?” | search_players |
| “What was Ted Williams' BABIP in 1941?” | get_player_advanced_stats |
| “Who started the 1943 All-Star Game?” | get_all_star_year |
| “Who won the 1943 Negro National League?” | get_negro_league_season |
| “Which players were born today?” | get_this_day |
Tools
Players
- search_players Search players by free-text query or last-name prefix, optionally filtered by
position(P, C, 1B, 2B, 3B, SS, OF, DH) andera(a decade) and sorted bysort(name, hr, hits, games), with paging. - get_player Get read-only detail for one player, including career batting, career pitching, team tenures, career OPS vs. league, All-Star selection years, and whether the player managed.
- get_player_advanced_stats Get season advanced batting (PA, ISO, BABIP, BB%, K%, OPS vs. league, HR/162) and pitching (IP, ERA, WHIP, K/9, BB/9) rates with qualification.
Franchises & Teams
- list_franchises List franchise summaries with optional league, name (
query), anderafilters and bounded paging. - get_franchise Get one franchise with season-by-season history.
- get_team_season Get one exact team-season by team id, league, and year so franchise-era lookups stay deterministic.
Leaderboards
get_batting_leaders
Read batting leaderboards in career or single-season form.
| Parameter | Type | Default | Description |
|---|---|---|---|
stat | string | hr | Stat to rank by: hr, h, r, rbi, sb, 2b, 3b, bb, g, ab, avg, obp, slg, ops |
fromYear | int? | — | Lower year bound |
toYear | int? | — | Upper year bound |
league | string | — | League filter (AL, NL) |
qualified | bool | true | Apply season-relative qualification for rate stats; ignored for counting stats |
minAtBats | int? | — | Explicit minimum at-bats (overrides qualification) |
singleSeason | bool | false | Single-season vs. career totals |
page | int | 1 | 1-based page |
pageSize | int | 50 | Page size (max 100) |
Qualification: When qualified=true (default), rate-stat leaderboards (AVG, OBP, SLG, OPS) require total plate appearances ≥ 3.1 PA per team-game across all stints, with a minimum floor of 100 PA. This season-relative threshold allows players from shorter-season eras (Negro Leagues, 19th century) to qualify naturally. Set qualified=false for all players, or use minAtBats to override.
get_pitching_leaders
Read pitching leaderboards in career or single-season form. ERA, WHIP, and BB9 sort ascending (lower is better); all others descending.
| Parameter | Type | Default | Description |
|---|---|---|---|
stat | string | w | Stat to rank by: w, l, so, sv, cg, sho, ip, g, gs, hr, k9, wpct, era, whip, bb9 |
fromYear | int? | — | Lower year bound |
toYear | int? | — | Upper year bound |
league | string | — | League filter (AL, NL) |
qualified | bool | true | Apply season-relative qualification for rate stats; ignored for counting stats |
minInningsPitched | int? | — | Explicit minimum innings-pitched (overrides qualification) |
singleSeason | bool | false | Single-season vs. career totals |
page | int | 1 | 1-based page |
pageSize | int | 50 | Page size (max 100) |
Qualification: When qualified=true (default), rate-stat leaderboards (ERA, WHIP, K9, BB9, WPCT) require total outs pitched ≥ 3.0 outs per team-game across all stints (equivalent to 1 inning per game), with a minimum floor of 90 outs (30 innings). This season-relative threshold allows pitchers from shorter-season eras to qualify naturally. Set qualified=false for all pitchers, or use minInningsPitched to override.
Hall of Fame
- list_hall_of_fame_inductees List inducted Hall of Fame rows with optional year/category filters and bounded paging.
- get_hall_of_fame_voting_history Get bounded Hall of Fame voting history for one player. Rows are Lahman HallOfFame ballot rows, not a prose biography.
Salaries
- get_player_salary_history Get bounded salary history for one player, ordered most recent to oldest.
- get_salary_leaders List highest salary rows with optional year filter and bounded paging.
Postseason & Fielding
- get_player_postseason Get bounded postseason batting and pitching lines for one player, ordered by year then round.
- get_player_fielding Get season fielding rows plus career-by-position totals for one player.
Ballparks
- search_parks Search ballparks by name, former name, or city; returns park keys for get_park.
- get_park Get one ballpark: location, former names, home-team tenures, and per-season attendance.
Managers
- list_managers List managers with career records, filtered by name and sorted by career wins or name; returns ids for get_manager.
- get_manager Get one manager's career: season records, pennant and World Series flags, and manager awards.
All-Star Games
- list_all_star_years List every All-Star season with game and selection counts and whether the East-West Game was played.
- get_all_star_year Get one season's games and rosters by league or squad, starters first, with Hall of Fame flags.
Negro Leagues
- list_negro_leagues List the seven Negro Leagues recognized as major leagues (1920–1948).
- get_negro_league Get one league's seasons with champions and its clubs' records.
- get_negro_league_season Get one league season's standings and top-five AVG, HR, ERA, and wins leaders.
This Day in Baseball
- get_this_day Get birthdays, debuts, and final games on a calendar day (
dateas MM-DD, ormonth+day), Hall of Famers first.
Diagnostics
- get_server_diagnostics Inspect safe runtime posture, configured limits, and connectivity without exposing secrets.
Resources
Read-only JSON documents the client can fetch to discover the server surface and usage guidance.
| URI | Purpose |
|---|---|
baseball-history://server/info | Server identity, startup requirements, and configured limits. |
baseball-history://server/workflow-guide | Routing for common question types to the right tool or guide. |
baseball-history://server/stats-catalog | Supported batting and pitching stat categories plus the supported year span. |
baseball-history://server/diagnostics | Safe runtime posture, configured limits, and connectivity. |
baseball-history://hall-of-fame/guide | Hall of Fame tool limits, year coverage, and voting-history caveats. |
baseball-history://salary/guide | Salary tool limits, year coverage, and how salary rows are shaped. |
Calling the server from code
Use the official MCP client SDK to connect to the running server over HTTP and call tools directly.
This C# example uses the ModelContextProtocol.Client package:
using ModelContextProtocol.Client;
var transport = new HttpClientTransport(new HttpClientTransportOptions
{
Name = "baseball-history",
Endpoint = new Uri("https://baseball-history-mcp.azurewebsites.net/")
});
await using var client = await McpClientFactory.CreateAsync(transport);
// Discover the available tools
foreach (var tool in await client.ListToolsAsync())
{
Console.WriteLine($"{tool.Name}: {tool.Description}");
}
// Call a tool
var result = await client.CallToolAsync(
"get_batting_leaders",
new Dictionary<string, object?>
{
["stat"] = "hr",
["fromYear"] = 2000,
["singleSeason"] = true,
["pageSize"] = 5
});
Console.WriteLine(result.Content[0].Text);
The same connect → list → call flow is available from the official Python and TypeScript MCP SDKs.
Limits & data notes
- Page sizes are capped: player search 100, franchise list 50, Hall of Fame 50, batting/pitching leaderboards 100, salary leaderboard 50.
- Arguments are validated: names are case-sensitive and must match the tool’s input schema (for example
playerId, notplayer_id), and an unknown name or out-of-range value returns a tool error (isError: true) explaining what to fix. - History is bounded: Hall of Fame voting history returns up to 25 years; salary history up to 40 seasons.
- All data is from the Lahman Baseball Database; the server is read-only.
- Player IDs follow the Lahman convention (e.g.
ruthba01,troutmi01); franchise IDs match Lahman codes (e.g.NYY); team-season lookups use team id, league, and year (e.g.NYA,AL, 1927). - Salary data is available from 1985 onward. Innings pitched is stored as outs and converted to innings (outs / 3).