"Speak to your chess engine"
Babelfish is a chess analysis tool that uses Stockfish via MCP (Model Context Protocol) to provide context-rich analysis of chess positions and games. It bridges the gap between powerful chess engines and language models, making chess analysis more accessible and conversational.
This project uses uv for dependency management:
# Clone the repository
git clone <repository-url>
cd babelfish
# Install dependencies
uv sync
# Install Stockfish engine
# Ubuntu/Debian:
sudo apt install stockfish
# macOS:
brew install stockfish
# Windows:
# Download from https://stockfishchess.org/download/
The most user-friendly way to use Babelfish is through its web interface. This provides an intuitive chat-based interface for chess analysis.

Set up your OpenRouter API key:
export OPENROUTER_API_KEY="your-api-key-here"
Start the web interface:
uv run python start_web.py
Open your browser and go to http://localhost:5000
⚠️ Important Cost Warning: Using OpenRouter models incurs costs based on token usage. Monitor your usage to avoid unexpected charges.
Recommended Model: Based on testing, openai/o1 provides the best chess analysis quality, offering superior positional understanding and tactical insights compared to other models.
Alternative Models: You can also try:
anthropic/claude-3.5-sonnet - Good balance of cost and qualityopenai/gpt-4o - Strong general performancemeta-llama/llama-3.1-70b-instruct - More cost-effective optionOnce the web interface is running, you can:
Run the demo to test the chess analyzer:
python main.py
Start the MCP server for integration with other tools:
python main.py --mcp
To use Babelfish with Claude Desktop in stdio mode on the same system:
Install Stockfish (see installation section above)
Configure Claude Desktop by adding this to your claude_desktop_config.json:
{
"mcpServers": {
"babelfish": {
"command": "uv",
"args": ["run", "python", "main.py", "--mcp"],
"cwd": "/path/to/your/babelfish"
}
}
}
Note: Replace /path/to/your/babelfish with the actual path to your babelfish directory.
To run Babelfish in WSL while using Claude Desktop on Windows:
Install Stockfish in WSL (see installation section above)
Configure Claude Desktop on Windows by adding this to your claude_desktop_config.json:
{
"mcpServers": {
"babelfish": {
"command": "wsl",
"args": ["-d", "Ubuntu", "bash", "-c", "cd ~/babelfish && uv run python main.py --mcp"],
"cwd": "C:\\"
}
}
}
Important Notes for WSL Setup:
Ubuntu with your WSL distribution name if different (check with wsl -l in Windows PowerShell)~/babelfish with the actual path to your babelfish directory in WSLuv and all dependencies are installed in the WSL environment, not WindowsAlternative WSL Configuration (if you have a specific WSL distribution):
{
"mcpServers": {
"babelfish": {
"command": "wsl.exe",
"args": ["--distribution", "Ubuntu-22.04", "--exec", "bash", "-c", "cd ~/babelfish && uv run python main.py --mcp"]
}
}
}
Configuration File Locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonRestart Claude Desktop after adding the configuration.
Verify Installation - You should see the Babelfish tools available in Claude Desktop:
analyze_position - Analyze a chess positionanalyze_game - Analyze a complete gameexplain_position - Get human-readable position explanationsOnce configured, you can ask Claude to analyze chess positions:
"Can you analyze this chess position: rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2"
Or analyze complete games:
"Please analyze this game: 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6"
analyze_positionAnalyzes a chess position using the Stockfish engine.
Parameters:
fen (required): Chess position in FEN notationdepth (optional): Analysis depth (default: 15)analyze_gameAnalyzes a complete chess game move by move.
Parameters:
moves (required): Array of moves in standard algebraic notationexplain_positionProvides human-readable explanations of chess positions.
Parameters:
fen (required): Chess position in FEN notationMake sure Stockfish is installed and accessible from your PATH:
# Test if Stockfish is available
stockfish
If not available, install using your system's package manager or download from stockfishchess.org.
claude_desktop_config.json is correctuv run python main.py --mcp from the command line# Check available WSL distributions
wsl -l -v
# Make sure your distribution is running
wsl -d Ubuntu
# Test the command from Windows PowerShell
wsl -d Ubuntu bash -c "cd ~/babelfish && uv run python main.py --mcp"
# In WSL, verify the project path exists
ls -la ~/babelfish/
# Make sure uv is installed in WSL
which uv
# Test stockfish in WSL
which stockfish
stockfish
wsl --installwsl -d Ubuntu (replace Ubuntu with your distro)sudo apt install stockfishFrom Windows Command Prompt or PowerShell:
# Test if WSL can access the project
wsl ls ~/babelfish/
# Test if the command works
wsl -d Ubuntu bash -c "cd ~/babelfish && python main.py"
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is open source. Please check the LICENSE file for details.
47 commits
Python
72.1%
HTML
27.9%
"Speak to your chess engine"
Babelfish is a chess analysis tool that uses Stockfish via MCP (Model Context Protocol) to provide context-rich analysis of chess positions and games. It bridges the gap between powerful chess engines and language models, making chess analysis more accessible and conversational.
This project uses uv for dependency management:
# Clone the repository
git clone <repository-url>
cd babelfish
# Install dependencies
uv sync
# Install Stockfish engine
# Ubuntu/Debian:
sudo apt install stockfish
# macOS:
brew install stockfish
# Windows:
# Download from https://stockfishchess.org/download/
The most user-friendly way to use Babelfish is through its web interface. This provides an intuitive chat-based interface for chess analysis.

