MCP Tic-Tac-Toe
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
A Model Context Protocol (MCP) server that enables AI assistants to play tic-tac-toe through standardized tool interfaces. Perfect for demonstrating AI-human collaboration and MCP integration.
Overview
This project implements a complete tic-tac-toe game as an MCP server, allowing AI assistants like Claude to:
- Create and manage multiple game sessions
- Make strategic moves and analyze positions
- Provide game commentary and suggestions
- Play against humans or other AIs
Quick Start
Prerequisites
- Go 1.19+ installed
- Claude Code or other MCP-compatible client
Installation
Basic Usage
MCP Configuration
Claude Code Setup
1. **Build the server:**
2. **Add to your MCP configuration:**
Create or edit your MCP configuration file:
3. **Add the server configuration:**
4. **Restart Claude Code** and the tic-tac-toe tools will be available.
c
Claude Desktop
Available MCP Tools
The server exposes 8 tools for complete game management:
Game Management
- **new_game** - Create a new tic-tac-toe game
- Optional: game_id (string) - Custom game identifier
- Returns: Game ID, starting player, initial board
- **list_games** - Show all active game sessions
- Returns: List of active game IDs
- **reset_game** - Reset a game to initial state
- Required: game_id (string)
- Returns: Confirmation and fresh board
Gameplay
- **make_move** - Execute a move on the board
- Required: game_id (string), position (A1-C3), player (X/O)
- Returns: Updated board, game status, next player
- **get_board** - Get current board state
- Required: game_id (string)
- Returns: Board display, current player, move count
- **get_available_moves** - List all valid moves
- Required: game_id (string)
- Returns: Available positions for current player
Analysis
- **get_status** - Check game status and winner
- Required: game_id (string)
- Returns: Game status (ongoing/won/draw), winner if applicable
- **analyze_position** - Get strategic analysis
- Required: game_id (string)
- Returns: Position analysis and board state
Usage Examples
Start a New Game
Make Strategic Moves
Get Game Status
Transport Options
The server supports three transport methods:
1. Stdio (Default)
Best for local MCP clients like Claude Code: