Lichess MCP server

Integrates with the Lichess chess platform to enable natural language-driven gameplay, analysis, and tournament participation through its API.
Back to servers
Setup instructions
Provider
Alper Karayaman
Release date
Feb 26, 2025
Language
TypeScript
Stats
4 stars

The Lichess MCP server lets you interact with Lichess using natural language through Claude Desktop. You can play chess, analyze positions, manage your account, and join tournaments without needing to directly use the Lichess website.

Installation Options

Using Smithery (Recommended)

Install the Lichess Integration for Claude Desktop automatically:

npx -y @smithery/cli install @karayaman/lichess-mcp --client claude

Manual Installation

  1. Clone the repository and install dependencies:
git clone https://github.com/karayaman/lichess-mcp.git
cd lichess-mcp
npm install
  1. Create a .env file with your Lichess API token:
LICHESS_TOKEN=your-lichess-api-token
  1. Build and install the package globally:
npm run build
npm install -g

Configuring 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": "*"
      }
    }
  }
}
  1. Restart Claude Desktop completely to apply the changes.

Setting Up Your Lichess Token

You can set your Lichess API token in two ways:

  1. Environment variables (add to your .env file or system):
LICHESS_TOKEN=your-lichess-api-token
  1. Using the set_token tool during runtime:
set_token({
  token: "your-lichess-api-token"
});

Get your token at https://lichess.org/account/oauth/token

Using the Lichess MCP Server

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

Playing Chess

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

Analyzing Games

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

Tournament Management

// 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) - for some endpoints only

FEN Format

The Forsyth-Edwards Notation represents chess positions:

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

This includes piece positions, active color, castling availability, en passant target, halfmove clock, and fullmove number.

Troubleshooting

If you encounter connection issues:

  • Ensure the package is installed globally (npm install -g)
  • Verify the lichess-mcp command is in your PATH
  • Check your configuration file format (use mcpServers not mcp_servers)
  • Restart Claude Desktop completely
  • Verify your Lichess API token is valid

Test the integration by asking Claude:

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

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "lichess" '{"command":"lichess-mcp","env":{"LICHESS_TOKEN":"your-lichess-api-token"}}'

See the official Claude Code MCP documentation for more details.

For Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

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

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your 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 this to your configuration file:

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

3. Restart Claude Desktop for the changes to take effect

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later