mcp-stockfish
๐ MCP server connecting AI systems to Stockfish chess engine
claude mcp add --transport stdio sonirico-mcp-stockfish mcp-stockfish \ --env MCP_STOCKFISH_LOG_LEVEL="info"
How to use
mcp-stockfish exposes a bridge between a Large Language Model and the Stockfish chess engine via the MCP protocol. It supports multiple concurrent Stockfish sessions and provides a full UCI command surface (uci, isready, position startpos, position fen, go, go depth, go movetime, stop, quit). This lets your AI issue standard UCI commands and receive structured JSON responses, enabling multi-position analysis and long-running evaluations without forcing you to manage engine lifecycles manually. The server can run in stdio mode for local usage or in http mode for web-scale deployments, and it can be started with or without a custom Stockfish binary path. The tool is designed to handle concurrent sessions, maintain UCI state per session, and clean up resources when sessions timeout or are closed.
How to install
Prerequisites:
- Git
- Go installed on your system (the project is Go-based / MCP-go powered)
- Build tools (make)
- Optional: Docker if you prefer containerized usage
Install steps:
-
Clone the repository: git clone https://github.com/sonirico/mcp-stockfish cd mcp-stockfish
-
Build / install the binary using the project's Makefile: make install
-
Run in stdio mode (default): ./mcp-stockfish
-
Run in HTTP mode (if you want web-scale access): MCP_STOCKFISH_SERVER_MODE=http ./mcp-stockfish
-
If you want to customize the Stockfish binary path, export the path before starting: export MCP_STOCKFISH_PATH=/path/to/stockfish ./mcp-stockfish
-
Optional: run via container (Docker-ready): docker build -t mcp-stockfish . docker run -p 8080:8080 -e MCP_STOCKFISH_SERVER_MODE=http mcp-stockfish
Additional notes
Environment variables to be aware of:
- MCP_STOCKFISH_SERVER_MODE: stdio (default) or http
- MCP_STOCKFISH_HTTP_HOST / MCP_STOCKFISH_HTTP_PORT: for HTTP mode
- MCP_STOCKFISH_PATH: path to Stockfish binary (defaults to 'stockfish')
- MCP_STOCKFISH_MAX_SESSIONS / SESSION_TIMEOUT / COMMAND_TIMEOUT: tune concurrency and timeouts
- Logging: MCP_STOCKFISH_LOG_LEVEL, MCP_STOCKFISH_LOG_FORMAT, MCP_STOCKFISH_LOG_OUTPUT
Tips:
- For HTTP mode, ensure the host/port are reachable by your clients and proxies.
- Use the env-based integration example to embed the MCP server in higher-level orchestrations.
- Monitor sessions and timeouts to prevent resource exhaustion in long-running analyses.
Related MCP Servers
mcp-language
mcp-language-server gives MCP enabled clients access semantic tools like get definition, references, rename, and diagnostics.
go
deprecated: use the official MCP sdk! (https://github.com/modelcontextprotocol/go-sdk) / โก A type-safe, intuitive Go SDK for building MCP servers with ease and confidence
mcp
๐ค Taskade MCP ยท Official MCP server and OpenAPI to MCP codegen. Build AI agent tools from any OpenAPI API and connect to Claude, Cursor, and more.
go-utcp
Official Go implementation of the UTCP
sandbox
A Model Context Protocol (MCP) server that enables LLMs to run ANY code safely in isolated Docker containers.
chromedp
MCP server for browser automation using chromedp