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.
Install the Lichess Integration for Claude Desktop automatically:
npx -y @smithery/cli install @karayaman/lichess-mcp --client claude
git clone https://github.com/karayaman/lichess-mcp.git
cd lichess-mcp
npm install
.env
file with your Lichess API token:LICHESS_TOKEN=your-lichess-api-token
npm run build
npm install -g
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": "*"
}
}
}
}
You can set your Lichess API token in two ways:
.env
file or system):LICHESS_TOKEN=your-lichess-api-token
set_token
tool during runtime:set_token({
token: "your-lichess-api-token"
});
Get your token 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
});
// 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
) - for some endpoints onlyThe 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.
If you encounter connection issues:
npm install -g
)lichess-mcp
command is in your PATHmcpServers
not mcp_servers
)Test the integration by asking Claude:
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.
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.
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"
}
}
}
}
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.
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.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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