Skip to main content
Glama
indulge

Stockfish MCP Server

by indulge

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.


Related MCP server: Chess MCP Server

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's python) 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


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).

Available Tools

7 tools
analyze_positionB

Analyze a chess position with Stockfish and return the evaluation and best lines.

ParametersJSON Schema
NameRequiredDescriptionDefault
fenNoPosition in FEN notation. Omit for the standard starting position.
depthNoSearch depth (1-30). Ignored if movetime_ms is given.
multipvNoNumber of top lines to return (1-10).
movetime_msNoSearch time budget in milliseconds (1-60000). Overrides depth.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

B3.1/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description does not disclose behavioral traits such as being read-only, authentication needs, rate limits, or error behavior. The tool is likely read-only, but this is not stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence of 14 words, front-loaded with the action, and contains no extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With an output schema present, the description need not detail return values. However, it does not mention error handling or prerequisites like valid FEN, leaving some gaps for a tool with multiple parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so baseline is 3. The description adds no additional parameter context beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states 'Analyze a chess position with Stockfish and return the evaluation and best lines', specifying the engine and output. However, it does not differentiate from sibling tool 'evaluate_position', which may have similar functionality.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives like evaluate_position or get_best_move. No prerequisites or context for use are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

apply_movesA

Apply a sequence of moves to a position and return the resulting FEN.

Useful for playing out a line without the server holding game state.

ParametersJSON Schema
NameRequiredDescriptionDefault
fenNoStarting position in FEN. Omit for the standard starting position.
movesYesMoves to play in order, each in SAN (e.g. "Nf3") or UCI (e.g. "g1f3").

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so the description must disclose behavior. It explains the tool returns a result and implies no side effects, but lacks details on permissions or limitations. It is adequate but minimal.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no fluff. The action is front-loaded. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a simple tool with 2 parameters, full schema coverage, and an output schema (implied), the description is sufficient. It lacks details on output format, but that's covered by the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description explains 'fen' can be omitted for the standard start and 'moves' are in SAN or UCI, which repeats the schema. No additional value beyond schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool applies a sequence of moves to a position and returns a FEN. The verb 'apply' and resource 'moves' are specific, and it distinguishes from sibling tools like 'analyze_position' or 'get_best_move'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description says 'useful for playing out a line without the server holding game state,' which gives clear context. It doesn't explicitly state when not to use it, but the context is sufficient for an agent to decide.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

engine_infoA

Return the Stockfish engine's name, author, and a few configurable options.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It only states it returns info, implying a read-only operation. No mention of side effects, performance, or dependencies. Lacks detail on behavioral traits beyond basic retrieval.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Single sentence with the main verb 'Return' front-loaded. No superfluous words. Perfectly concise and structured.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and an existing output schema, the description covers the essential return values. Missing context about when to invoke (e.g., before other operations) is a minor gap, but overall sufficient for a simple info tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters exist, so baseline is 4. The description adds meaning by specifying the fields returned (name, author, configurable options), which is helpful. However, 'a few configurable options' is slightly vague but acceptable.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns Stockfish engine's name, author, and configurable options, using a specific verb 'Return' and resource 'engine info'. It effectively distinguishes from sibling tools (e.g., analyze_position, get_best_move) which focus on chess analysis rather than engine metadata.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No explicit when-to-use or when-not-to-use guidance is provided. However, the purpose is intuitive: use when needing engine metadata. The sibling tools are all chess operations, so usage context is implied but not stated.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

evaluate_positionA

Quickly evaluate a position and return the score and best move.

A lighter, faster version of analyze_position (single line, shallower default depth). Score is from White's point of view.

