使用说明
MCP国际象棋
A. 模型上下文协议 (MCP)服务器,提供 国际象棋功能 克劳德 AI 助理。
https://github.com/user-attachments/assets/324ed381-35f3-45b7-b877-127ef27fd97d
特性
此服务器实现了扩展Claude功能的工具,以:
- 从福赛斯·爱德华兹符号(FEN)字符串生成棋盘图像
- 建议下棋的下一步
- 检查搬家是否合法
Claude Desktop的安装
-
从下载最新的二进制文件 发布 页面:
- 对于Windows:
mcp-chess-windows.exe - 对于macOS:
mcp-chess-darwin - 对于Linux:
mcp-chess-linux
- 对于Windows:
-
使文件可执行(仅限macOS/Linux):
chmod +x mcp-chess-darwin # for macOS chmod +x mcp-chess-linux # for Linux -
对于macOS用户-绕过安全警告:
当您首次尝试运行应用程序时,macOS可能会显示安全警告,因为该应用程序未由已识别的开发人员签名。要绕过此问题:
- 右键单击(或控制单击)
mcp-chess-darwin文件 - 从上下文菜单中选择“打开”
- 在出现的对话框中单击“打开”
或者,您可以使用终端:
xattr -d com.apple.quarantine /path/to/mcp-chess-darwin这只需要做一次。
- 右键单击(或控制单击)
-
配置Claude桌面:
- 打开克劳德桌面
- 选择“设置”,然后单击“开发人员”选项卡
- 点击“编辑配置”
- 添加MCP服务器配置
- 保存文件
- 重新启动克劳德桌面
以下是MCP服务器配置的示例:
{
"mcpServers": {
"mcp-chess": {
"command": "/path/to/mcp-chess-binary"
}
}
}
与克劳德一起使用
正确配置后,您可以要求Claude执行各种与国际象棋相关的任务:
Show me the starting position of a chess game.
Let's play a chess game. Check that each move is legal. Suggest the best move to play.
Is Nf3 a legal move from the starting position?
What's a good move for white in this position: "rnbqkbnr/pppp1ppp/8/4p3/4P3/8/PPPP1PPP/RNBQKBNR w KQkq - 0 2"?
技术细节
发展
本项目由以下部分组成:
- Spring Boot
- Spring AI(MCP服务器实现)
- Java 21
- GraalVM本机编译
从源头构建
# Clone the repository
git clone https://github.com/alexandreroman/mcp-chess.git
cd mcp-chess
# Build with Maven
./mvnw clean package
# Build a native executable
./mvnw -Pnative native:compile
许可证
此项目根据Apache许可证2.0获得许可-请参阅 许可证 文件以获取详细信息。
鸣谢
- 国际象棋游戏 -Java国际象棋库
- 国际象棋图片 -棋盘渲染器
- Stockfish.online -国际象棋引擎API
- 春季AI -人工智能应用框架