Skip to main content
Glama

lichess-stockfish-mcp

An MCP server that gives Claude (or any MCP client) a local Stockfish engine and the Lichess API. Use it for game reviews, coaching, opening research and endgame checks, and to give something back to the Lichess community.

Tools

Group

Tool

Purpose

Engine

analyze_position

Top N Stockfish lines for a FEN

legal_moves

Legal moves in SAN, so the model never suggests an illegal move

review_pgn

Full game review: Lichess-style accuracy, ACPL, inaccuracies/mistakes/blunders with the best move, annotated PGN

Lichess

lichess_user, lichess_recent_games, lichess_game_pgn

Profiles and games

review_lichess_game

Review any Lichess game by id or URL

review_player_recent_games

Coach report over the last N games: where errors happen (opening/middlegame/endgame), results per opening, worst moments

lichess_cloud_eval

Lichess's cached deep evaluations

opening_explorer

What Lichess players or masters play from a position

endgame_tablebase

Perfect play for 7 or fewer pieces

lichess_puzzle

Daily puzzle or a puzzle by id

lichess_account

Check which account a token belongs to

Contribute

import_game_to_lichess

Publish over-the-board or club games publicly on Lichess

publish_review_to_study

Push an engine-annotated review into a Lichess Study chapter

The two "Contribute" tools write to Lichess. Their descriptions tell the model to confirm with the user first.

How the review judges moves

It follows Lichess's own method:

  • Each eval is converted to a win percentage: 50 + 50 * (2 / (1 + exp(-0.00368208 * cp)) - 1).

  • A move is an inaccuracy, mistake or blunder when it loses ≥5, ≥10 or ≥15 win-percentage points and wasn't the engine's choice.

  • Allowing a forced mate, or letting one slip, is judged by Lichess's mate rules.

  • Per-move accuracy uses 103.1668 * exp(-0.04354 * loss) - 3.1669, averaged across the game. That's close to Lichess's number but not identical.

Related MCP server: Lichess MCP

Setup

Requires Python 3.10+ and a Stockfish binary.

python -m venv .venv
.venv/bin/pip install -r requirements.txt        # Windows: .venv\Scripts\pip

Environment variable

Default

Purpose

STOCKFISH_PATH

./bin/**/stockfish*.exe, then stockfish on PATH

Engine binary

LICHESS_TOKEN

unset

Only for publish_review_to_study (scope study:write): create one

ENGINE_THREADS

half the CPUs

Stockfish threads

ENGINE_HASH_MB

256

Stockfish hash

SSL_CERT_FILE

system store

Custom CA bundle, for example behind a TLS-inspecting proxy

Register with Claude Code

claude mcp add lichess -e STOCKFISH_PATH=/usr/games/stockfish -- /path/to/.venv/bin/python /path/to/server.py

Or use a project .mcp.json:

{
  "mcpServers": {
    "lichess": {
      "command": "/path/to/.venv/bin/python",
      "args": ["/path/to/server.py"],
      "env": { "STOCKFISH_PATH": "/usr/games/stockfish", "LICHESS_TOKEN": "${LICHESS_TOKEN:-}" }
    }
  }
}

Windows with WSL: run the server inside WSL by setting "command": "wsl.exe" and "args": ["-e", "env", "STOCKFISH_PATH=...", "/home/you/.venv/bin/python", "/mnt/c/.../server.py"]. Add "WSLENV": "LICHESS_TOKEN" to env to pass the token through.

Example prompts

  • "Review my last 10 blitz games on Lichess (user <name>) and tell me my recurring mistakes."

  • "Review lichess.org/abcd1234 and add the annotated version to my study <id>."

  • "What do 1800-rated players play after 1.e4 c5 2.Nf3 d6, and what does Stockfish think?"

Tests

python tests/test_server.py            # engine + live Lichess
python tests/test_server.py offline    # engine only

More ways to support the community

  • fishnet: donate CPU to Lichess's free server-side analysis.

  • Fishtest: donate CPU to test Stockfish patches.

  • lichess-bot: run an engine as a public bot. Upgrading to a bot account is permanent, so use a new account.

Fair play

Use this only after games, for study, or for your own imported games. Getting engine help during a live game breaks the Lichess (and Chess.com) Terms of Service.

License

MIT for this code. Stockfish itself is GPLv3 and isn't included. This server runs it as a separate program.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables natural language interaction with Lichess chess platform to play games, analyze positions, manage challenges and tournaments, and interact with other players through Claude Desktop.
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      Connects Claude to Lichess for playing chess games, analyzing positions with Stockfish cloud evaluation, and solving puzzles. Supports real-time gameplay including moves, challenges, draw offers, and accessing user profiles and game history.
      28
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to perform professional-grade chess analysis using Stockfish and optionally Leela Chess Zero, including position analysis, full game review, opening lookup, and puzzle generation.
      13 npm
      2
      MIT