Lichess MCP

by karayaman
Verified

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

Integrations

  • Provides support for loading environment variables from a .env file for configuring the Lichess API token.

  • Enables comprehensive interaction with the Lichess chess platform, including account management, playing chess games, creating challenges, analyzing positions, managing tournaments, joining teams, and connecting with other players.

リッチチェスMCP

Lichessに自然言語で話しかけて、チェスプラットフォームと対話しましょう。Claude Desktopと連携して、ゲームをプレイしたり、ポジションを分析したり、チェスの活動を管理したりできます。

モデルコンテキストプロトコルを使用して構築されました。

サーバーにより、次のことが可能になります。

  • Lichessアカウントの管理
  • チェスのゲームやチャレンジをする
  • ポジションとゲームの分析
  • トーナメントやチームに参加する
  • 他のプレイヤーとの交流

構成

Lichess API トークンは次の 2 つの方法で設定できます。

  1. 環境変数: プロジェクト ルートの.envファイルに追加するか、直接設定します。
    LICHESS_TOKEN=your-lichess-api-token
  2. 実行時にset_tokenツールを使用する:
    set_token({ token: "your-lichess-api-token" });

トークンはhttps://lichess.org/account/oauth/tokenで生成できます。

利用可能なツール

1. アカウント管理

// Set your Lichess API token set_token({ token: "your-lichess-api-token" }); // Get your Lichess profile get_my_profile(); // Get another user's profile get_user_profile({ username: "player_name", trophies: true // include trophies, optional });

2. ゲームプレイ

// Create a challenge against another player create_challenge({ username: "opponent_username", timeControl: "10+0", // 10 minutes, no increment color: "random" // or "white", "black" }); // Make a move in a game make_move({ gameId: "abcd1234", move: "e2e4", offeringDraw: false }); // Get your ongoing games get_ongoing_games({ nb: 10 // number of games to fetch });

3. ゲーム分析

// Export a game in PGN format export_game({ gameId: "abcd1234", clocks: true, evals: true }); // Get cloud evaluation for a position get_cloud_eval({ fen: "rnbqkbnr/ppp1pppp/8/3p4/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2" });

4. トーナメント

// List current tournaments get_arena_tournaments(); // Join a tournament join_arena({ tournamentId: "abc123" }); // Create a new tournament create_arena({ name: "My Tournament", clockTime: 3, clockIncrement: 2, minutes: 45 });

チェスの記法

移動形式

Lichess API は次の形式の動きを受け入れます:

  • UCI : ユニバーサルチェスインターフェース形式(例: e2e4g8f6
  • SAN : 標準代数記法(例: e4Nf6 ) - 一部のエンドポイントのみ

FENフォーマット

フォーサイス・エドワーズ記法 (FEN) はチェスの位置を表すために使用されます。

rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1

これは次を表します:

  • 駒の位置(8段目から1段目まで)
  • アクティブカラー(白黒)
  • キャスリングの可用性(KQkq)
  • アンパッサンターゲットスクエア
  • ハーフムーブクロック
  • フルムーブ数

エラー処理

サーバーは、次の詳細なエラー メッセージを提供します。

  • 無効な動きや位置
  • 認証の問題
  • レート制限
  • リソースが見つからないケース

セットアップ手順

  1. リポジトリをクローンします。
    git clone https://github.com/karayaman/lichess-mcp.git cd lichess-mcp
  2. 依存関係をインストールします:
    npm install
  3. 環境変数を設定します。ルート ディレクトリに.envファイルを作成します。
    LICHESS_TOKEN=your-lichess-api-token
  4. プロジェクトをビルドします。
    npm run build
  5. パッケージをグローバルにインストールします (Claude Desktop 統合の場合は推奨)。
    npm install -g
  6. サーバーを起動します (スタンドアロン使用の場合):
    npm start

Claudeデスクトップの設定

この MCP サーバーを Claude Desktop で使用するには:

  1. Claude Desktop 構成ファイルを見つけます。
    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Lichess MCP サーバーを構成に追加します。
    { "mcpServers": { "lichess": { "command": "lichess-mcp", "env": { "LICHESS_TOKEN": "your-lichess-api-token", "DEBUG": "*" } } } }
    注: your-lichess-api-token実際のDEBUG APIトークンに置き換えてください。DEBUG環境変数はオプションですが、トラブルシューティングに役立ちます。
  3. (オプション) 他の MCP サーバーを追加することもできます。
    { "mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Desktop", "/Users/username/Downloads" ] }, "lichess": { "command": "lichess-mcp", "env": { "LICHESS_TOKEN": "your-lichess-api-token" } } } }
  4. 変更を適用するには、Claude Desktop を再起動します。
    • Claude Desktop を完全に閉じてください (システム トレイ/メニュー バーからでも閉じられます)
    • Claude Desktopを再度起動します
    • インターフェースでハンマーアイコンを探します。これはMCPサーバーが接続されていることを示します。
  5. Claude に Lichess アカウントについて問い合わせて、統合をテストします。
    • 「Lichessプロフィールを見せてください」
    • 「10分の時間制限で新しいチェスゲームを開始する」

トラブルシューティング

MCP サーバー接続で問題が発生した場合:

  1. npm install -gでパッケージがグローバルにインストールされていることを確認してください。
  2. lichess-mcpコマンドが PATH で使用可能であることを確認します ( which lichess-mcp )
  3. 設定ファイルの形式が正しいことを確認してください( mcp_serversではなく新しいmcpServers形式)。
  4. Claude Desktopを完全に再起動します
  5. 追加のログ記録のために、Claude Desktop で開発者モードを有効にしてみてください(利用可能な場合)。
  6. Lichess APIトークンが有効であることを確認してください

参考文献

You must be authenticated.

A
security – no known vulnerabilities
A
license - permissive license
A
quality - confirmed to work

Lichess チェス プラットフォームとの自然言語によるインタラクションを可能にする MCP サーバー。ユーザーは Claude を通じてゲームをプレイしたり、ポジションを分析したり、アカウントを管理したり、トーナメントに参加したりできます。

  1. Configuration
    1. Available Tools
      1. 1. Account Management
      2. 2. Game Play
      3. 3. Game Analysis
      4. 4. Tournaments
    2. Chess Notation
      1. Move Formats
      2. FEN Format
    3. Error Handling
      1. Setup Instructions
        1. Configuring Claude Desktop
          1. Troubleshooting
            1. References
              ID: x7iuw37s1v