Stockfish MCP Server
Enables chess analysis and move generation using the Stockfish engine via MCP tools, allowing clients to evaluate positions, get best moves, apply moves, and visualize boards.
README
Stockfish MCP Server
A local Model Context Protocol (MCP) server that exposes the Stockfish chess engine to any MCP client (Claude Desktop, Claude Code, Cline, Continue, your own client, …).
It speaks MCP over stdio. All tools are stateless — every call takes a FEN string, so the server holds no game state.
Tools
| Tool | Purpose |
|---|---|
analyze_position |
Evaluate a position; returns score (White POV), best move, and principal variation(s). Supports multipv, depth, or movetime_ms. |
get_best_move |
Pick a move for the side to move. Optional skill_level (0–20) or elo (~1320–3190) to play at reduced strength. |
evaluate_position |
Lighter/faster single-line evaluation. |
apply_moves |
Play a sequence of SAN/UCI moves and return the resulting FEN. |
get_legal_moves |
List all legal moves (SAN + UCI). |
visualize_board |
Render a position as a Unicode/ASCII board. |
engine_info |
Engine name/version and default options. |
Every tool defaults to the standard starting position when fen is omitted.
Scores are from White's point of view; mate is reported as #±N.
Dependencies
| Dependency | Version | Why |
|---|---|---|
| Python | ≥ 3.14 | Runtime (see .python-version). |
python-chess (chess) |
≥ 1.11.2 | Board logic + UCI engine driver. |
FastMCP (fastmcp) |
≥ 3.4.2 | MCP server framework. |
| Stockfish binary | 17/18+ | The engine itself. Not bundled (it is >100 MB); download it — see below. |
Python deps are declared in pyproject.toml and pinned in uv.lock.
uv is the recommended installer/runner, but plain
pip/venv works too.
Install
# 1. Get the code
git clone <this-repo-url>
cd stockfish-mcp-server
# 2. Get the Stockfish engine binary (NOT in git — too large).
# This downloads it to engine/stockfish:
./engine/download-stockfish.sh
# ...or set SF_ASSET to match your CPU/OS, e.g.:
# SF_ASSET=stockfish-ubuntu-x86-64-avx512 ./engine/download-stockfish.sh
# Browse builds: https://github.com/official-stockfish/Stockfish/releases/latest
# Already have Stockfish? Skip this and set STOCKFISH_PATH (see Configuration).
# 3a. Install dependencies with uv (recommended)
uv sync
# 3b. ...or with pip
python -m venv .venv && . .venv/bin/activate
pip install "chess>=1.11.2" "fastmcp>=3.4.2"
Optional: install as a command
The project is packaged with a stockfish-mcp console-script entry point:
uv tool install . # puts `stockfish-mcp` on your PATH (~/.local/bin)
# or: pip install .
Run
uv run python server.py # run the stdio server (uv)
# or, if installed as a command:
stockfish-mcp
The server communicates over stdio and is normally launched by your MCP client (below), not by hand. Stop it with Ctrl-C / SIGTERM.
Use it with an MCP client
MCP stdio clients launch the server as a subprocess. Point your client at either
uv run python /abs/path/to/server.py or the installed stockfish-mcp command,
and set STOCKFISH_PATH if the binary isn't at engine/stockfish.
A ready-to-edit example is in examples/mcp-config.json.
Generic MCP config (the shape most clients accept — e.g. a mcpServers map in
Claude Desktop's claude_desktop_config.json, or .mcp.json):
{
"mcpServers": {
"stockfish": {
"command": "uv",
"args": ["run", "python", "/abs/path/to/stockfish-mcp-server/server.py"],
"env": {
"STOCKFISH_PATH": "/abs/path/to/stockfish-mcp-server/engine/stockfish"
}
}
}
}
If you installed the command (uv tool install .), use it directly:
{
"mcpServers": {
"stockfish": {
"command": "stockfish-mcp",
"env": { "STOCKFISH_PATH": "/abs/path/to/engine/stockfish" }
}
}
}
Claude Code (CLI) — register in user scope so it's available everywhere:
claude mcp add stockfish -s user \
-e STOCKFISH_PATH=/abs/path/to/engine/stockfish \
-- stockfish-mcp
claude mcp list # should show: stockfish … ✔ Connected
Then ask the model things like "analyze this FEN at depth 20" or "play a move against me at 1500 Elo."
Tip: launching the executable directly (the installed
stockfish-mcp, or the venv'spython) rather than via a wrapper makes the server the client's direct child process, so its shutdown signal handling works cleanly.
Configuration (environment variables)
| Variable | Default | Meaning |
|---|---|---|
STOCKFISH_PATH |
engine/stockfish (next to server.py) |
Path to the Stockfish binary. |
STOCKFISH_THREADS |
min(4, ncpu) |
Search threads. |
STOCKFISH_HASH_MB |
256 |
Transposition-table size (MB). |
Per-call search cost is capped (depth ≤ 30, movetime ≤ 60 s, multipv ≤ 10) so a single request can't stall the stdio loop.
Test
uv run python test_server.py # end-to-end smoke test via an in-memory MCP client
It lists the tools and exercises analysis, mate detection, reduced-strength play, move application, and error handling — no external MCP client needed.
Files
server.py The MCP server (FastMCP + python-chess)
test_server.py End-to-end smoke test
pyproject.toml Package metadata + dependencies (entry point: stockfish-mcp)
uv.lock Pinned dependency versions
.python-version Python version (3.14)
engine/
download-stockfish.sh Fetches the engine binary (binary itself is gitignored)
LICENSE-stockfish.txt Stockfish license (GPLv3)
References
- Model Context Protocol — https://modelcontextprotocol.io
- FastMCP — https://gofastmcp.com/
- python-chess — https://python-chess.readthedocs.io/
- Stockfish — https://stockfishchess.org/ · releases: https://github.com/official-stockfish/Stockfish/releases/latest
- uv — https://docs.astral.sh/uv/
License
This server's code is provided as-is. Stockfish is licensed under GPLv3 — see
engine/LICENSE-stockfish.txt. If you redistribute the Stockfish binary, you must
comply with the GPLv3 (including providing source).
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。