An LLM agent built using Model Context Protocol to play online games
uvinstallable via brew.- Claude Desktop
- Create Lichess account
- Create API key.
- Add API key to a
.envfile in the projects root directory:API_KEY = ************
Set up project:
make project-setupcd chess_agentuv run mcp install server.pyTip
The above command updates the MCP config in Claude desktop. Whilst Claude Desktop only supports stdio transport the server can be directly executed with communication via sse transport and HTTP requests. For documentation on how to do this see direct_execution.md.
Note
If you have Claude Desktop open when you run the above command, you will need to restart it for the server to be available.
Can you please log into the Chess API and then create a game against an AI. Once the game has been created the opponent will make the first move. Can you use the previous moves and the layout of the board to determine what an optimal next move will be and then make your own move playing continuously back and forth until completion? Please use the UCI chess standard for your moves, e.g., e2e4.
- Ask agent to login and create a game against a user:
Can you please log into the Chess API and then create a game against the user .
- Once the game has been created and the opponent has connected and made their first move, the agent will make their move.
Once the game has been created the opponent will make the first move. Can you use the previous moves and the layout of the board to determine what an optimal next move will be and then make your own move playing continuously back and forth until completion? Please use the UCI chess standard for your moves, e.g., e2e4.
Warning
Common Issues:
ENOENTerror when opening Claude Desktop.
- This is due to Claude Desktop facing issues with running the server with a relative path to
uv. To fix this, you need to change thecommandin theclaude_desktop_config.jsonconfig to an absolute path. You can find the absolute path by runningwhich uvin your terminal.
- Not having
coreutilsinstalled.
- This is required for the
realpathcommand. You will see the following error in Claude logs:realpath: command not found. You can install it usingbrew install coreutils.
Application tests for the MCP server can be run with the following command:
uv run application_tests/tests.pyDocumentation for this project can be found in the docs directory. The following documentation is available:
- direct_execution.md: Documentation on how to run the server directly with
ssetransport and HTTP requests. - client-server-interaction.md: Documentation on how MCP clients and servers interact with each other and how clients process user queries.
