Sports Mcp Server

io.github.cyanheads由 GitHub 帳號 cyanheads 發布v0.6.0更新於 Oct 30, 2026

Get live scores, schedules, standings, team and player data for NFL, NBA, MLB, NHL, and soccer.

已驗證STDIO僅桌面位置與生活資料與分析

概覽

AI 產生的概覽

讓助理取得 NFL、NBA、MLB、NHL、足球及大學賽事的即時與歷史比分、賽程、排名、球隊與球員資料。

可以做什麼
  • 依聯盟與日期查詢即時及最終比分,可依球隊篩選
  • 取得球隊或聯盟的賽程與對戰組合,以及排名與積分表
  • 查看單場詳情:各節比分、球隊總計、最佳球員與得分過程
  • 將球隊名稱解析為帶有跨資料來源 ID 的標準記錄,並取得球隊資訊、名單、近期戰績與後續賽程
  • 解析並讀取球員資料,包括球隊、位置、國籍、出生日期與身體數據
適用情境
適合希望助理直接回答體育問題——今日比分、球隊後續比賽、排名比較或球員背景——而不必自行串接多個體育資料介面的情境。
執行需求
以 npm 套件形式透過 npx 在本機執行(Node.js;README 中原始碼建置需 Node.js v24+)。不需 API 金鑰;選用的 THESPORTSDB_API_KEY 可擴大搜尋範圍。需要連線至 ESPN、MLB StatsAPI 與 TheSportsDB 的網路。HTTP 傳輸與驗證等選用設定透過環境變數配置。
安裝前請注意
僅做唯讀查詢,但資料來自第三方(ESPN、MLB StatsAPI、TheSportsDB),查詢內容與球隊、球員名稱會傳送給這些服務。預設的 TheSportsDB 免費金鑰會把搜尋限制為一筆記錄,結果可能不完整。選用的失敗工具負載記錄(LOG_TOOL_FAILURE_PAYLOADS)可能記錄未去識別化的自由文字參數。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Sports Mcp Server,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

@cyanheads/sports-mcp-server

Get live scores, schedules, standings, team and player data for NFL, NBA, MLB, NHL, soccer, and more via MCP. STDIO or Streamable HTTP.

8 Tools


Overview

Live and historical sports data from ESPN, MLB StatsAPI, and TheSportsDB. Check scores, schedules, and standings, and look up teams and players across the NFL, NBA, MLB, NHL, major soccer leagues, and college football and basketball.

Tools

ToolDescription
sports_find_teamResolve a team name or partial name to canonical records and source IDs across providers.
sports_find_playerResolve a player name to canonical TheSportsDB records with ID, team, position, and bio fields.
sports_get_scoresLive and final scores for a league on a given date, optionally filtered by team.
sports_get_gameGame metadata, period scores, team totals, provider top performers, and paged scoring plays.
sports_get_scheduleUpcoming and past fixtures for a team or league over a date range.
sports_get_standingsCurrent standings or league table for a league and season.
sports_get_teamTeam detail combining metadata, roster, recent results, and upcoming fixtures.
sports_get_playerPlayer details from TheSportsDB — biography, team, position, and physical stats.

Agent skill

The sports-guide covers complete fixture ranges, game recaps, standings comparisons, and player identity checks. It ships with plugin installs, npm, Docker, and the desktop bundle, and is available to MCP clients as a skill resource.

Capability reference

sports_find_team tool

  • Free-text query (max 200 characters) with an optional league filter
  • Returns team metadata with espnId/mlbId/tsdbId cross-references merged across providers; totalFound counts returned records
  • Failed ESPN/MLB lookups appear in unavailableSources; no results returns no_match, or sources_unavailable if a source failed. The free TheSportsDB key can return incomplete results

sports_find_player tool

  • Free-text query (max 200 characters); optional sport is advisory and does not filter
  • Returns player IDs, name, team, position, nationality, birth date, and thumbnail; no_match when none is found
  • The default key 123 limits searches to one record

sports_get_scores tool

  • league required; date (YYYY-MM-DD) defaults to today in US Eastern time; optional team_name filters games
  • Returns home/away teams, score, status, period or clock, and UTC start time. Empty results carry reason, emptyReason (no_games or no_team_matches), and notice
  • limit defaults to 100 (max 200) and offset to 0; responses include availableGames, totalReturned, effectiveLimit, offset, truncated, and nextOffset

sports_get_schedule tool

  • league required; optional team_name, date_from/date_to, limit (default 100, max 200), and offset (default 0). A single date bound requests that day; reversed dates fail
  • Returns home/away teams and scores, status, UTC start time, venue, and source. A partial team_name must identify one team: ambiguous_team lists candidates, team_not_found means no match
  • Dated requests cover at most seven days. Responses include requestedDateFrom/requestedDateTo, servedDateFrom/servedDateTo, availableGames, effectiveLimit, offset, and truncated; follow nextOffset, then nextDateFrom as date_from

