Sleeper Fantasy Football MCP Server
Sleeper Fantasy Football MCP Server
Sleeper のファンタジーフットボール公開APIをラップするリモートMCP(Model Context Protocol)サーバーです。HTTPサービス(Streamable HTTPトランスポート)として動作するため、Claude Desktop と Claude モバイルアプリの両方からインターネット経由でアクセスできます。ドラフトの最中にスマホからリーグデータを取得するのに便利です。
Sleeper のAPI(https://api.sleeper.app/v1/、docs)は公開されており読み取り専用なので、このサーバーはリーグの設定やロースター、指名内容を一切変更しません。読み取りのみです。
ステータス
これは初期のスキャフォールドです。get_league_settings という1つのツールが、Streamable HTTP上でベアラートークン認証によりエンドツーエンドで動作します。他のツール(ロースター、対戦、ドラフト指名など)も同じパターンで src/tools.js に追加されていきます。
Related MCP server: Yahoo Fantasy Baseball MCP Server
プロジェクト構造
src/
config.js # reads env vars once, exports a typed config object
sleeperClient.js # thin wrapper around Sleeper's REST API
auth.js # bearer token middleware
tools.js # MCP tool definitions (registered against an McpServer)
server.js # express app: /health, /mcp, auth wiring, listen()
.env.example新しいツールを追加するということは、sleeperClient.js に fetch 関数を追加し、tools.js でそれを呼び出すツールを登録するということです。server.js と auth.js は変更する必要がありません。
前提条件
Node.js 24.16.0(
package.jsonのenginesに固定)Sleeper のリーグIDとユーザーID
リーグIDの確認方法: Sleeper ウェブアプリで自分のリーグを開いてください。URLに長い数値のリーグIDが含まれています(例: sleeper.com/leagues/1234567890123456789/team)。
ユーザーIDの確認方法: ブラウザで https://api.sleeper.app/v1/user/<your_sleeper_username> にアクセスし、user_id フィールドをコピーしてください。
環境変数
設定は src/config.js で一度だけ読み込まれます。コードベース内の他の場所で process.env に直接触れることはありません。必須の3つはすべて必要で、これらが無いとサーバーは起動しません。
変数 | 目的 |
| SleeperのリーグID |
| SleeperのユーザーID |
| すべてのリクエストで提示が必要なBearerトークン。Authを参照 |
| (ローカル開発専用) 待ち受けるポート。デフォルトは |
.env.example を .env にコピーし、実際の値を設定してください:
cp .env.example .env強力な MCP_AUTH_TOKEN を生成してください:
node -e "console.log(require('crypto').randomBytes(32).toString('hex'))".env は git-ignores の対象です。実際の値をコミットしないでください。.env.example にはプレースホルダーしか含まれません。
Auth(認証)
/mcp へのすべてのリクエストは次を含めなければなりません:
Authorization: Bearer <MCP_AUTH_TOKEN>トークンがない・または正しくない場合、MCP や Sleeper のロジックが実行される前に 401 が返ります(src/auth.js で定数時間比較により確認)。このサーバーには他のアクセス制御はなく、これがリーグデータと外部のインターネットを隔てる唯一の防御です。MCP_AUTH_TOKEN をパスワードと同じくらい大切に扱い、共有したりコミットしないでください。
/health は意図的に認証なしです(リーグデータを含まない死活確認のみ)。Railway のヘルスチェックが制限なくアクセスできるようにするためです。
ローカルでの実行
npm install
cp .env.example .env # then fill in real values
npm start # or: npm run dev (auto-restarts on changes)サーバーは http://localhost:3000(または $PORT が設定されていればそのポート)で待ち受けます。
curl による簡単なスモークテスト:
# health check (no auth)
curl http://localhost:3000/health
# MCP initialize (replace the token with your MCP_AUTH_TOKEN)
curl -s http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer <your MCP_AUTH_TOKEN>" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"test","version":"1.0.0"}}}'
# call the tool
curl -s http://localhost:3000/mcp \
-H "Content-Type: application/json" \
-H "Accept: application/json, text/event-stream" \
-H "Authorization: Bearer <your MCP_AUTH_TOKEN>" \
-d '{"jsonrpc":"2.0","id":2,"method":"tools/call","params":{"name":"get_league_settings","arguments":{}}}'Authorization ヘッダーがない、またはトークンが間違っているリクエストは 401 を返します。
ク匿名を接続する
このサーバーは Streamable HTTP トランスポート(stdio ではなく単一の /mcp エンドポイント)を使用します。そのため、各クライアントのリモート/カスタム MCP コネクタの追加手順に従って、デプロイしたURL とベアラートークンを指定してリモート MCP サーバーとして追加します。https://<your-railway-domain>/mcp をポイントし、そのクライアントが要求する方法で Authorization: Bearer <MCP_AUTH_TOKEN> ヘッダーを設定してください。
Railway へのデプロイ
このリポジトリを GitHub にプッシュします(このリポジトリのこのファイルを読んでいるなら完了済み)。
Railway で新しいプロジェクトを作成する(または既存のプロジェクトを使う)し、その GitHub リポジトリからサービスを追加してください。
Railway は Node.js を自動検出し、
npm installを実行してからnpm startをします。今回の構成ではProcfileもDockerfileも必要ありません。サービスの Variables タブで、
SLEEPER_LEAGUE_ID、SLEEPER_USER_ID、MCP_AUTH_TOKENを設定してください(ローカル開発用トークンとは別の、強力な値にしてください)。PORTは 設定しない でください。Railway が自動的にセットします。重要 —
PORT: Railway は実行時にPORT環境変数でコンテナのリッスンポートを動的に割り当てます。この値は固定でも事前予測でもありません。src/server.jsは(src/config.jsを経由して)process.env.PORTを読み、未設定の場合のみ3000にフォールバックします。このフォールバックはローカル開発時だけです。ポートをハードコードしないでください。ハードコードされたポートでは Railway のトラフィックを受けることはできません。デプロイしてください。Railway が
https://<service>.up.railway.appのような公開ドメインを発行します。MCP エンドポイントはhttps://<service>.up.railway.app/mcpです。上記と同じ curl コマンドで、
localhost:3000を Railway のドメインに置き換えて検証し、その後MCP_AUTH_TOKENを使って Claude Desktop / モバイルアプリからそのURLに接続してください。
制限事項
読み取り専用。Sleeper のリーグ内の内容を一切変更できません。
デプロイにつき単一リーグです(
SLEEPER_LEAGUE_IDは tool 引数ではなく config 内の1値です)。ステートレスなリクエスト処理です。各 MCP リクエストは独自のトランスポートを生成するので、Railway の再起動で失われるサーバー側セッション状態はありません。その一方、リクエストをまたぐ再開可能なストリーミングもありません。
現時点では
get_league_settingsのみ実装されています。
ライセンス
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseBqualityCmaintenanceEnables comprehensive Sleeper Fantasy Football integration with Claude, providing real-time player projections, historical performance analytics, league management, and waiver wire analysis. Supports advanced NFL metrics, lineup optimization, and matchup analysis for fantasy football decision-making.6121
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Yahoo Fantasy Sports API for fantasy baseball, providing tools to manage rosters and player stats via Claude.124MIT
- FlicenseNot gradedqualityDmaintenanceEnables Claude to interact with Yahoo Fantasy Baseball and Basketball leagues, allowing roster analysis, matchup tracking, free agent browsing, and player stats retrieval via natural language.1
- AlicenseNot gradedqualityBmaintenanceEnables AI models to manage and query fantasy sports leagues through the Sleeper API, supporting tasks like player lookups, league activity, and draft management.27MIT
Related MCP Connectors
Read-only fantasy analysis for ESPN, Yahoo, and Sleeper leagues via MCP
WHOOP recovery, strain, sleep and workouts in Claude via official WHOOP OAuth. Free, open source.
Connect Claude to Fathom meeting recordings, transcripts, and summaries
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/dduderstadt/sleeper-fantasy-football-claude-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server