MCP server for playing chess against AI
Configuration
View docs{
"mcpServers": {
"jiayao-mcp-chess": {
"command": "uvx",
"args": [
"mcp-chess"
]
}
}
}You can play chess against any large language model through an MCP server that exposes a chess board, legal moves, and move execution. This setup lets you start a game, request board states, review positions from PGN, and analyze moves with your preferred LLM integrations.
Launch an MCP client and connect to the chess MCP server you configured. You can start a new game so you play white by default, or choose to let the server assign colors. Use the available tools to inspect the board, check whose turn it is, list legal moves, and make moves using SAN notation. You can also search a PGN for a specific position to analyze a board state.
Prerequisites: Ensure you have the MCP runtime available and the uvx command is accessible on your system. You will also need access to your MCP configuration workflow where you can add or modify MCP server connections.
Add the following MCP server configuration to your MCP setup to enable the chess server.
{
"mcpServers": {
"chess": {
"command": "uvx",
"args": [
"mcp-chess"
]
}
}
}The chess MCP server provides a set of tools to interact with the game state. Use get_board_visualization() to see the current board as an image, get_turn() to know whose move it is, get_valid_moves() to list legal moves in UCI notation, make_move(move_san) to play a move, new_game(user_plays_white) to reset and start a new game, and find_position_in_pgn(pgn_string, condition) to locate a board position within a PGN string.
Start a new game with you playing white, then request the current board image and legal moves, and finally make a move by SAN, for example: SAN move like e4.
Keep the MCP configuration secure and restrict access to the MCP client that can issue game commands. Do not expose SAN moves or PGN data to untrusted clients. Regularly restart the chess server during maintenance windows to ensure clean state and correct board rendering.
Provides the current state of the chessboard as an image. The board orientation flips based on your assigned color.
Indicates whose turn it is, either 'white' or 'black'.
Lists all legal moves for the current player in UCI notation (e.g., 'e2e4', 'g1f3'). Returns an empty list if the game is over.
Executes a move on the board using Standard Algebraic Notation (SAN) and returns the move in SAN and UCI, the new board FEN, and game status.
Starts a new game, resetting the board. By default, you play white and can set your color preference. Returns a confirmation message.
Finds the first board position in a PGN string matching a condition like 'bishop on a3' and returns an image of that board state.