×

Sign in


OR


By clicking Sign in with Email or Sign in with Google, you agree to our Terms of Use & Privacy Policy.

fangorithm
← Back to blog
How-to

Connect MLB Data to Claude: Live Stats via MCP

You want to ask Claude about today's MLB stats and get a real answer — not a "my training data stopped in..." apology, and not a chat full of pasted box scores.

The fix is to connect MLB data to Claude with a live MCP server, so Claude can pull current-season numbers itself and reason over them. fangorithm is that server: one endpoint, your API key, and Claude can query players, teams, games, standings, and park factors directly. This guide gets you connected in minutes.

Why connect MLB data to Claude?

Large language models don't know last night's box score. Their knowledge is frozen at training time, so anything you ask about the current season is either stale or made up. The usual workarounds — copy-pasting stat tables, scraping a site, or wiring up a brittle custom tool — are slow and break constantly.

The Model Context Protocol (MCP) solves this. It lets Claude call an external data server on demand, mid-conversation. When you connect MLB data to Claude through fangorithm's MCP server, Claude fetches live, current-season figures itself — Aaron Judge's slash line as of today, which parks inflate home runs, who's in tonight's projected lineup — and folds them straight into its answer.

This pays off the moment your question depends on current data. A few things people use it for once it's wired up:

  • DFS research — pull a player's splits and recent form, then have Claude reason about a slate without you tabbing between sites.
  • Prop and totals context — combine a hitter's power numbers with the park factor for tonight's venue to sanity-check an over/under.
  • Fantasy decisions — compare two players' season lines and matchups before setting a lineup or making a waiver claim.

In each case Claude does the fetching; you stay in the conversation.

fangorithm owns the whole stack here: the data pipeline, the freshness, and the endpoint. This isn't a generic "how MCP works" explainer — it's the setup guide for our server. The full reference lives in the fangorithm API docs.

What you'll need — a fangorithm account and API key

You need two things: a fangorithm account and the API key it generates for you.

  1. Create an account. Your key is auto-generated the moment you sign up — head to your fangorithm account page to view and copy it.
  2. Keep the key handy. Every MCP request authenticates with it, passed as an X-API-Key header.

That's the whole prerequisite. (REST callers who'd rather not create an account have a separate pay-per-request option — covered in Pricing and access below. It does not apply to MCP, so for Claude you'll want the key.)

Connect it to Claude — three paths

The MCP endpoint is the same everywhere: POST https://api.fangorithm.com/mcp. It speaks Streamable HTTP with JSON-RPC 2.0, and every path below authenticates with your API key. You point Claude at the fangorithm MCP server endpoint and Claude handles the protocol from there.

Pick the path that matches how you use Claude.

Claude Code

This is the fastest, fully verified path. From your terminal, run:

claude mcp add --transport http fangorithm https://api.fangorithm.com/mcp --header "X-API-Key: YOUR_KEY"

Replace YOUR_KEY with the key from your account page. That's it — start a Claude Code session and the mlb_* tools are available immediately.

claude.ai

In the web app, the data source is added as a custom connector:

  1. Open Settings → Connectors.
  2. Choose Add custom connector.
  3. Enter the MCP URL: https://api.fangorithm.com/mcp.
  4. Authorize. The OAuth flow signs you in through your fangorithm account, which supplies the API key automatically — you don't paste the raw key here.

Note: Verify the exact connector UI labels against the live claude.ai interface before relying on them — Anthropic updates this flow periodically.

Claude Desktop

Claude Desktop mirrors the claude.ai custom-connector flow exactly: open the connector settings, add a custom connector pointing at https://api.fangorithm.com/mcp, and complete the OAuth sign-in through your fangorithm account. The same Note above applies — confirm the current labels in the Desktop UI before treating any button name as fixed.

What you can query — the MLB tool surface

Once connected, Claude can call any of fangorithm's namespaced mlb_* tools. You don't invoke these by name — you ask in plain language and Claude picks the right one. Here's the full surface, grouped by what it covers.

