Purpose
MCP Tic-Tac-Toe is a Model Context Protocol (MCP) server that enables AI assistants (such as Claude) to play tic-tac-toe through a standardized tool interface. This project is suitable for demonstrating AI-human collaboration and MCP integration.
Key Capabilities
As an MCP server, it implements a complete tic-tac-toe game, allowing AI assistants to:
- Create and manage multiple game sessions
- Make strategic moves and analyze the board
- Provide game commentary and suggestions
- Play against humans or other AIs
Available MCP Tools
The server exposes 8 tools for complete game management:
Game Management
- new_game: Create a new tic-tac-toe game. Optional parameter: game_id (string) — custom game identifier. Returns: game ID, starting player, initial board.
- list_games: Display all active game sessions. Returns: list of active game IDs.
Game Operations
- reset_game: Reset the game to its initial state. Required parameter: game_id (string). Returns: confirmation message and a fresh board.
- make_move: Make a move on the board. Required parameters: game_id (string), position (A1-C3), player (X/O). Returns: updated board, game status, next player.
- get_board: Get the current board state. Required parameter: game_id (string). Returns: board display, current player, move count.
- get_available_moves: List all valid moves. Required parameter: game_id (string). Returns: available positions for the current player.
- get_status: Check the game status and winner. Required parameter: game_id (string). Returns: game status (in progress/won/draw), and the winner if applicable.
- analyze_position: Get strategic analysis. Required parameter: game_id (string). Returns: position analysis and board state.
Usage
Prerequisites
- Go 1.19+ installed
- Claude Code or another MCP-compatible client
MCP Configuration (Claude Code settings)
- Build the server:
go build -o bin/server cmd/server.go - Create or edit the MCP configuration file:
- macOS/Linux:
~/.config/claude-code/mcp_servers.json - Windows:
%APPDATA%\claude-code\mcp_servers.json
- macOS/Linux:
- Add the server configuration:
{ "mcpServers": { "tic-tac-toe": { "command": "/full/path/to/mcp-tic-tac-toe/bin/server", "args": ["-transport=stdio"], "env": {} } } } - Restart Claude Code and the tic-tac-toe tools will be available.
Transport Options
The server supports three transport methods:
- Stdio (default): Best for local MCP clients, such as Claude Code.
- Server-Sent Events (SSE): For web applications and real-time updates.
- Streamable HTTP: For traditional HTTP integration.
Use Cases
- Demonstrate collaborative AI-human gameplay
- Test and showcase MCP integration
- Serve as a reference implementation for MCP server development
Limitations
- The project does not provide specific details of the strategic analysis algorithm
- No additional information such as pricing or platform compatibility is provided
- You need to build and configure the MCP client yourself
Project Structure
Building from source: a Go 1.19+ environment is required. For more information, refer to the official MCP documentation and the mcp-go library.