Labsco
MCP SERVER

Stockfish

by sonirico

Talk to the Stockfish chess engine over UCI, with sessions that keep their position.

Games, Entertainment & Fandom
Summary
A thin, honest UCI bridge — the strength is Stockfish's.

Because it passes UCI through rather than inventing an abstraction, anything the engine understands works, and the choice between searching to a depth and thinking for a fixed number of milliseconds stays yours. The session model is what makes it usable in a conversation: the position persists between calls instead of being resent each time.

What it is

A Go server that bridges an assistant to Stockfish over the UCI protocol, running several concurrent engine sessions and returning every answer as JSON.

What you get
  • UCI passed straight through — `uci`, `isready`, `position startpos`, `position fen [FEN]`, `go`, `go depth [n]`, `go movetime [ms]`, `stop`, `quit`
  • A `command` parameter and an optional `session_id`; leave the session out and one is created for you
  • Concurrent sessions, each keeping its own UCI state between calls, so several positions can be analysed side by side
  • Structured responses: status, session id, the command sent, the engine's reply lines, and an error field when something went wrong
  • Sessions cleaned up on quit or on timeout, with a cap so a runaway loop cannot fork-bomb the machine
Requirements

A Stockfish binary on the machine — `MCP_STOCKFISH_PATH` points at it and defaults to `stockfish` on PATH. Clone the repo and `make install` to build the server. stdio is the default mode; `MCP_STOCKFISH_SERVER_MODE=http` switches to HTTP with host and port variables. `MCP_STOCKFISH_MAX_SESSIONS` defaults to 10, session timeout to 30m, command timeout to 30s.

Setup effort

One command — mcp-stockfish