GroupToolsWhat it answers
Playersmlb_list_players, mlb_get_player, mlb_get_player_stats, mlb_get_player_splits, mlb_get_player_game_logsSearch and filter players by team and position, pull a player profile, season stats, splits, and game logs (current season only).
Teamsmlb_list_teams, mlb_get_team, mlb_get_team_roster, mlb_get_team_stats, mlb_get_team_splitsTeam profiles, rosters, season stats, and splits.
Gamesmlb_list_games, mlb_get_game, mlb_get_game_boxscore, mlb_get_game_play_by_playGames for a date, a single game, full boxscores, and play-by-play.
Standingsmlb_list_standingsCurrent division and league standings.
Park factorsmlb_list_park_factors, mlb_get_park_factorPer-venue hitting and pitching adjustments.
Daily matchupsmlb_list_daily_matchupsProbable pitchers, lineups, and projected vs. official status.

A note on mlb_get_player_game_logs: it covers the current season — don't expect multi-year history from it.

Example prompts to try

Once the connector is live, you talk to Claude normally and it does the fetching. Two worked examples:

"What's Aaron Judge's batting line this season?"

Claude calls mlb_get_player_stats and comes back with the current-season line. As of 2026-06-21, that's 59 games, 17 HR, 53 H, 38 RBI, a .248/.375/.533 slash (a .907 OPS), a .385 wOBA, a .285 ISO, a 16.1% walk rate, and a 27.6% strikeout rate. Because the data is live, these update daily — ask again next week and the numbers move with the season.

"Which ballparks inflate home runs the most?"

Claude calls mlb_list_park_factors, where 100 is league average. It can surface hitter-friendly venues like Coors Field (COL), whose 142 HR index (and 135 runs index) makes it a classic home-run park — Daikin Park (HOU) matches it at a 142 HR index, while Busch Stadium (STL) leads on runs at 143. Park factors like Coors Field's 142 HR index are exactly the kind of context Claude can weave into a totals or HR-prop discussion.

"How do Judge's home and away splits compare?"

This is where splits earn their keep. Claude calls mlb_get_player_splits and breaks the season apart. As of 2026-06-21, Judge is mashing at home — .268/.377/.619 for a .996 OPS with 10 of his home runs in Yankee Stadium — versus a more human .225/.374/.432 (.807 OPS) on the road. Ask for the platoon split instead and the same tool shows him at a .955 OPS against left-handers and a .909 OPS against right-handers. Those are the splits that change a start/sit or a prop lean, and Claude can pull them mid-conversation instead of sending you to a stats page.

You can ask follow-ups in the same thread — "now adjust Judge's power for his home park" — and Claude chains the tools together, reading a park factor right after a player split without you re-framing the question.

Pricing and access

There are two separate ways to pay for fangorithm data. Keep them straight, because only one works with Claude.

Account API key (this is what MCP uses). Sign up and you get a key with a free tier; upgrade for more headroom:

TierRate limit
Free3 requests/min
Member100 requests/min

x402 pay-per-request (REST only). fangorithm also supports x402, where you pay per call in USDC with no account required. This is for direct REST API calls only — it is not available through MCP. Every MCP connection, including Claude, authenticates with an account API key. So if your goal is Claude, the account key is the path; x402 is for scripted REST clients hitting the API directly.

Troubleshooting and next steps

A few things that trip people up:

  • 401 Unauthorized. Your X-API-Key header is missing or invalid. Re-copy the key from your account page and check the header name.
  • Rate-limited. The free tier is 3 requests/min. A chatty Claude session that fans out across many tools can hit that ceiling — upgrade to Member (100/min) if you're querying heavily.
  • Only seeing this season. mlb_get_player_game_logs is current-season by design. It's not a bug — historical logs aren't exposed through this tool.
  • Connector doesn't appear after adding it. In claude.ai or Desktop, make sure you finished the OAuth authorization step — an added-but-unauthorized connector won't expose its tools. Removing and re-adding it usually clears a half-finished sign-in.
  • mlb_* tools aren't showing in the session. In Claude Code, confirm the server registered with claude mcp list; if it's missing, re-run the add command and check the URL and header are exactly right.
  • Numbers look a few hours stale. The feed refreshes on a schedule, so a line can trail a just-finished game briefly. Ask again shortly after and it'll catch up — it's a sync cadence, not a connection problem.

For the full schema, grab the OpenAPI 3.1 contract. If you're pointing another agent at the API, the plain-text overview for LLMs is the fastest way to give it context.

Ready to ask Claude about live MLB stats? Create an account and copy your key from the fangorithm account page — you'll be connected in minutes.

Prefer not to wire up Claude at all? You can build a ranking formula in the dashboard and work with the same data right inside fangorithm.