这是一个管理国际象棋游戏状态的MCP服务器,适用于LLMs/代理。它故意不建议走法。相反,它提供了以下工具:
get_status()中您可以使用uvx和Git URL来运行此MCP服务器,而无需克隆。用您的仓库信息替换占位符,并可选地指定标签/提交。
通用MCP配置(类似Inspector风格):
{
"servers": {
"chess-support-mcp": {
"transport": {
"type": "stdio",
"command": "uvx",
"args": [
"--from",
"git+https://github.com/danilop/chess-support-mcp.git",
"chess-support-mcp"
]
}
}
}
}
Claude Desktop mcpServers示例:
{
"mcpServers": {
"chess-support-mcp": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/danilop/chess-support-mcp.git",
"chess-support-mcp"
]
}
}
}
首次运行时,uvx会解析并构建包,这可能需要更长时间;后续运行将使用缓存。
使用uv run与stdio(无硬编码路径)。示例通用JSON配置:
{
"servers": {
"chess-support-mcp": {
"transport": {
"type": "stdio",
"command": "uv",
"args": ["run", "chess-support-mcp"]
}
}
}
}
通过使用占位符并在cwd中设置工作目录(推荐),或通过传递--project,包含项目路径而不硬编码特定路径:
选项A(推荐:设置工作目录):
{
"servers": {
"chess-support-mcp": {
"transport": {
"type": "stdio",
"command": "uv",
"args": ["run", "chess-support-mcp"],
"cwd": "<ABSOLUTE_PATH_TO_PROJECT>"
}
}
}
}
选项B(使用uv的项目标志):
{
"servers": {
"chess-support-mcp": {
"transport": {
"type": "stdio",
"command": "uv",
"args": ["run", "--project", "<ABSOLUTE_PATH_TO_PROJECT>", "chess-support-mcp"]
}
}
}
}
Claude Desktop配置(在其JSON设置中),使用mcpServers:
{
"mcpServers": {
"chess-support-mcp": {
"command": "uv",
"args": ["run", "chess-support-mcp"],
"cwd": "<ABSOLUTE_PATH_TO_PROJECT>"
}
}
}
create_or_reset_game() → 重置到初始位置。返回status(带有pieces映射),以及moves。get_status() → 返回FEN;side_to_move(白/黑);fullmove_number;halfmove_clock;ply_count;last_move_uci;last_move_san;who_moved_last;将军标志;is_game_over;当游戏结束时的result;以及用于机器推理的pieces映射。add_move(uci: str) → 如果合法则应用一步(例如,e2e4,g1f3,升变如e7e8q)。返回{ accepted, status },成功时还返回moves和moves_detailed。失败时返回{ accepted:false, reason:"illegal"|"parse_error", expected_turn? },status反映未改变的位置。is_legal(uci: str) → 检查当前位置下UCI走法的合法性。list_moves() → 到目前为止所有UCI走法。list_moves_detailed() → 所有走法,包括ply,side,uci,san。last_moves(n: int=1) → 最后N步UCI走法。last_moves_detailed(n: int=1) → 最后N步走法,包括ply,side,uci,san。board_ascii() → ASCII棋盘(可选,面向人类)。正常API返回机器友好的JSON在status.pieces中。e2e4,g1f3,升变e7e8q)。服务器从位置推断轮到哪一方;发送走法时您不需要指定白/黑。get_status().side_to_move告诉模型轮到谁。who_moved_last,last_move_uci和last_move_san有助于上下文。*_detailed工具中,以保持基本列表简单且向后兼容。uv run pytest -q