Lichess国际象棋接口
STDIO用自然语言操作国际象棋平台
用自然语言操作国际象棋平台
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.
The server enables:
The Lichess API token can be set in two ways:
Environment variables: Add it to your .env
file in the project root or set it directly:
LICHESS_TOKEN=your-lichess-api-token
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
// 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 });
// 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 });
// 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" });
// 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 });
The Lichess API accepts moves in these formats:
e2e4
, g8f6
)e4
, Nf6
) - only for some endpointsThe Forsyth-Edwards Notation (FEN) is used to represent chess positions:
rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1
This represents:
The server provides detailed error messages for:
To install Lichess Integration for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @karayaman/lichess-mcp --client claude
Clone the repository:
git clone https://github.com/karayaman/lichess-mcp.git cd lichess-mcp
Install dependencies:
npm install
Configure environment variables:
Create a .env
file in the root directory:
LICHESS_TOKEN=your-lichess-api-token
Build the project:
npm run build
Install the package globally (recommended for Claude Desktop integration):
npm install -g
Start the server (for standalone usage):
npm start
To use this MCP server with Claude Desktop:
Locate your Claude Desktop configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
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.
(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" } } } }
Restart Claude Desktop to apply the changes.
Test the integration by asking Claude about your Lichess account:
If you encounter issues with the MCP server connection:
npm install -g
lichess-mcp
command is available in your PATH (which lichess-mcp
)mcpServers
format instead of mcp_servers
)