CLI & MCP Server
CLI & MCP Server
SportsStack publishes @sportsstack/mcp-server — a combined CLI and MCP (Model Context Protocol) server that gives both humans and AI agents access to live sports data. One package, two interfaces.
| Mode | For | How |
|---|---|---|
| CLI | Humans, scripts, CI pipelines | sportsstack schedule --league NFL |
| MCP | AI agents (Claude, Cursor, Windsurf, Gemini) | Connect as MCP server over STDIO |
Both modes use the same 19 tools, same authentication, and same API.
Quick Start — CLI
# No install needed
npx -y @sportsstack/mcp-server --cli schedule --league NBA
# Or install globally
npm install -g @sportsstack/mcp-server
sportsstack schedule --league NBA --date 2026-02-25Output is JSON by default. Add --summary for human-readable text:
sportsstack schedule --league NFL --summaryList all commands:
sportsstack --helpDescribe a specific command (machine-readable, useful for agents):
sportsstack describe scheduleQuick Start — MCP
npx -y @sportsstack/mcp-serverNo build step, no cloning — one command installs and runs the MCP server on STDIO.
Setup by Client
Claude Desktop / Claude Code
Add to your MCP settings (~/.claude/settings/claude_desktop_config.json or the app's settings UI):
{
"mcpServers": {
"sportsstack": {
"command": "npx",
"args": ["-y", "@sportsstack/mcp-server"],
"env": {
"SPORTSSTACK_API_KEY": "YOUR_API_KEY"
}
}
}
}Restart Claude, then ask: "What NFL games are on this week?"
Cursor
Add to .cursor/mcp.json in your project root (or global Cursor settings):
{
"mcpServers": {
"sportsstack": {
"command": "npx",
"args": ["-y", "@sportsstack/mcp-server"],
"env": {
"SPORTSSTACK_API_KEY": "YOUR_API_KEY"
}
}
}
}Windsurf
Add to your Windsurf MCP configuration:
{
"mcpServers": {
"sportsstack": {
"command": "npx",
"args": ["-y", "@sportsstack/mcp-server"],
"env": {
"SPORTSSTACK_API_KEY": "YOUR_API_KEY"
}
}
}
}Gemini CLI
SPORTSSTACK_API_KEY=YOUR_API_KEY npx -y @sportsstack/mcp-serverAny MCP-Compatible Client
The server uses STDIO transport (JSON-RPC 2.0 over stdin/stdout), which is supported by all MCP clients. Point your client at npx -y @sportsstack/mcp-server with the SPORTSSTACK_API_KEY environment variable.
Authentication
Set the SPORTSSTACK_API_KEY environment variable to your API key.
| Key state | Behavior |
|---|---|
| Valid key | Full access at your plan's rate limits |
| Invalid key | Server starts; tools return an auth error |
| No key set | Free trial mode — 100 requests/hour |
For CLI: export SPORTSSTACK_API_KEY=your-key or pass inline (SPORTSSTACK_API_KEY=key sportsstack ...).
Get an API key from Dashboard → Settings → API Keys, or see the Authentication guide.
Available Tools
Every tool is available as both an MCP tool (for agents) and a CLI command (for humans).
Discovery
| Tool | CLI | What it does |
|---|---|---|
get_sports_list | sports | List all sports and their leagues |
lookup_data_dictionary | dictionary | Schema metadata lookup |
Scores & Schedule
| Tool | CLI | What it does |
|---|---|---|
get_schedule | schedule | Upcoming or past games — filter by league, team, date, week |
get_live_scores | scores | Real-time scores for games in progress |
get_event_details | event | Full details for a specific game (venue, teams, score, optionally stats and odds) |
get_game_card | game-card | Game card with enhanced data |
Standings & Stats
| Tool | CLI | What it does |
|---|---|---|
get_standings | standings | League standings with W/L/PCT — filter by conference, division |
get_player_stats | stats | Season averages, season totals, or game log for a player |
Teams & Players
| Tool | CLI | What it does |
|---|---|---|
search_teams | search-teams | Fuzzy search by name, city, or abbreviation |
search_players | search-players | Fuzzy search with nickname support ("LBJ" → LeBron James) |
get_team_roster | roster | Full roster for a team |
Betting & Injuries
| Tool | CLI | What it does |
|---|---|---|
get_betting_odds | odds | Multi-sportsbook odds for a game (moneyline, spread, totals) |
get_injuries | injuries | Injury reports with cross-provider validation |
get_futures | futures | Futures and props markets |
get_slate | slate | DFS slates |
Entity Mappings & ID Translation
Cross-reference entity IDs across data providers (SportRadar, ESPN, SportsDataIO, OddsBlaze, etc.).
| Tool | CLI | What it does |
|---|---|---|
get_mappings | mappings | Query entity identity mappings — filter by type, league, provider, source ID |
search_entity_ids | id-search | Search mappings by source ID substring |
translate_entity_id | id-translate | Translate a common_model_id between providers |
resolve_entity_id | id-resolve | Resolve a common_model_id to all provider mappings |
Note:
id-search,id-translate, andid-resolverequire theid_explorerfeature flag to be enabled for your API key.mappingsis always available.
Mapping CLI Examples
# Find all ESPN mappings for NBA events
sportsstack mappings --entity-type event --league NBA --integration espn
# See all provider IDs for a single entity
sportsstack mappings --common-model-id <uuid> --include-all-mappings
# Search by source ID
sportsstack id-search --query "sr:sport_event:62925271"
# Translate: given a common_model_id, find the ESPN source ID
sportsstack id-translate --entity-id <uuid> --from-provider sportradar --to-provider espn
# Resolve: see every provider mapping for an entity
sportsstack id-resolve --entity-id <uuid>Mapping Workflow
The translate and resolve tools operate on common_model_id (the canonical SportsStack UUID), not provider source IDs. Typical workflow:
- Find the entity — use
mappingsorid-searchto locate a mapping by source ID - Get the common_model_id — from the mapping result
- Translate or resolve — use
id-translateorid-resolvewith the common_model_id
Or ask your AI agent: "What's the ESPN ID for SportRadar event sr:sport_event:62925271?" — it chains the calls for you.
Example Conversations
MCP (AI Agent)
Once connected, try asking your AI agent:
| Prompt | Tool(s) used |
|---|---|
| "What NFL games are on Sunday?" | get_schedule |
| "Show me the NBA standings" | get_standings |
| "How is Patrick Mahomes doing this season?" | search_players → get_player_stats |
| "Who's on the Lakers roster?" | get_team_roster |
| "What are the odds for the Chiefs game?" | get_schedule → get_betting_odds |
| "Any injured players on the 49ers?" | get_injuries |
| "Find me a team called the Giants" | search_teams |
| "Give me the box score for last night's game" | get_schedule → get_event_details |
| "What's the ESPN ID for this SportRadar event?" | get_mappings → id-translate |
| "Show all provider mappings for NBA games today" | get_schedule → get_mappings |
CLI (Human)
# Multi-step workflow in the shell
EVENT_ID=$(sportsstack schedule --league NBA --date 2026-02-25 | jq -r '.data[0].common_model_id')
sportsstack odds --event $EVENT_ID
sportsstack mappings --common-model-id $EVENT_ID --include-all-mappingsFuzzy Name Resolution
You don't need IDs to query — the MCP server and CLI accept human-readable names and resolve them automatically:
- League names: "NFL", "nfl", "National Football League" all work
- Team names: "Chiefs", "KC", "Kansas City" all resolve to the same team
- Player names: "LeBron", "LBJ", "King James" all find LeBron James
- Nicknames: "Niners" → 49ers, "Pats" → Patriots, "ManU" → Manchester United
When a name is ambiguous (e.g., "Giants" matches both NFL and MLB), the server returns candidates and asks for clarification.
Supported Leagues
Use get_sports_list / sportsstack sports to see the full list. Major leagues include:
- Football: NFL, NCAAF
- Basketball: NBA, NCAAB, WNBA
- Baseball: MLB
- Hockey: NHL
- Soccer: EPL, MLS, Champions League
- Golf: PGA Tour
Rate Limits
The same rate limits apply as the REST API. Rate limit headers are tracked automatically — the server backs off when limits are approached.
| Tier | Requests/hour |
|---|---|
| Free trial (no key) | 100 |
| Foundation | 10,000 |
| Standard | 50,000 |
| Enterprise | 200,000 |
Architecture
CLI: [Terminal] → sportsstack <command> → [Tool Handler] → HTTPS → [SportsStack REST API]
MCP: [AI Agent] → JSON-RPC (STDIO) → [MCP Server] → [Tool Handler] → HTTPS → [SportsStack REST API]
The CLI and MCP server share the same tool handlers. The MCP server adds a thin JSON-RPC 2.0 transport layer; the CLI adds argument parsing and stdout output.
No data is stored locally. All data comes from the live SportsStack API.
Discovery Endpoints
SportsStack also exposes machine-readable discovery files for LLM agents that connect directly to the API:
- /mcp.json — MCP discovery document listing all API resources
- /.well-known/mcp.json — Standard MCP discovery location
- /llms.txt — Human-readable instructions for LLM agents
- /openapi — Full OpenAPI 3.0 specification
Requirements
- Node.js 18 or later
- npm (included with Node.js)
Troubleshooting
Server won't start: Make sure Node.js 18+ is installed (node --version).
Auth errors: Check that SPORTSSTACK_API_KEY is set correctly. For MCP: check the env block in your client config. For CLI: echo $SPORTSSTACK_API_KEY.
No results: Most tools require a league parameter. Try specifying the league explicitly (e.g., --league NBA).
ID Explorer returns 403: The id_explorer feature flag must be enabled for your API key. Contact support to enable it.
Rate limited: The server automatically retries on rate limits with exponential backoff. If you're hitting limits frequently, consider upgrading your plan.
Next Steps
- Getting Started — REST API quickstart
- Authentication — API keys and security
- API Usage Guide — Deep dive into the data model
- Coverage Matrix — Full sport and league coverage
Updated 16 days ago
