Lichess MCP

Lichess MCP

An MCP server that enables natural language interaction with the Lichess chess platform, allowing users to play games, analyze positions, manage their account, and participate in tournaments through Claude.

karayaman

Games & Gamification
Visit Server

Tools

unblock_user

Unblock a user

get_user_profile

Get a user's Lichess profile information

get_my_email

Get your email address

get_kid_mode

Get kid mode status

set_kid_mode

Set kid mode status

create_challenge

Create a new challenge

set_token

Set your Lichess API token

get_my_profile

Get your Lichess profile information

make_move

Make a move in an ongoing game

get_preferences

Get your preferences

get_timeline

Get your timeline

test_tokens

Test multiple OAuth tokens

revoke_token

Revoke the current access token

upgrade_to_bot

Upgrade to Bot account. WARNING: This is irreversible and the account must not have played any games.

add_user_note

Add a private note about a user

send_message

Send a private message to another player

get_following

Get users followed by the logged in user

follow_user

Follow a player

unfollow_user

Unfollow a player

block_user

Block a player

get_users_status

Get real-time users status

get_all_top_10

Get the top 10 players for each speed and variant

get_leaderboard

Get the leaderboard for a single speed or variant

get_user_public_data

Get public data of a user

get_rating_history

Get rating history of a user for all perf types

get_user_performance

Get performance statistics of a user

get_user_activity

Get activity feed of a user

get_users_by_id

Get multiple users by their IDs

export_game

Export one game in PGN or JSON format

export_ongoing_game

Export ongoing game of a user

export_user_games

Export all games of a user

export_games_by_ids

Export multiple games by IDs

get_tv_channels

Get all TV channels and their current games

get_tv_game

Get current TV game in PGN format

get_puzzle_activity

Get your puzzle activity

get_puzzle_dashboard

Get your puzzle dashboard

get_puzzle_race

Get info about a puzzle race

create_puzzle_race

Create a puzzle race

get_puzzle_storm_dashboard

Get your puzzle storm dashboard

get_team_info

Get team information by ID

get_team_members

Get members of a team

get_team_join_requests

Get join requests for a team

join_team

Join a team

leave_team

Leave a team

kick_user_from_team

Kick a user from your team

accept_join_request

Accept a join request for your team

decline_join_request

Decline a join request for your team

search_teams

Search for teams

make_board_move

Make a move in a board game

abort_board_game

Abort a board game

resign_board_game

Resign a board game

write_in_chat

Write in the chat of a board game

handle_draw_board_game

Handle draw offers for a board game

claim_victory

Claim victory if opponent abandoned the game

list_challenges

List incoming and outgoing challenges

README

Lichess MCP

Speak to Lichess in natural language to interact with the chess platform. Use it with Claude Desktop to play games, analyze positions, and manage your chess activities.

Built using the Model Context Protocol.

<a href="https://glama.ai/mcp/servers/x7iuw37s1v"> <img width="380" height="200" src="https://glama.ai/mcp/servers/x7iuw37s1v/badge" alt="Lichess MCP server" /> </a>

The server enables:

  • Managing your Lichess account
  • Playing chess games and challenges
  • Analyzing positions and games
  • Joining tournaments and teams
  • Interacting with other players

Configuration

The Lichess API token can be set in two ways:

  1. Environment variables: Add it to your .env file in the project root or set it directly:

    LICHESS_TOKEN=your-lichess-api-token
    
  2. Using the set_token tool during runtime:

    set_token({
      token: "your-lichess-api-token"
    });
    

The token can be generated at https://lichess.org/account/oauth/token

Available Tools

1. Account Management

// 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. Game Play

// 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. Game Analysis

// 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. Tournaments

// 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
});

Chess Notation

Move Formats

The Lichess API accepts moves in these formats:

  • UCI: Universal Chess Interface format (e.g., e2e4, g8f6)
  • SAN: Standard Algebraic Notation (e.g., e4, Nf6) - only for some endpoints

FEN Format

The Forsyth-Edwards Notation (FEN) is used to represent chess positions:

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

This represents:

  • Piece positions (from 8th rank to 1st rank)
  • Active color (w/b)
  • Castling availability (KQkq)
  • En passant target square
  • Halfmove clock
  • Fullmove number

Error Handling

The server provides detailed error messages for:

  • Invalid moves or positions
  • Authentication issues
  • Rate limits
  • Resource not found cases

Setup Instructions

  1. Clone the repository:

    git clone https://github.com/karayaman/lichess-mcp.git
    cd lichess-mcp
    
  2. Install dependencies:

    npm install
    
  3. Configure environment variables: Create a .env file in the root directory:

    LICHESS_TOKEN=your-lichess-api-token
    
  4. Build the project:

    npm run build
    
  5. Install the package globally (recommended for Claude Desktop integration):

    npm install -g
    
  6. Start the server (for standalone usage):

    npm start
    

Configuring Claude Desktop

To use this MCP server with Claude Desktop:

  1. Locate your Claude Desktop configuration file:

    • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
    • Windows: %APPDATA%\Claude\claude_desktop_config.json
    • Linux: ~/.config/Claude/claude_desktop_config.json
  2. Add the Lichess MCP server to your configuration:

    {
      "mcpServers": {
        "lichess": {
          "command": "lichess-mcp",
          "env": {
            "LICHESS_TOKEN": "your-lichess-api-token",
            "DEBUG": "*"
          }
        }
      }
    }
    

    Note: Replace your-lichess-api-token with your actual Lichess API token. The DEBUG environment variable is optional but helpful for troubleshooting.

  3. (Optional) You can add other MCP servers as well:

    {
      "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. Restart Claude Desktop to apply the changes.

    • Make sure to completely close Claude Desktop (including from the system tray/menu bar)
    • Launch Claude Desktop again
    • Look for a hammer icon in the interface, which indicates that MCP servers are connected
  5. Test the integration by asking Claude about your Lichess account:

    • "Show me my Lichess profile"
    • "Start a new chess game with 10 minutes time control"

Troubleshooting

If you encounter issues with the MCP server connection:

  1. Ensure you've installed the package globally with npm install -g
  2. Verify that the lichess-mcp command is available in your PATH (which lichess-mcp)
  3. Check that your configuration file has the correct format (the newer mcpServers format instead of mcp_servers)
  4. Restart Claude Desktop completely
  5. Try enabling Developer Mode in Claude Desktop (if available) for additional logging
  6. Verify your Lichess API token is valid

References