Chess MCP Server
A Model Context Protocol (MCP) server that provides a chess-playing environment backed by the Stockfish engine. Designed for use with LLM clients (like Claude Desktop) to ensure all chess moves are legal and engine-calculated.
Features
- Legal Move Validation: All moves are validated against chess rules
- Stockfish Integration: Uses the Stockfish chess engine for AI moves
- MCP Protocol: Communicates via JSON-RPC over stdio
- In-Memory Game State: Maintains multiple concurrent games
Installation
pip install chess-mcp
You'll also need to install Stockfish:
- Windows: Download from Stockfish website
- macOS:
brew install stockfish - Linux:
sudo apt install stockfish(or equivalent)
Usage
-
Set the
STOCKFISH_PATHenvironment variable to the path of your Stockfish executable:export STOCKFISH_PATH=/path/to/stockfish
-
Run the server:
python -m chess_mcp
MCP Tools
new_game()
Starts a new chess game from the standard initial position.
Returns:
game_id: Unique identifier for the gamefen: Current position in FEN notationlegal_moves: List of all legal moves in UCI format
make_move(game_id, move_uci)
Applies a human move to the game. The move must be in UCI format (e.g., "e2e4").
Parameters:
game_id: Identifier of the active gamemove_uci: Move in UCI format
Returns:
ok: Whether the move was legal and appliedfen: Updated board position (if move was legal)legal_moves: Updated list of legal moves
engine_move(game_id, depth=14)
Asks Stockfish to calculate and play one move for the side to move.
Parameters:
game_id: Identifier of the active gamedepth: Search depth for Stockfish (higher = stronger but slower)
Returns:
engine_move: The move played by Stockfish in UCI formatfen: Updated board position after the movelegal_moves: Updated list of legal moves
Development
To set up for development:
git clone https://github.com/yourusername/chess-mcp.git
cd chess-mcp
pip install -e .
License
MIT License
Metadata
Release files for chess-mcp 0.1.7
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chess_mcp-0.1.7.tar.gz | 33.1 kB | Without provenance | Details for chess_mcp-0.1.7.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chess_mcp-0.1.7-py3-none-any.whl | Python 3 | none | any | Details for chess_mcp-0.1.7-py3-none-any.whl |
Total release size: 37.2 kB
Release files / chess_mcp-0.1.7.tar.gz
| Download URL | chess_mcp-0.1.7.tar.gz |
|---|---|
| Size | 33.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a760e2aee0426885f72fa224b752a98eeeff65b23b756c2dbe9fb9766807644
|
|
BLAKE2b-256 checksum How to use checksums |
70aa0b4bc51f8b9dfd2aec82764dde8e9a519499d4161dd9e09e7c60f633a32d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / chess_mcp-0.1.7-py3-none-any.whl
| Download URL | chess_mcp-0.1.7-py3-none-any.whl |
|---|---|
| Size | 4.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7d5195659c1c08157e55521db117fd4cc9e5090fe8702a56382cc293d5ac9a2d
|
|
BLAKE2b-256 checksum How to use checksums |
8f45e2e2deeb750af5b6a007f8cc1b8f8339033d8965c739c68d8cd0f988575f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.9.21 {"installer":{"name":"uv","version":"0.9.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for chess-mcp 0.1.7
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.