How fuzzylabs/chess-agent works
Chess Agent is an MCP server that lets an LLM client operate Lichess games. The user-to-result workflow is login, create an AI or person game, inspect the board and move history, check whose turn it is, submit moves, and optionally resign. The server also exposes account information and returns structured game and board data. The graph separates MCP entry points, game operations, and shared domain types. Source excerpts show the Lichess calls and internal helper calls; README statements support the client interaction and documented game modes.
Main entry points: schemas.py Response schemas · server.py Board representation · exceptions.py Game errors
Components 16
MCP entry
- MCP server
chess_agent/server.py
Game operations
- Login session
chess_agent/server.py - Account lookup
chess_agent/server.py - Create AI game
chess_agent/server.py - Create person game
chess_agent/server.py - Turn status
chess_agent/server.py - Game state
chess_agent/server.py - Move history
chess_agent/server.py - Board representation
chess_agent/server.py - Submit move
chess_agent/server.py - End game
chess_agent/server.py
Shared domain
- Response schemas
chess_agent/core/schemas.py - Game errors
chess_agent/core/exceptions.py
Other components
- LLM client
- Lichess API
- Chess board parser
Connections 22
- LLM client → MCP server: calls tools
README.md - MCP server → Login session: registers tools
chess_agent/server.py - Login session → Lichess API: authenticates
chess_agent/server.py - Account lookup → Lichess API: fetches account
chess_agent/server.py - Account lookup → Response schemas: returns account data
chess_agent/server.py - Create AI game → Lichess API: creates AI game
chess_agent/server.py - Create AI game → Response schemas: validates response
chess_agent/server.py - Create person game → Lichess API: creates person game
chess_agent/server.py - Create person game → Response schemas: validates response
chess_agent/server.py - Turn status → Move history: checks history
chess_agent/server.py - Move history → Game state: reads state
chess_agent/server.py - Game state → Lichess API: streams state
chess_agent/server.py - Game state → Response schemas: parses state
chess_agent/server.py - Turn status → Response schemas: returns turn status
chess_agent/server.py - Board representation → Lichess API: reads game moves
chess_agent/server.py - Board representation → Chess board parser: parses FEN
chess_agent/server.py - Board representation → Move history: loads history
chess_agent/server.py - Board representation → Response schemas: returns board data
chess_agent/server.py - Submit move → Lichess API: submits move
chess_agent/server.py - End game → Lichess API: resigns game
chess_agent/server.py - MCP server → Game errors: raises game errors
chess_agent/server.py - Game errors → Response schemas: uses game messages
chess_agent/core/exceptions.py