sports_get_game tool

  • Required league and source-prefixed numeric game_id from scores, schedules, or team detail; mlb: IDs require league: "mlb"
  • Returns game metadata plus periodScores, teamStats, leaders, and scoringPlays; missing values are null. Scheduled games return metadata only; game_not_found for a missing or wrong-league game. Athlete IDs belong to ESPN or MLB, not TheSportsDB
  • limit defaults to 20 (max 50) and offset to 0; responses include totalCount, returnedCount, servedFrom/servedTo, effectiveLimit, and nextOffset

sports_get_standings tool

  • league required; optional season (4-digit year), current season if omitted
  • Returns rank, group (conference, table, or MLB division), wins, losses, ties, NHL overtime losses, points, winning percentage, division rank, streak, and games behind; inapplicable values are null. season_not_found when the season has no data
  • limit defaults to 100 (max 200) and offset to 0; responses include availableStandings, totalReturned, effectiveLimit, offset, truncated, and nextOffset. If the MLB team lookup fails, unavailableSources lists standings_team_metadata

sports_get_team tool

  • league and team_name required; exact names or abbreviations win, otherwise a partial name must identify one team (ambiguous_team lists candidates, team_not_found means no match)
  • Returns metadata, active roster, the latest 5 completed results, and the next 3 scheduled fixtures
  • NFL rosters exclude injured-reserve/out, suspended, and practice-squad players; missing jerseys and venues are null

sports_get_player tool

  • player_id accepts a tsdb:-prefixed ID (from sports_find_player) or a raw numeric TheSportsDB ID
  • Returns biography, team, position, nationality, birth date, height, weight, and thumbnail; player_not_found when the ID doesn't resolve
  • espnId is filled when TheSportsDB supplies one, otherwise null

Features

Built on @cyanheads/mcp-ts-core: stdio and Streamable HTTP transports, pluggable auth (none / jwt / oauth), swappable storage (in-memory, filesystem, Supabase, Cloudflare KV/R2/D1), structured logging with optional OpenTelemetry tracing.

Sports-specific:

  • Three keyless sources — ESPN site API, MLB StatsAPI, and TheSportsDB (free tier key 123)
  • League routing sends each query to the best source per sport
  • Normalized output types across sources — NormalizedGame, NormalizedTeam, NormalizedPlayer, NormalizedStanding
  • Cross-source team IDs merged onto one record by sports_find_team
  • Off-season queries return a notice (standings) or games: [] with a reason (scoreboards) instead of an error

Agent-friendly output:

  • Source provenance on every record — source: 'espn' | 'mlbstats' | 'thesportsdb'
  • Typed error reasons (no_match, sources_unavailable, team_not_found, ambiguous_team, player_not_found, season_not_found, game_not_found, incompatible_game_source), each with a recovery hint
  • Typed empty-result notices and pagination or schedule-window metadata on every response
  • Provider text is escaped and treated as data, never instructions

Getting started

Add it to Claude Code:

sh
claude mcp add sports-mcp-server -- npx -y @cyanheads/sports-mcp-server

For other clients, add this to the MCP config file:

json
{  "mcpServers": {    "sports-mcp-server": {      "command": "npx",      "args": ["-y", "@cyanheads/sports-mcp-server"]    }  }}

No API keys are required. THESPORTSDB_API_KEY optionally enables a premium key for broader player and team searches; the default free key returns at most one record. For Docker or a source build, see Running the server.

Configuration

VariableDescriptionDefault
THESPORTSDB_API_KEYTheSportsDB API key. The free key limits searches to one record.123
MCP_TRANSPORT_TYPETransport: stdio or http.stdio
MCP_HTTP_PORTPort for HTTP server.3010
MCP_SESSION_MODEHTTP session mode: stateful, stateless, or auto.stateless
MCP_AUTH_MODEAuth mode: none, jwt, or oauth.none
MCP_LOG_LEVELLog level (RFC 5424).info
LOGS_DIRDirectory for log files (Node.js only).<project-root>/logs
LOG_TOOL_FAILURE_PAYLOADSLog failed tool arguments and results, redacted by key name and capped by LOG_TOOL_FAILURE_PAYLOAD_MAX_BYTES (default 16384). Free-form values are not redacted.false
OTEL_ENABLEDEnable OpenTelemetry instrumentation.false
OTEL_EXPORTER_OTLP_ENDPOINTBase OTLP/HTTP URL for traces and metrics.Unset
OTEL_EXPORTER_OTLP_LOGS_ENDPOINTOTLP log endpoint.Unset

See .env.example for the full list of optional overrides.

Running the server

Local development

Requires Bun v1.4.0 or higher and Node.js v24+.

sh
git clone https://github.com/cyanheads/sports-mcp-server.gitcd sports-mcp-server && bun installcp .env.example .env# All overrides are optional.

Serving commands execute Node, including when launched with bun run. Bun handles dependency resolution and build tooling; ESPN requests run under Node.

  • Build and run:

    sh
    # One-time buildbun run rebuild
    # Run the built serverbun run start:stdio# orbun run start:http
  • Run checks and tests:

    sh
    bun run devcheck   # Lint, format, typecheck, securitybun run test       # Vitest test suitebun run lint:mcp   # Validate MCP definitions against spec

