ChessGraph MCP
A local layer for personalized chess coaching
Connect an MCP-capable agent to personal game history, a positional knowledge
graph, and reproducible Stockfish analysis—without giving the model unrestricted
database access.

Deterministic analysis · Personal evidence · Typed MCP tools · Read-only by design
Why ChessGraph?
A chess engine can calculate excellent moves, but it does not know your history.
A database can reveal recurring mistakes, but it cannot calculate the best move
in a new position. A language model can explain ideas, but it should not invent
the chess evidence behind them.
ChessGraph MCP separates those responsibilities:
-
Stockfish calculates candidate moves, evaluations, WDL, and principal variations.
-
PostgreSQL remembers games, move telemetry, openings, endgames, and historical engine evaluations.
-
Neo4j connects positions, your moves and your opponents' moves, theory moves, engine best moves, each game's path and milestones (where it left book, where it reached the endgame), mistakes, openings and endgame patterns.
-
The retrieval API serves those same reads to the interface, without asking the model to fetch the page.
-
Claude explains the combined evidence as a personalized lesson: in Claude
Code through the chessgraph plugin, and in the interface through the in-app
coach. Both run on your Claude Code login (your subscription); no API key is
needed.
The design principle is simple: the engine searches, deterministic code
validates, the databases provide context, and the model explains only the
evidence it receives.
Architecture
flowchart LR
subgraph sources [Data sources]
pgn["Chess.com PGN archives"]
openings["Lichess opening theory"]
endgames["Endgame Atlas benchmarks"]
end
subgraph ingestion [Deterministic ingestion]
normalizer["ETL and FEN normalization"]
backfill["Historical Stockfish backfill"]
graphSync["PostgreSQL to Neo4j sync"]
end
subgraph knowledge [Local evidence stores]
postgres[("PostgreSQL: games and telemetry")]
neo4j[("Neo4j: position graph")]
end
subgraph runtime [Read paths]
api["FastAPI retrieval + in-app coach"]
pgMcp["PostgreSQL MCP: 9 tools"]
graphMcp["Neo4j MCP: 8 tools"]
sfMcp["Stockfish MCP: 3 tools"]
stockfish["Stockfish UCI"]
end
ui["React coach"]
host["Claude Code + chessgraph plugin"]
coach["Evidence-backed coaching response"]
pgn --> normalizer
openings --> normalizer
endgames --> normalizer
normalizer --> postgres
postgres -->|"unevaluated moves"| backfill
backfill -->|"scores and CPL"| postgres
postgres --> graphSync
graphSync --> neo4j
ui -->|"page facts"| api
ui -->|"questions (SSE)"| api
api -->|"Agent SDK, your login"| claudeCode["Claude Code: Opus 5.5, effort low"]
api -->|"repository reads"| postgres
api -->|"repository reads"| neo4j
api -->|"bounded search"| stockfish
host -->|"typed MCP calls"| pgMcp
host -->|"typed MCP calls"| graphMcp
host -->|"typed MCP calls"| sfMcp
pgMcp -->|"parameterized reads"| postgres
graphMcp -->|"bounded traversals"| neo4j
sfMcp -->|"serialized UCI"| stockfish
host --> coach
The ETL layer writes data. The MCP servers and the retrieval API only read.
They call the same repositories in chess_mcp/. MCP tools stay typed and
bounded for Claude. The API serves the facts the interface can draw before a
question is asked, such as the rating-band recap and the ranked training plan.
Claude explains; it does not assemble the page.
What the agent can ask
| Evidence source | Best suited for | MCP capabilities |
|---|
| PostgreSQL | Game selection, longitudinal statistics, move records, openings, endgames, ranked coaching briefs | 9 curated tools, paginated move retrieval, statement timeouts |
| Neo4j | Theory versus personal choices, transpositions, recurring positions, graph context | 8 curated tools, anchored queries, maximum traversal depth |
| Stockfish | Fresh position analysis, candidate comparison, WDL, legal variations | MultiPV, same-root move comparison, line validation |
Examples:
-
“Show my largest rapid-game mistakes and explain the top three.”
-
“Where did I leave opening theory, and what did I usually play instead?”
-
“Do different move orders in my games transpose into this position?”