ParametersJSON Schema
NameRequiredDescriptionDefault
fenNoPosition in FEN. Omit for the starting position.
depthNoSearch depth (1-30), default 12.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It mentions return values and perspective (White's point of view), but does not disclose potential side effects, required engine state, or nondestructive nature. Adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences with no wasted words. Front-loaded with purpose, then differentiation. Excellent structure.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given output schema exists, description need not detail return values. It does mention score and best move. Low complexity (2 optional params). Could mention that it's for chess position evaluation, but sibling tools imply domain. Sufficiently complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with good parameter descriptions. Description adds minimal extra meaning beyond schema (only the perspective note), not enhancing parameter semantics. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool evaluates a position and returns score and best move, and distinguishes itself from sibling 'analyze_position' by noting it is lighter, faster, single line, with shallower default depth. Verb+resource is specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Explicitly compares to analyze_position, guiding when to use this lighter version. Does not list exclusions or when not to use, but the context is clear enough for an agent.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_best_moveA

Pick a move for the side to move, optionally at reduced strength.

ParametersJSON Schema
NameRequiredDescriptionDefault
eloNoTarget playing strength in Elo (~1320-3190); enables UCI_LimitStrength.
fenNoPosition in FEN. Omit for the starting position.
depthNoSearch depth (1-30). Ignored if movetime_ms is given.
movetime_msNoTime budget in ms (1-60000). Overrides depth.
skill_levelNo0 (weakest) to 20 (full strength) for casual play.

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden. It discloses 'optionally at reduced strength' but does not explain what that entails (e.g., engine behavior, strength controls). It does not describe side effects, authorization needs, or internal mechanics beyond the basic pick action.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, clear sentence that front-loads the purpose. Every word earns its place; no unnecessary information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the presence of an output schema (not shown), the description need not explain return values. It covers the core action and optional reduced strength. However, it omits mention that the result is the best move from an engine, which would enhance completeness for a tool with 5 parameters.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema coverage is 100%, so each parameter is already described. The description adds only a hint about reduced strength (related to elo/skill_level) but no new meaning beyond the schema. Baseline 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Pick a move for the side to move, optionally at reduced strength' clearly states the tool's purpose with a specific verb ('Pick') and resource ('move for the side to move'). It distinguishes from siblings like analyze_position or evaluate_position by focusing on selecting a move.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description offers implied usage (when you need a move) but does not explicitly state when to use this tool versus alternatives like analyze_position, nor does it provide guidance on when to use reduced strength or full strength. No exclusions or alternative suggestions are given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

visualize_boardA

Render a position as a text board for human reading.

ParametersJSON Schema
NameRequiredDescriptionDefault
fenNoPosition in FEN. Omit for the starting position.
unicodeNoUse Unicode chess piece glyphs (True) or ASCII letters (False).

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It correctly indicates a read-only operation via 'Render' and 'for human reading', implying no side effects. However, it could explicitly state that it does not modify state.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no wasted words. Every word earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the simple parameters and the presence of an output schema, the description is nearly complete. It could mention that the output is a string or that unicode affects presentation, but the schema covers those.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description does not add meaning beyond the schema; it does not explain the fen or unicode parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Render', the resource 'position', and the output 'text board for human reading'. It distinguishes this tool from siblings like analyze_position or get_best_move, which focus on analysis rather than visualization.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for visualizing a board but provides no explicit guidance on when to use this tool versus alternatives like analyze_position. It lacks a statement of when not to use it or any prerequisites.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 7 tool updatesv0.1.0
    • First observedanalyze_position
    • First observedapply_moves
    • First observedengine_info
    • First observedevaluate_position
    • First observedget_best_move
    • First observedget_legal_moves
    • First observedvisualize_board

TDQS

A3.6/5.0

Scored across 7 tools

Disambiguation3/5

There is overlap between analyze_position, evaluate_position, and get_best_move, as all provide position evaluation or move suggestions. The descriptions attempt to differentiate them, but an agent may struggle to select the appropriate tool.

Naming Consistency4/5

All tool names use snake_case and generally follow a verb_noun pattern, with verbs like get_, analyze_, evaluate_, and apply_. However, the mix of get_ with other verbs like analyze_ and evaluate_ introduces minor inconsistency.

Tool Count5/5

With 7 tools, the server covers core chess analysis and interaction functions without unnecessary bloat. Each tool contributes to a clear purpose, and the count is ideal for the domain.

Completeness4/5

The tool set covers essential operations: analysis, move generation, board visualization, and applying moves. Minor gaps include lacking explicit start_position loading or customizable depth options, but the surface is sufficient for typical stateless analysis use cases.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Provides an interactive chess game experience through MCP tools with a web-based chessboard interface. Enables users to play chess games, make moves using standard algebraic notation, and manage persistent game state across sessions.
    12 npm
    5
    Apache 2.0
  • F
    license
    A
    quality
    D
    maintenance
    Enables chess gameplay and interaction through MCP protocol. Allows users to play chess games, make moves, and manage chess sessions through natural language commands.
    2
    -
  • A
    license
    Not graded
    quality
    B
    maintenance
    An MCP bridge that provides an interface to UCI-compatible chess engines like Stockfish for analyzing positions and retrieving best moves. It enables users to interact with chess engines through commands for position management, engine information, and move calculation.
    2
    MIT