Provides a chess environment with legal-move validation and Stockfish-driven AI moves via MCP over stdio.
Configuration
View docs{
"mcpServers": {
"11hritik11-chess-mcp": {
"command": "python",
"args": [
"-m",
"chess_mcp"
],
"env": {
"STOCKFISH_PATH": "YOUR_STOCKFISH_PATH"
}
}
}
}You run a Chess MCP Server that exposes a chess-playing environment backed by the Stockfish engine. It validates every move according to chess rules, uses Stockfish to compute AI moves, and communicates with your MCP clients via JSON-RPC over stdio while maintaining multiple active games in memory.
Start a new game from the initial position and obtain a unique game identifier along with the current board and all legal moves. You can then apply human moves in UCI format (for example, e2e4) to that game, or request Stockfish to play the next move for the side to move. The server ensures every move is legal and updates the board state for you and your client.
Prerequisites: Python 3.x and a working Python environment.
Install the Chess MCP package.
pip install chess-mcpInstall Stockfish for your platform.
# Windows
# Download from Stockfish official sources and place the executable in a known path
# macOS
brew install stockfish
# Linux
sudo apt install stockfishConfigure the environment to point to the Stockfish executable and start the server.
export STOCKFISH_PATH=/path/to/stockfish
python -m chess_mcpThe server runs as a local, in-memory MCP server that can handle multiple concurrent games. It exposes three main tools to your MCP clients: creating a new game, applying a human move, and requesting an engine move.
Starts a new chess game from the standard initial position. Returns a unique game_id, the current FEN, and the list of legal moves in UCI format.
Applies a human move to the specified game using a UCI-formatted move. Returns whether the move was accepted, the updated FEN, and the updated list of legal moves.
Asks Stockfish to compute and play one move for the side to move. Returns the engine's move in UCI format, the new FEN, and the updated list of legal moves.