{
  "markdown": "<div align=\"center\">\n  <h1>@cyanheads/sports-mcp-server</h1>\n  <p><b>Get live scores, schedules, standings, team and player data for NFL, NBA, MLB, NHL, soccer, and more via MCP. STDIO or Streamable HTTP.</b>\n  <div>7 Tools</div>\n  </p>\n</div>\n\n<div align=\"center\">\n\n[![Version](https://img.shields.io/badge/Version-0.2.1-blue.svg?style=flat-square)](./CHANGELOG.md) [![License](https://img.shields.io/badge/License-Apache%202.0-orange.svg?style=flat-square)](./LICENSE) [![Docker](https://img.shields.io/badge/Docker-ghcr.io-2496ED?style=flat-square&logo=docker&logoColor=white)](https://github.com/users/cyanheads/packages/container/package/sports-mcp-server) [![MCP SDK](https://img.shields.io/badge/MCP%20SDK-^2.0.0-green.svg?style=flat-square)](https://modelcontextprotocol.io/) [![npm](https://img.shields.io/npm/v/@cyanheads/sports-mcp-server?style=flat-square&logo=npm&logoColor=white)](https://www.npmjs.com/package/@cyanheads/sports-mcp-server) [![TypeScript](https://img.shields.io/badge/TypeScript-^7.0.2-3178C6.svg?style=flat-square)](https://www.typescriptlang.org/) [![Bun](https://img.shields.io/badge/Bun-v1.3.0%2B-blueviolet.svg?style=flat-square)](https://bun.sh/)\n\n</div>\n\n<div align=\"center\">\n\n[![Install in Claude Desktop](https://img.shields.io/badge/Install_in-Claude_Desktop-D97757?style=for-the-badge&logo=anthropic&logoColor=white)](https://github.com/cyanheads/sports-mcp-server/releases/latest/download/sports-mcp-server.mcpb) [![Install in Cursor](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/en/install-mcp?name=sports-mcp-server&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyIteSIsIkBjeWFuaGVhZHMvc3BvcnRzLW1jcC1zZXJ2ZXIiXX0=) [![Install in VS Code](https://img.shields.io/badge/VS_Code-Install_Server-0098FF?style=for-the-badge&logo=visualstudiocode&logoColor=white)](https://vscode.dev/redirect?url=vscode:mcp/install?%7B%22name%22%3A%22sports-mcp-server%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22-y%22%2C%22%40cyanheads%2Fsports-mcp-server%22%5D%7D)\n\n[![Framework](https://img.shields.io/badge/Built%20on-@cyanheads/mcp--ts--core-67E8F9?style=flat-square)](https://www.npmjs.com/package/@cyanheads/mcp-ts-core)\n\n</div>\n\n---\n\n## Tools\n\nSeven tools organized around what an agent needs — find a team or player, get today's scores, check the schedule, read the standings, or pull full team or player detail:\n\n| Tool | Description |\n|:-----|:------------|\n| `sports_find_team` | Resolve a team name or partial name to its canonical record and source IDs. Use before any team-scoped query. |\n| `sports_find_player` | Resolve a player name to their canonical record via TheSportsDB. Disambiguation step before player-scoped queries. |\n| `sports_get_scores` | Live and final scores for a league on a given date, optionally scoped to a specific team. |\n| `sports_get_schedule` | Upcoming and past fixtures for a team or league over a date range. |\n| `sports_get_standings` | Current standings or league table for a league and season. |\n| `sports_get_team` | Team detail: active roster, last 5 results, next 3 fixtures, venue, and metadata. |\n| `sports_get_player` | Player detail: bio, current team, position, nationality, birth date, height/weight, and thumbnail. |\n\n### `sports_find_team`\n\nResolve a fuzzy team name to its canonical record across ESPN, MLB StatsAPI, and TheSportsDB.\n\n- Returns full name, league, logo URL, venue, and ESPN/MLB/TheSportsDB cross-reference IDs\n- Use before `sports_get_scores`, `sports_get_schedule`, `sports_get_standings`, or `sports_get_team` to get a valid `team_name`\n- Fuzzy match on display name, abbreviation, or location (e.g. \"Mariners\", \"SEA\", \"Seattle Seahawks\")\n\n---\n\n### `sports_find_player`\n\nResolve a player name to their canonical record.\n\n- Multi-sport player search via TheSportsDB\n- Optional `sport` value is an advisory disambiguation hint; matching players are returned regardless of its value\n- Returns player ID, full name, current team, position, nationality, birth date, and thumbnail URL\n- Use the returned `player_id` with `sports_get_player` for full bio detail\n\n---\n\n### `sports_get_scores`\n\nLive and final scores for a league on a given date.\n\n- Routes NFL/NBA/NHL/soccer → ESPN; MLB → MLB StatsAPI (more authoritative)\n- Returns home/away teams, current score, status (`scheduled`/`in-progress`/`final`), period/clock, and UTC start time\n- Omit `date` for today's games; use `team_name` to filter to one team's game\n- Returns `games: [], reason: '...'` (not an error) when no games are scheduled\n\n---\n\n### `sports_get_schedule`\n\nUpcoming and past fixtures for a team or league over a date range.\n\n- Fetches full season from ESPN and applies `date_from`/`date_to` filtering server-side\n- Returns opponent, home/away flag, UTC date/time, venue, and result for completed games\n- Omit `team_name` for the full league calendar; provide it for a single team's fixtures\n\n---\n\n### `sports_get_standings`\n\nCurrent standings or league table for a league and season.\n\n- Returns rank, W/L (or points for soccer/NHL), division/conference, streak, and games behind\n- Omit `season` for the current season; pass a YYYY year for historical standings\n- NHL uses points system (`wins`/`otLosses`/`losses`); soccer returns `points` for the league table\n\n---\n\n### `sports_get_team`\n\nComposite team detail combining multiple source calls.\n\n- Active roster (or squad), last 5 results, next 3 fixtures, venue, and team metadata\n- MLB teams use MLB StatsAPI for roster and schedule; all others use ESPN\n\n---\n\n### `sports_get_player`\n\nFull player profile from TheSportsDB.\n\n- Bio, current team, position, nationality, birth date, height/weight, career description\n- Media thumbnail URL for display\n- Accepts `tsdb:`-prefixed IDs (from `sports_find_player`) or raw numeric TheSportsDB IDs\n\n---\n\n## Features\n\nBuilt on [`@cyanheads/mcp-ts-core`](https://www.npmjs.com/package/@cyanheads/mcp-ts-core):\n\n- Declarative tool definitions — single file per tool, framework handles registration and validation\n- Unified error handling — handlers throw, framework catches, classifies, and formats\n- Pluggable auth: `none`, `jwt`, `oauth`\n- Swappable storage backends: `in-memory`, `filesystem`, `Supabase`, `Cloudflare KV/R2/D1`\n- Structured logging with optional OpenTelemetry tracing\n- STDIO and Streamable HTTP transports\n\nSports-specific:\n\n- Three keyless sources — ESPN site API, MLB StatsAPI, TheSportsDB (free tier key `3`) — no API credentials required\n- League routing table internally routes each query to the best source per sport; agents never reference an upstream API\n- Normalized output types across all sources — `NormalizedGame`, `NormalizedTeam`, `NormalizedPlayer`, `NormalizedStanding` — with source provenance on every record\n- Graceful degradation — empty scoreboards (off-season, no games) return `games: []` with a `reason` string, not an error\n\nAgent-friendly output:\n\n- Source provenance on every record — `source: 'espn' | 'mlbstats' | 'thesportsdb'` so agents can reason about data authority\n- Structured `reason` field on empty score responses so agents can explain the result to users\n- Cross-source IDs surfaced by `sports_find_team` — `espnId`, `mlbId`, `tsdbId` — for seamless downstream routing without re-resolving names\n\n## Getting started\n\nAdd the following to your MCP client configuration file.\n\n```json\n{\n  \"mcpServers\": {\n    \"sports\": {\n      \"type\": \"stdio\",\n      \"command\": \"bunx\",\n      \"args\": [\"@cyanheads/sports-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with npx (no Bun required):\n\n```json\n{\n  \"mcpServers\": {\n    \"sports\": {\n      \"type\": \"stdio\",\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"@cyanheads/sports-mcp-server@latest\"],\n      \"env\": {\n        \"MCP_TRANSPORT_TYPE\": \"stdio\",\n        \"MCP_LOG_LEVEL\": \"info\"\n      }\n    }\n  }\n}\n```\n\nOr with Docker:\n\n```json\n{\n  \"mcpServers\": {\n    \"sports\": {\n      \"type\": \"stdio\",\n      \"command\": \"docker\",\n      \"args\": [\n        \"run\", \"-i\", \"--rm\",\n        \"-e\", \"MCP_TRANSPORT_TYPE=stdio\",\n        \"ghcr.io/cyanheads/sports-mcp-server:latest\"\n      ]\n    }\n  }\n}\n```\n\nFor Streamable HTTP, set the transport and start the server:\n\n```sh\nMCP_TRANSPORT_TYPE=http MCP_HTTP_PORT=3010 bun run start:http\n# Server listens at http://localhost:3010/mcp\n```\n\n### Prerequisites\n\n- [Bun v1.3.0](https://bun.sh/) or higher (or Node.js v24+).\n- No API keys required — ESPN and MLB StatsAPI are fully keyless; TheSportsDB ships with a free public test key (`3`).\n\n### Installation\n\n1. **Clone the repository:**\n\n```sh\ngit clone https://github.com/cyanheads/sports-mcp-server.git\n```\n\n2. **Navigate into the directory:**\n\n```sh\ncd sports-mcp-server\n```\n\n3. **Install dependencies:**\n\n```sh\nbun install\n```\n\n4. **Configure environment:**\n\n```sh\ncp .env.example .env\n# edit .env to override defaults (all optional)\n```\n\n## Configuration\n\n| Variable | Description | Default |\n|:---------|:------------|:--------|\n| `THESPORTSDB_API_KEY` | TheSportsDB API key. Replace with a paid key for higher rate limits. | `3` |\n| `MCP_TRANSPORT_TYPE` | Transport: `stdio` or `http`. | `stdio` |\n| `MCP_HTTP_PORT` | Port for HTTP server. | `3010` |\n| `MCP_SESSION_MODE` | HTTP session mode: `auto`, `stateful`, or `stateless`. `auto` resolves to stateful. | `stateless` |\n| `MCP_AUTH_MODE` | Auth mode: `none`, `jwt`, or `oauth`. | `none` |\n| `MCP_LOG_LEVEL` | Log level (RFC 5424). | `info` |\n| `LOGS_DIR` | Directory for log files (Node.js only). | `<project-root>/logs` |\n| `OTEL_ENABLED` | Enable [OpenTelemetry instrumentation](https://github.com/cyanheads/mcp-ts-core/tree/main/docs/telemetry). | `false` |\n\nSee [`.env.example`](./.env.example) for the full list of optional overrides.\n\n## Running the server\n\n### Local development\n\n- **Build and run:**\n\n  ```sh\n  # One-time build\n  bun run rebuild\n\n  # Run the built server\n  bun run start:stdio\n  # or\n  bun run start:http\n  ```\n\n- **Run checks and tests:**\n\n  ```sh\n  bun run devcheck   # Lint, format, typecheck, security\n  bun run test       # Vitest test suite\n  bun run lint:mcp   # Validate MCP definitions against spec\n  ```\n\n### Docker\n\n```sh\ndocker build -t sports-mcp-server .\ndocker run --rm -p 3010:3010 sports-mcp-server\n```\n\nThe Dockerfile 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`. OpenTelemetry peer dependencies are installed by default — build with `--build-arg OTEL_ENABLED=false` to omit them.\n\n## Project structure\n\n| Directory | Purpose |\n|:----------|:--------|\n| `src/index.ts` | `createApp()` entry point — registers tools and inits services. |\n| `src/config` | Server-specific environment variable parsing (`THESPORTSDB_API_KEY`). |\n| `src/services/types.ts` | Normalized cross-source types and league routing table. |\n| `src/services/espn` | ESPN site API service — scores, schedules, standings, teams. |\n| `src/services/mlb` | MLB StatsAPI service — scores, schedules, standings, rosters. |\n| `src/services/thesportsdb` | TheSportsDB service — player and team search/metadata. |\n| `src/mcp-server/tools` | Tool definitions (`*.tool.ts`). |\n| `tests/` | Unit and integration tests mirroring `src/`. |\n| `docs/` | Design doc and directory tree. |\n\n## Development guide\n\nSee [`CLAUDE.md`/`AGENTS.md`](./CLAUDE.md) for development guidelines and architectural rules. The short version:\n\n- Handlers throw, framework catches — no `try/catch` in tool logic\n- Use `ctx.log` for request-scoped logging, `ctx.state` for tenant-scoped storage\n- Register new tools via the barrel in `src/mcp-server/tools/definitions/index.ts`\n- Wrap external API calls: validate raw → normalize to domain type → return output schema; never fabricate missing fields\n\n## Contributing\n\nIssues and pull requests are welcome. Run checks and tests before submitting:\n\n```sh\nbun run devcheck\nbun run test\n```\n\n## License\n\nApache-2.0 — see [LICENSE](LICENSE) for details.\n",
  "bytes": 11983,
  "sha": "82c03a1613b76824b74a86c37d89c0c05ff981181064bc35380a760bbfbe10f4",
  "repo_slug": "cyanheads/sports-mcp-server",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_cyanheads_sports_mcp_server_fae277b5/readme"
}