Docker

sh
docker run --rm -p 3010:3010 ghcr.io/cyanheads/sports-mcp-server:latest

The image builds with Bun, runs the production server under Node, defaults to HTTP transport and stateless session mode, and logs to /var/log/sports-mcp-server. For stdio, use docker run -i --rm -e MCP_TRANSPORT_TYPE=stdio ghcr.io/cyanheads/sports-mcp-server:latest. To build locally, use docker build -t sports-mcp-server .; OpenTelemetry peer dependencies are installed by default — build with --build-arg OTEL_ENABLED=false to omit them.

Project structure

DirectoryPurpose
src/index.tscreateApp() entry point — registers tools and inits services.
src/configServer-specific environment variable parsing (THESPORTSDB_API_KEY).
src/services/types.tsNormalized cross-source types and league routing table.
src/services/espnESPN site API service — scores, schedules, standings, teams.
src/services/mlbMLB StatsAPI service — scores, schedules, standings, rosters.
src/services/thesportsdbTheSportsDB service — player and team search/metadata.
src/mcp-server/toolsTool definitions (*.tool.ts).
tests/Unit and integration tests mirroring src/.
docs/Design doc and directory tree.

Development guide

See CLAUDE.md/AGENTS.md for development guidelines and architectural rules. The short version:

  • Handlers throw, framework catches — no try/catch in tool logic
  • Use ctx.log for request-scoped logging, ctx.state for tenant-scoped storage
  • Register new tools via the barrel in src/mcp-server/tools/definitions/index.ts
  • Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields

Contributing

Issues are welcome. Run checks and tests before submitting:

sh
bun run devcheckbun run test

License

Apache-2.0 — see LICENSE for details.

來源:README.md,提交 0ceced9

工具

8

sports_get_scores

Sports Get Scores

Live and final scores for a league on a given provider-calendar date, optionally filtered by team name. Returns teams, scores, status, period or clock, and UTC start. Pages default to 100 games, capped at 200; continue with nextOffset and the same filters, or use sports_get_schedule for date windows. Omitted dates use today's US Eastern calendar day. NCAAB covers men's Division I; NCAAF covers FBS.

輸入參數datelimitleague必填offsetteam_name

sports_get_game

Sports Get Game

Game metadata, period scores, team totals, provider top performers, and scoring plays. Pass a game ID returned by sports_get_scores, sports_get_schedule, or sports_get_team with its league; ESPN IDs do not identify a league. Scheduled games return metadata with empty played-stat sections. Scoring plays default to 20 per page, capped at 50; continue with nextOffset and the same league and game_id. Other sections remain on every page. No full player boxscores or season statistics.

輸入參數limitleague必填offsetgame_id必填

sports_get_schedule

Sports Get Schedule

Upcoming and past fixtures for a team or league, with provider-calendar date windows of up to seven days and paged games. No dates uses the provider default slate, or the current season for an ESPN team (MLB teams: 14 days back to 30 ahead). NCAAB covers men’s Division I; NCAAF scoreboards cover FBS. Returns opponents, UTC start, venue, and available results.

輸入參數limitleague必填offsetdate_todate_fromteam_name

sports_get_standings

Sports Get Standings

Current standings or league table for a league. Returns team rank, W/L record (or points for soccer/NHL), division or conference, streak, and games behind. Omit season for the current year. NHL standings use points; soccer uses points-based league tables. Pages default to 100 rows, capped at 200; continue with nextOffset and the same league and season. Provider ranks preserve ties and are null when unavailable.

輸入參數limitleague必填offsetseason

sports_find_team

Sports Find Team

Resolve a team name or partial name to canonical records and source IDs across providers, optionally scoped to a league. Returns full name, league, logo URL, venue, and ESPN, MLB, and TheSportsDB IDs.

輸入參數query必填league

sports_get_team

Sports Get Team

Team metadata, venue, active roster, latest five completed results, and next three scheduled fixtures. ESPN games cover its current provider season across phases and soccer results/fixtures; MLB uses a 30-day history and lookahead. NCAAB is men’s Division I; college football lookup uses ESPN’s team inventory.

輸入參數league必填team_name必填

sports_find_player

Sports Find Player

Resolve a player name to canonical TheSportsDB records with player ID, full name, current team, position, nationality, birth date, and thumbnail URL.

輸入參數query必填sport

sports_get_player

Sports Get Player

Player details from TheSportsDB, including biography, current team, position, nationality, birth date, height, weight, and thumbnail.

輸入參數player_id必填

版本歷史

6
  1. v0.6.0最新Oct 30, 2026
  2. v0.5.0Oct 18, 2026
  3. v0.4.0Oct 13, 2026
  4. v0.2.3Sep 30, 2026
  5. v0.2.2Sep 22, 2026
  6. v0.2.1Sep 16, 2026

評分

已滿足適用檢查項的 90%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分
  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具必需15 分
  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分