Skip to main content
Glama

Lichess MCP

使用自然语言与 Lichess 对话,从而与该国际象棋平台进行交互。将其与 Claude Desktop 配合使用,可以进行对弈、分析棋局并管理您的国际象棋活动。

基于 Model Context Protocol 构建。

该服务器支持:

  • 管理您的 Lichess 账户

  • 进行国际象棋对弈和挑战

  • 分析棋局和对局

  • 加入锦标赛和战队

  • 与其他玩家互动

配置

Lichess API 令牌可以通过两种方式设置:

  1. 环境变量:将其添加到项目根目录的 .env 文件中,或直接设置:

    LICHESS_TOKEN=your-lichess-api-token
  2. 在运行时使用 set_token 工具:

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

令牌可以在 https://lichess.org/account/oauth/token 生成

Related MCP server: Lichess MCP

可用工具

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

5. 交互式 UI (Claude Desktop)

这些工具会在聊天界面内打开一个真实的棋盘——使用 MCP Apps 扩展,您可以拖动棋子、浏览走法并点击开局库。在不支持 UI 的客户端中,每个工具都会回退为包含 FEN/PGN/Lichess 链接的文本响应。

// Open today's daily puzzle (or a specific id) as an interactive solver.
play_puzzle({ puzzleId: "Bmfot" });

// Step through a Lichess game or raw PGN with prev/next/play controls.
view_pgn({ gameId: "abcd1234" });
view_pgn({ pgn: "1. e4 e5 2. Nf3 ..." });

// Walk the opening tree: click moves to drill down; toggle masters/lichess.
explore_openings({ source: "masters" });

国际象棋记谱法

走法格式

Lichess API 接受以下格式的走法:

  • UCI: 通用国际象棋接口格式 (例如 e2e4, g8f6)

  • SAN: 标准代数记谱法 (例如 e4, Nf6) - 仅适用于部分端点

FEN 格式

Forsyth-Edwards Notation (FEN) 用于表示棋局局面:

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

这表示:

  • 棋子位置(从第 8 行到第 1 行)

  • 轮到哪方走棋 (w/b)

  • 王车易位权限 (KQkq)

  • 过路兵目标格

  • 半回合计数

  • 全回合数

错误处理

服务器为以下情况提供详细的错误信息:

  • 无效的走法或局面

  • 身份验证问题

  • 速率限制

  • 资源未找到

安装说明

通过 Smithery 安装

要通过 Smithery 自动为 Claude Desktop 安装 Lichess 集成:

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

手动安装

  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 Desktop

要将此 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 替换为您实际的 Lichess 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 账户来测试集成:

    • "Show me my Lichess profile"

    • "Start a new chess game with 10 minutes time control"

故障排除

如果您在 MCP 服务器连接方面遇到问题:

  1. 确保您已使用 npm install -g 全局安装了该包

  2. 验证 lichess-mcp 命令在您的 PATH 中可用 (which lichess-mcp)

  3. 检查您的配置文件格式是否正确(使用较新的 mcpServers 格式,而不是 mcp_servers)

  4. 完全重启 Claude Desktop

  5. 尝试在 Claude Desktop 中启用开发者模式(如果可用)以获取更多日志

  6. 验证您的 Lichess API 令牌是否有效

参考资料

Available Tools

88 tools
abort_board_gameC

Abort a board game

Inputs: gameId (required).

accept_challengeC

Accept an incoming challenge

Inputs: challengeId (required).

accept_join_requestB

Accept a join request for your team

Inputs: teamId (required), userId (required).

add_user_noteC

Add a private note about a user

Inputs: username (required), text (required).

block_userC

Block a player

Inputs: username (required).

cancel_challengeC

Cancel an outgoing challenge

Inputs: challengeId (required).

claim_victoryC

Claim victory if opponent abandoned the game

Inputs: gameId (required).

create_arenaC

Create a new arena tournament

Inputs: name (required), clockTime, clockIncrement, minutes, +10 more.

create_challengeC

Challenge another player

Inputs: username (required), rated, clock, days, +3 more.

create_puzzle_raceD

Create a puzzle race

Inputs: no named parameters.

