MCP Tic-Tac-Toe

MCP Tic-Tac-Toe

A Model Context Protocol server for playing and analyzing tic-tac-toe games through standardized tool interfaces.

2
Stars
1
Forks
2
Watchers
0
Issues
MCP Tic-Tac-Toe is a server implementation that provides a complete set of MCP tools for playing, managing, and analyzing tic-tac-toe games. It supports interactions with AI assistants such as Claude, enabling features like creating multiple parallel sessions, making moves, providing strategic analysis, and managing game context. The server is designed for easy integration with clients through various transport methods, including stdio and SSE, and supports seamless AI-human collaboration.

Key Features

Implements MCP server for tic-tac-toe
Create, reset, and list multiple game sessions
Make and track game moves
Analyze board positions for strategic play
Get current board state and available moves
Check live game status and determine winner
Support for both AI and human players
Multiple transport methods: stdio, SSE, HTTP
Easy integration with Claude Code and MCP clients
Configurable server setup for cross-platform use

Use Cases

Demonstrating AI-human collaboration in board games
Integrating standardized game tools into AI assistants
Providing automated tic-tac-toe analysis and suggestions
Enabling multiple simultaneous tic-tac-toe sessions for users
Developing AI strategies through game session management
Showcasing MCP server integration in educational tools
Testing and developing model tools for context-driven interactions
Enabling peer-to-peer competitive gameplay with AI observers
Offering plug-and-play tic-tac-toe tools for code assistants
Facilitating research in game analysis and AI move prediction

README

MCP Tic-Tac-Toe

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.

mcp-tic-tac-toe screenshot

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

bash
git clone https://github.com/tomholford/mcp-tic-tac-toe
cd mcp-tic-tac-toe
go mod tidy
go build -o bin/server cmd/server.go

Basic Usage

bash
# Start MCP server (stdio transport)
./bin/server

# Or specify transport method
./bin/server -transport=sse -addr=:8080

MCP Configuration

Claude Code Setup

  1. Build the server:

    bash
    go build -o bin/server cmd/server.go
    
  2. Add to your MCP configuration:

    Create or edit your MCP configuration file:

    bash
    # For macOS/Linux
    ~/.config/claude-code/mcp_servers.json
    
    # For Windows  
    %APPDATA%\claude-code\mcp_servers.json
    
  3. Add the server configuration:

    json
    {
      "mcpServers": {
        "tic-tac-toe": {
          "command": "/full/path/to/mcp-tic-tac-toe/bin/server",
          "args": ["-transport=stdio"],
          "env": {}
        }
      }
    }
    
  4. Restart Claude Code and the tic-tac-toe tools will be available. c

Claude Desktop

json
"tic-tac-toe": {
  "command": "/full/path/to/mcp-tic-tac-toe/bin/server",
  "args": [""]
}

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

AI: Use the new_game tool
→ New game created with ID: game-a1b2c3d4
  Starting player: X
  Initial board:
    A B C
  1 · · ·
  2 · · ·  
  3 · · ·

Make Strategic Moves

Human: I'll take the center
AI: Use make_move tool with {"game_id": "game-a1b2c3d4", "position": "B2", "player": "X"}

AI: Let me analyze the position first
AI: Use analyze_position tool → Shows current state and opportunities

AI: I'll take a corner for strategic advantage  
AI: Use make_move tool with {"game_id": "game-a1b2c3d4", "position": "A1", "player": "O"}

Get Game Status

AI: Use get_status tool → Game Status: Ongoing, Current player: X, Move count: 2
AI: Use get_available_moves tool → Available moves (7): A2, A3, B1, B3, C1, C2, C3

Transport Options

The server supports three transport methods:

1. Stdio (Default)

Best for local MCP clients like Claude Code:

bash
./bin/server -transport=stdio

2. Server-Sent Events (SSE)

For web applications and real-time updates:

bash
./bin/server -transport=sse -addr=:8080

3. Streamable HTTP

For traditional HTTP integrations:

bash
./bin/server -transport=http -addr=:8080

Development

Project Structure

mcp-tic-tac-toe/
├── cmd/
│   ├── server.go          # MCP server main entry point
│   └── demo.go            # Game logic demonstration  
├── game/                  # Core tic-tac-toe logic
│   ├── types.go           # Game data structures
│   ├── engine.go          # Game rules and validation
│   └── engine_test.go     # Game logic tests
├── server/                # MCP server implementation  
│   ├── server.go          # MCP server setup and tools
│   ├── handlers.go        # Tool request handlers
│   └── server_test.go     # MCP integration tests
└── bin/                   # Built executables