Set up your OpenRouter API key:
export OPENROUTER_API_KEY="your-api-key-here"
Start the web interface:
uv run python start_web.py
Open your browser and go to http://localhost:5000
⚠️ Important Cost Warning: Using OpenRouter models incurs costs based on token usage. Monitor your usage to avoid unexpected charges.
Recommended Model: Based on testing, openai/o1 provides the best chess analysis quality, offering superior positional understanding and tactical insights compared to other models.
Alternative Models: You can also try:
anthropic/claude-3.5-sonnet - Good balance of cost and qualityopenai/gpt-4o - Strong general performancemeta-llama/llama-3.1-70b-instruct - More cost-effective optionOnce the web interface is running, you can:
Run the demo to test the chess analyzer:
python main.py
Start the MCP server for integration with other tools:
python main.py --mcp
To use Babelfish with Claude Desktop in stdio mode on the same system:
Install Stockfish (see installation section above)
Configure Claude Desktop by adding this to your claude_desktop_config.json:
{
"mcpServers": {
"babelfish": {
"command": "uv",
"args": ["run", "python", "main.py", "--mcp"],
"cwd": "/path/to/your/babelfish"
}
}
}
Note: Replace /path/to/your/babelfish with the actual path to your babelfish directory.
To run Babelfish in WSL while using Claude Desktop on Windows:
Install Stockfish in WSL (see installation section above)
Configure Claude Desktop on Windows by adding this to your claude_desktop_config.json:
{
"mcpServers": {
"babelfish": {
"command": "wsl",
"args": ["-d", "Ubuntu", "bash", "-c", "cd ~/babelfish && uv run python main.py --mcp"],
"cwd": "C:\\"
}
}
}
Important Notes for WSL Setup:
Ubuntu with your WSL distribution name if different (check with wsl -l in Windows PowerShell)~/babelfish with the actual path to your babelfish directory in WSLuv and all dependencies are installed in the WSL environment, not WindowsAlternative WSL Configuration (if you have a specific WSL distribution):
{
"mcpServers": {
"babelfish": {
"command": "wsl.exe",
"args": ["--distribution", "Ubuntu-22.04", "--exec", "bash", "-c", "cd ~/babelfish && uv run python main.py --mcp"]
}
}
}
Configuration File Locations:
~/Library/Application Support/Claude/claude_desktop_config.json%APPDATA%\Claude\claude_desktop_config.json~/.config/Claude/claude_desktop_config.jsonRestart Claude Desktop after adding the configuration.
Verify Installation - You should see the Babelfish tools available in Claude Desktop:
analyze_position - Analyze a chess positionanalyze_game - Analyze a complete gameexplain_position - Get human-readable position explanationsOnce configured, you can ask Claude to analyze chess positions:
"Can you analyze this chess position: rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq e6 0 2"
Or analyze complete games:
"Please analyze this game: 1.e4 e5 2.Nf3 Nc6 3.Bb5 a6 4.Ba4 Nf6"
analyze_positionAnalyzes a chess position using the Stockfish engine.
Parameters:
fen (required): Chess position in FEN notationdepth (optional): Analysis depth (default: 15)analyze_gameAnalyzes a complete chess game move by move.
Parameters:
moves (required): Array of moves in standard algebraic notationexplain_positionProvides human-readable explanations of chess positions.
Parameters:
fen (required): Chess position in FEN notationMake sure Stockfish is installed and accessible from your PATH:
# Test if Stockfish is available
stockfish
If not available, install using your system's package manager or download from stockfishchess.org.
claude_desktop_config.json is correctuv run python main.py --mcp from the command line# Check available WSL distributions
wsl -l -v
# Make sure your distribution is running
wsl -d Ubuntu
# Test the command from Windows PowerShell
wsl -d Ubuntu bash -c "cd ~/babelfish && uv run python main.py --mcp"
# In WSL, verify the project path exists
ls -la ~/babelfish/
# Make sure uv is installed in WSL
which uv
# Test stockfish in WSL
which stockfish
stockfish
wsl --installwsl -d Ubuntu (replace Ubuntu with your distro)sudo apt install stockfishFrom Windows Command Prompt or PowerShell:
# Test if WSL can access the project
wsl ls ~/babelfish/
# Test if the command works
wsl -d Ubuntu bash -c "cd ~/babelfish && python main.py"
Contributions are welcome! Please feel free to submit issues and pull requests.
This project is open source. Please check the LICENSE file for details.
47 commits
Python
72.1%
HTML
27.9%