create_simulC

Create a new simul

Inputs: name (required), variant, clockTime, clockIncrement, +4 more.

create_swissC

Create a new Swiss tournament

Inputs: name (required), teamId (required), clock (required), nbRounds, +4 more.

decline_challengeC

Decline an incoming challenge

Inputs: challengeId (required), reason.

decline_join_requestC

Decline a join request for your team

Inputs: teamId (required), userId (required).

export_all_study_chaptersC

Export all chapters of a study in PGN format

Inputs: studyId (required).

export_gameC

Export one game in PGN or JSON format

Inputs: gameId (required), moves, pgnInJson, tags, +5 more.

export_games_by_idsC

Export multiple games by IDs

Inputs: ids (required), moves, pgnInJson, tags, +3 more.

export_ongoing_gameC

Export ongoing game of a user

Inputs: username (required), moves, pgnInJson, tags, +3 more.

export_study_chapterC

Export one study chapter in PGN format

Inputs: studyId (required), chapterId (required).

export_user_gamesC

Export all games of a user

Inputs: username (required), since, until, max, +16 more.

follow_userC

Follow a player

Inputs: username (required).

get_all_top_10B

Get the top 10 players for each speed and variant

Inputs: no named parameters.

get_arena_gamesC

Get games of an arena tournament

Inputs: tournamentId (required).

get_arena_infoC

Get info about an arena tournament

Inputs: tournamentId (required).

get_arena_resultsC

Get results of an arena tournament

Inputs: tournamentId (required).

get_arena_tournamentsC

Get current tournaments

Inputs: no named parameters.

get_broadcastC

Get a broadcast by its ID

Inputs: broadcastId (required).

get_broadcast_roundC

Get one round of a broadcast

Inputs: broadcastId (required), roundId (required).

get_cloud_evalC

Get cloud evaluation for a position

Inputs: fen (required), multiPv.

get_current_simulsB

Get recently started simuls

Inputs: no named parameters.

get_fide_playerC

Get FIDE player information

Inputs: playerId (required).

get_followingB

Get users followed by the logged in user

Inputs: no named parameters.

get_kid_modeC

Get kid mode status

Inputs: no named parameters.

get_leaderboardC

Get the leaderboard for a single speed or variant

Inputs: perfType (required), nb.

get_my_emailB

Get your email address

Inputs: no named parameters.

get_my_profileB

Get your Lichess profile information

Inputs: no named parameters.

get_official_broadcastsC

Get official broadcasts (TV shows)

Inputs: no named parameters.

get_ongoing_gamesC

Get your ongoing games (real-time and correspondence)

Inputs: nb.

get_preferencesC

Get your preferences

Inputs: no named parameters.

get_puzzle_activityC

Get your puzzle activity

Inputs: max.

get_puzzle_dashboardC

Get your puzzle dashboard

Inputs: days.

get_puzzle_raceC

Get info about a puzzle race

Inputs: raceId (required).

get_puzzle_storm_dashboardC

Get your puzzle storm dashboard

Inputs: days.

get_rating_historyC

Get rating history of a user for all perf types

Inputs: username (required).

get_swiss_gamesC

Get games of a Swiss tournament

Inputs: swissId (required).

get_swiss_infoB

Get info about a Swiss tournament

Inputs: swissId (required).

get_swiss_resultsC

Get results of a Swiss tournament

Inputs: swissId (required).

get_team_battle_resultsC

Get results of a team battle tournament

Inputs: tournamentId (required).

get_team_infoC

Get team information by ID

Inputs: teamId (required).

get_team_join_requestsB

Get join requests for a team

Inputs: teamId (required).

get_team_membersC

Get members of a team

Inputs: teamId (required), max.

get_threadC

Get a message thread

Inputs: userId (required).

get_timelineC

Get your timeline

Inputs: since, nb.

get_tv_channelsB

Get all TV channels and their current games

Inputs: no named parameters.

get_tv_gameB

Get current TV game in PGN format

Inputs: channel.

get_user_activityC

Get activity feed of a user

Inputs: username (required).

get_user_performanceC

Get performance statistics of a user

Inputs: username (required), perf (required).

