MCP server

Sports Analytics MCP for Claude Code: Setup and Prompts

Claude Code can pull sports data through one command: claude mcp add --transport http sportsdatahq https://mcp.sportsdatahq.com/mcp --header "x-api-key: YOUR_API_KEY". That connects nine sports with play-by-play, box scores, ratings and odds history, so Claude can fetch the numbers and write the analysis in your repo. 1,000 free credits a month.

Why use it from Claude Code

Most sports analysis ends up as code: a notebook, a script, a chart, a small app. Claude Code works in that loop already. It reads your files, runs commands and edits. The missing piece is data it can trust and cite. Without a connector, an agent either guesses from memory or scrapes pages, and both go wrong on details like a trade, a postseason game or a rating from three seasons ago.

With the server connected, Claude calls a tool, gets structured rows with stable ids and writes the result to disk. A typical session looks like this: ask for the league's home run leaders, have Claude save the rows to a CSV, then have it write a plotting script. The numbers in the chart came from a tool call you can see in the transcript.

The server is hosted and read-only. Nothing runs on your machine, and no tool writes, places or changes anything.

Connect it

You need a free key from app.sportsdatahq.com. Command-line clients send it in an x-api-key header.

claude mcp add --transport http sportsdatahq https://mcp.sportsdatahq.com/mcp --header "x-api-key: YOUR_API_KEY"

Run /mcp inside Claude Code to confirm the server shows as connected. If you leave the header off, /mcp walks you through an OAuth sign-in instead, which keeps the key out of your shell history.

One sport instead of all nine

Each sport has its own route with its tools listed directly:

claude mcp add --transport http sportsdatahq-nba https://mcp.sportsdatahq.com/mcp/nba --header "x-api-key: YOUR_API_KEY"

Routes exist for nba, nfl, nhl, mlb, soccer, mma, tennis, golf and cricket. A sport route has 12 to 33 tools; the hub root has four discovery tools instead. Use the root when you move between sports and a sport route when you stay in one, so the tool list in context stays short.

Share it with a team

Claude Code can store a server for just you, for one project, or for a shared project file. For a shared .mcp.json, keep the key out of the file and read it from the environment:

{
  "mcpServers": {
    "sportsdatahq": {
      "type": "http",
      "url": "https://mcp.sportsdatahq.com/mcp",
      "headers": { "x-api-key": "${SDHQ_API_KEY}" }
    }
  }
}

Each teammate exports SDHQ_API_KEY from their own free account.

Brand servers

Each brand runs its own server at https://mcp.<brand>.com/mcp with a single-sport key and 500 free credits a month, for example FastballAPI for baseball at https://mcp.fastballapi.com/mcp. The config shape is the same.

How the hub tools work

The root route is built so a large catalog does not flood the context window.

ToolWhat it doesCredits
list_sportsEvery sport, its leagues, its tool count and its route0
find_toolSearch tools by plain words, with credits and a one-line summary0
describe_toolThe full description and input schema for one tool0
run_toolCall a tool by sport, name and argumentsthe tool's price

A prompt such as "who led the league in home runs" makes Claude call find_tool, then describe_tool, then run_tool with sport: "mlb", tool: "get_leaders" and the arguments. You see each step in the transcript.

Example prompts and the tools they call

PromptTools calledCredits
Pull the 2026 home run leaders and save them to leaders.csv.find_tool, run_tool (get_leaders)5
Chart each MLB team's run differential against its Pythagorean win percentage.run_tool (get_standings)2
Get one pitcher's pitch mix and write a script that plots velocity by pitch type.run_tool (search_players, get_pitch_mix)1 + 5
Fetch last season's NBA standings and Elo ratings and check which teams the ratings liked more than the standings did.run_tool (get_standings, get_ratings)2 + 2
Build a shot chart for one NBA team from the playoff games, with expected points per zone.run_tool (get_shot_chart)10
For one game, show how the spread and total moved hour by hour, then plot it.run_tool (get_line_movement)10
Write a test that checks our standings loader against the live standings tool.run_tool (get_standings)2
Which datasets are stale right now?run_tool (get_data_status)1

For repeated work, tell Claude to save raw responses under a data/ folder and read from there. A second question about the same game then costs nothing.

Credit costs

CreditsExamples
0list_sports, find_tool, describe_tool, connecting, tools/list
1list_teams, search_players, get_data_status
2get_standings, get_schedule, get_ratings, get_injuries
5get_game, get_leaders, get_player, get_pitch_mix, get_odds (one game)
10get_plate_appearances, get_plays, get_shot_chart, get_line_movement, get_player_props, get_prop_history
25get_prop_backtest, and get_line_movement in football and hockey

Many tools accept estimate_only, which prices a call without charging for it. Tell Claude to estimate before any call that could loop, such as a prop history across a whole roster.

Verified examples you can run now

Export your key as KEY first. Each of these was run against the live server on December 6, 2026 and returned HTTP 200.

The tools Claude Code sees at the hub root, which costs nothing:

curl -s -X POST https://mcp.sportsdatahq.com/mcp \
  -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"}'

It lists four tools: list_sports, find_tool, describe_tool and run_tool.

Find a tool by plain words (free):

curl -s -X POST https://mcp.sportsdatahq.com/mcp \
  -H "x-api-key: $KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":3,"method":"tools/call","params":{"name":"find_tool","arguments":{"query":"mlb pitch mix"}}}'

The first match was get_pitch_mix in baseball at 5 credits.

Run a tool through the hub (2 credits):

curl -s -X POST https://mcp.sportsdatahq.com/mcp \
  -H "x-api-key: $KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{"jsonrpc":"2.0","id":4,"method":"tools/call","params":{"name":"run_tool","arguments":{"sport":"mlb","tool":"get_standings","arguments":{"season":2026}}}}'

The same data over plain REST, for scripts Claude writes into your repo (2 credits):

curl -s -X POST https://api.sportsdatahq.com/v1/mlb/get_standings \
  -H "x-api-key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{"season": 2026}'

The first row was Milwaukee at 103 wins and 59 losses with a run differential of +214.

When not to use this

Related pages

Per-sport setup: NBA, NFL, NHL, MLB and soccer. For odds history see the historical odds MCP server, and for editors see Cursor setup. The free skills add ready-made prompts for previews and line movement.

Try it

FAQ

How do I add a sports data MCP server to Claude Code?

Run claude mcp add --transport http sportsdatahq https://mcp.sportsdatahq.com/mcp --header "x-api-key: YOUR_API_KEY". Then run /mcp inside Claude Code to confirm it shows as connected. Connecting and listing tools cost no credits.

Should I add the whole hub or one sport?

The hub root exposes four discovery tools that reach all nine sports, which keeps the tool list small. A sport route such as /mcp/nba lists that sport's tools directly, 31 for basketball, so Claude can call them by name. Add one route per sport you use often.

How do I keep my key out of the repo?

Use claude mcp add with the user scope, which stores the server in your own Claude Code config instead of a shared project file. If you commit a .mcp.json, reference the key through an environment variable and keep the value in your shell profile.

How many credits does a session use?

Connecting, listing tools and the discovery tools are free. Data calls cost 1 to 25 credits each: ids and standings are 1 to 2, box scores and leaders are 5, and play-by-play and odds history are 10 or more. The free plan's 1,000 credits cover a few hundred typical questions.

Get a free key

Checked against the live API on 2026-12-06. Questions: hello@sportsdatahq.com.