Running Tests

bash
# Test all packages
go test ./game ./server -v

# Test specific functionality
go test ./game -run TestWinConditions
go test ./server -run TestMakeMoveTool

Building from Source

bash
# Build server
go build -o bin/server cmd/server.go

# Build demo
go build -o bin/demo cmd/demo.go

# Run demo (no MCP required)
./bin/demo

Resources

Star History

Star History Chart

Repository Owner

tomholford
tomholford

User

Repository Details

Language Go
Default Branch master
Size 6,539 KB
Contributors 1
MCP Verified Nov 12, 2025

Programming Languages

Go
100%

Tags

Topics

game go golang mcp mcp-server tic-tac-toe

Join Our Newsletter

Stay updated with the latest AI tools, news, and offers by subscribing to our weekly newsletter.

We respect your privacy. Unsubscribe at any time.

Related MCPs

Discover similar Model Context Protocol servers

  • mcp-miro

    mcp-miro

    Model Context Protocol server for integrating MIRO Whiteboard with AI workflows.

    mcp-miro is a Model Context Protocol (MCP) compliant server that connects the MIRO Whiteboard Application to AI-based systems, such as Claude Desktop. It enables board manipulation, sticky note creation, bulk operations, and more through standardized MCP interfaces. Users can authenticate via OAuth and interact with MIRO boards programmatically for collaborative whiteboarding and automation tasks. The server can be installed using Smithery or mcp-get and supports debugging with the MCP Inspector.

    • 97
    • MCP
    • evalstate/mcp-miro
  • TickTick MCP Server

    TickTick MCP Server

    Enable powerful AI-driven task management for TickTick via the Model Context Protocol.

    TickTick MCP Server provides comprehensive programmatic access to TickTick task management features using the Model Context Protocol. Built on the ticktick-py library, it enables AI assistants and MCP-compatible applications to create, update, retrieve, and filter tasks with improved precision and flexibility. The server supports advanced filtering, project and tag management, subtask handling, and robust context management for seamless AI integration.

    • 35
    • MCP
    • jen6/ticktick-mcp
  • RAE Model Context Protocol (MCP) Server

    RAE Model Context Protocol (MCP) Server

    An MCP server enabling LLMs to access RAE’s dictionary and linguistic resources.

    Provides a Model Context Protocol (MCP) server implementation for the Royal Spanish Academy API, facilitating integration with language models. Offers tools such as search and word information retrieval, exposing RAE’s dictionary and linguistic data to LLMs. Supports multiple transports including stdio and SSE, making it suitable for both direct and server-based LLM interactions.

    • 3
    • MCP
    • rae-api-com/rae-mcp
  • mcp-time

    mcp-time

    A Model Context Protocol server for time and date operations

    mcp-time is a Model Context Protocol (MCP) server that enables AI assistants and MCP clients to perform standardized time and date-related operations. It provides natural language parsing for relative time expressions, supports flexible formatting, and allows manipulation and comparison of times. The server offers multiple integration methods, including stdio, HTTP stream, Docker, and npx for compatibility with various clients. It is designed for robust time handling and easy integration with AI tools.

    • 8
    • MCP
    • TheoBrigitte/mcp-time
  • MCP Zotero

    MCP Zotero

    Model Context Protocol server for seamless Zotero integration with AI tools.

    MCP Zotero provides a Model Context Protocol server enabling AI models such as Claude to access and interact with Zotero libraries. Users can securely link their Zotero accounts and perform actions including listing collections, retrieving papers, searching the library, and getting details about specific items. Integration is designed for both standalone operation and as an extension for tools like Claude Desktop.

    • 137
    • MCP
    • kaliaboi/mcp-zotero
  • TripGo MCP Server

    TripGo MCP Server

    Remote MCP server providing transport location, departure, and routing tools via the TripGo API.

    TripGo MCP Server acts as a remote Model Context Protocol server that wraps the TripGo API, offering tools for retrieving transport-related locations, departures from transport stops, multi-modal trip planning, and trip URL retrieval. It is deployed on Cloudflare Workers and is accessible directly or via MCP-compatible clients such as Claude Desktop through the mcp-remote proxy. The server supports direct integration for context-aware transport queries and trip management, facilitating enhanced interactions with public transport data.

    • 2
    • MCP
    • skedgo/tripgo-mcp-server
  • Didn't find tool you were looking for?

    Be as detailed as possible for better results