get_user_profileC

Get a user's Lichess profile information

Inputs: username (required), trophies.

get_user_public_dataC

Get public data of a user

Inputs: username (required), withTrophies.

get_users_by_idC

Get multiple users by their IDs

Inputs: ids (required).

get_users_statusC

Get real-time users status

Inputs: ids (required), withSignal, withGameIds, withGameMetas.

get_user_studiesC

Get studies created by a user

Inputs: username (required).

handle_draw_board_gameC

Handle draw offers for a board game

Inputs: gameId (required), accept.

join_arenaC

Join an arena tournament

Inputs: tournamentId (required).

join_simulC

Join a simul

Inputs: simulId (required).

join_swissC

Join a Swiss tournament

Inputs: swissId (required).

join_teamC

Join a team

Inputs: teamId (required), message.

kick_user_from_teamC

Kick a user from your team

Inputs: teamId (required), userId (required).

leave_teamC

Leave a team

Inputs: teamId (required).

list_challengesC

List incoming and outgoing challenges

Inputs: no named parameters.

make_board_moveC

Make a move in a board game

Inputs: gameId (required), move (required), offeringDraw.

make_moveC

Make a move in an ongoing game

Inputs: gameId (required), move (required), offeringDraw.

push_broadcast_round_pgnC

Push PGN to a broadcast round

Inputs: broadcastId (required), roundId (required), pgn (required).

resign_board_gameC

Resign a board game

Inputs: gameId (required).

revoke_tokenB

Revoke the current access token

Inputs: no named parameters.

search_fide_playersC

Search FIDE players by name

Inputs: name (required).

search_teamsC

Search for teams

Inputs: text (required), page.

send_messageC

Send a private message to another player

Inputs: username (required), text (required).

set_kid_modeC

Set kid mode status

Inputs: value (required).

set_tokenB

Set your Lichess API token

Inputs: token (required).

test_tokensC

Test multiple OAuth tokens

Inputs: tokens (required).

unblock_userC

Unblock a user

Inputs: username (required).

unfollow_userC

Unfollow a player

Inputs: username (required).

upgrade_to_botA

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

Inputs: no named parameters.

withdraw_from_arenaC

Withdraw from an arena tournament

Inputs: tournamentId (required).

withdraw_from_simulC

Withdraw from a simul

Inputs: simulId (required).

withdraw_from_swissC

Withdraw from a Swiss tournament

Inputs: swissId (required).

write_in_chatC

Write in the chat of a board game

Inputs: gameId (required), room (required), text (required).

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    C2.9/5.0

    Scored across 88 tools

    Disambiguation4/5

    Most tools have distinct purposes, such as 'create_arena' for tournaments and 'make_board_move' for gameplay, but there is some overlap between 'make_board_move' and 'make_move' which could cause confusion. Descriptions clarify that 'make_board_move' is for board games and 'make_move' for ongoing games, but the similarity in naming might lead to misselection without careful reading.

    Naming Consistency5/5

    Tool names consistently follow a verb_noun pattern, such as 'accept_challenge', 'export_game', and 'get_user_profile'. There are no deviations in naming conventions, making the set predictable and easy to parse for agents.

    Tool Count2/5

    With 88 tools, the count is excessive for the Lichess domain, leading to potential overwhelm and inefficiency. While the server covers many features, the high number suggests over-fragmentation, such as having separate tools for each tournament type (arena, swiss, simul) and multiple export functions, which could be consolidated.

    Completeness5/5

    The tool set comprehensively covers the Lichess domain, including user management, gameplay, tournaments, puzzles, studies, broadcasts, and team interactions. There are no obvious gaps; it supports full CRUD operations and lifecycle management across all major features, ensuring agents can handle diverse tasks without dead ends.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    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
    • F
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that exposes Stockfish chess analysis to LLM chat clients, enabling move analysis, game review, and explanation of engine choices.
      -
    • A
      license
      A
      quality
      D
      maintenance
      MCP server that exposes the Lichess public API through tools for querying player profiles, games, analysis, openings, puzzles, and tournaments, allowing natural-language chess questions without an API key.
      8
      MIT