To MCP Tic Tac Toe
FreeNot checkedEnables two LLMs to play Tic-Tac-Toe against each other autonomously using a shared tool and an SSE relay. The server facilitates agent-to-agent communication b
About
Enables two LLMs to play Tic-Tac-Toe against each other autonomously using a shared tool and an SSE relay. The server facilitates agent-to-agent communication by holding tool responses until the opponent makes a move, managing the game state in real-time.
README
Two LLMs play Tic-Tac-Toe against each other through a single MCP tool make_move. No human input, AIs autonomously take turns via ping-pong SSE relay.
Play
Local (Claude Code, Codex) Or Remote
# (starts local server on :8787 via stdio, or auto-joins if another instance is already hosting)
claude mcp add tictactoe -- npx -y github:PsychoSmiley/mcp-to-mcp
# Or using Cloudflare MCP Remote
claude mcp add tictactoe --transport http https://mcp-tictactoe.edge-relay-9x.workers.dev/mcp
Or simply from claude.ai web in Settings -> Connectors URL: https://mcp-tictactoe.edge-relay-9x.workers.dev/mcp
# Optionally, to self-host on Cloudflare Workers (free)
Set CLOUDFLARE_API_TOKEN=your-token-here && Set CLOUDFLARE_ACCOUNT_ID=your-account-id && git clone https://github.com/PsychoSmiley/mcp-to-mcp && cd mcp-to-mcp && npm install && npx wrangler deploy # Auto-deploys on push via GitHub Actions (add secrets in repo Settings -> Secrets).
Then open two separate Claude chats. In each ask: use make_move to play tic-tac-toe
Why you should care
The idea isn't Tic-Tac-Toe - it's the architecture. Using MCP itself as a ping-pong turn relay, where each tool call is the AI's response back-and-forth like a baton relay. This achieves synchronous P2P agent communication over a stateless REST protocol, with zero database reads/writes. The same pattern could be used for chat between two or more AI agents via MCP ;)
How it works
Each make_move(move) call both submits a move and waits for the opponent's reply - send + block + receive in one MCP call. The server is authoritative: LLMs only send moves, never the board state. No database - game state lives in RAM. Local MCP Session-Id identifies each player (X vs O).
-> time -> Each MCP closes only to receive opponent's move result, then immediately answers
Agent A: <mcp make_move("B2")>{LLM think}<mcp make_move("C3")>{LLM think}<mcp make_move("B1")>
Agent B: <mcp make_move("A1")>{LLM think}<mcp make_move("C1")>{LLM think}
-> "Game over - X wins!"
server.js- Game logic + local Node.js server (stdio + HTTP)worker.js- Cloudflare Worker + Durable Object (imports game logic from server.js)
Why Durable Object
Locally (server.js), the Node.js process is that shared room. Remotely (worker.js), the Durable Object is.
A Cloudflare Worker is stateless - each request spawns a fresh isolate that dies after responding. Two players' requests can land on different isolates in different cities with no shared memory. They can't meet, can't pass state, can't even know each other exist. Cloudflare KV could bridge them (shared key-value store), but the free tier limits writes to 1,000/day - tight for a game with many moves.
A Durable Object is basically a tiny managed server (persistent single-threaded process with RAM). All requests route to the same instance via idFromName("lobby") - both players share one this.game variable. When Player B places a move, Player A's polling loop (yielding via setTimeout) sees the change on the next tick. No database, no transfers, no serialization - just two requests reading the same variable on the same event loop. (Durable Object SQLite could also replace KV with unlimited read/write, but RAM is faster for short-lived games.)
Install To MCP Tic Tac Toe in Claude Desktop, Claude Code & Cursor
unyly install mcp-to-mcp-tic-tac-toeInstalls into Claude Desktop, Claude Code, Cursor & VS Code — handles npx, uvx and build-from-source repos for you.
First time? Get the CLI: curl -fsSL https://unyly.org/install | sh
Or configure manually
Run in your terminal:
claude mcp add mcp-to-mcp-tic-tac-toe -- npx -y github:PsychoSmiley/mcp-to-mcpStep-by-step: how to install To MCP Tic Tac Toe
FAQ
Is To MCP Tic Tac Toe MCP free?
Yes, To MCP Tic Tac Toe MCP is free — one-click install via Unyly at no cost.
Does To MCP Tic Tac Toe need an API key?
No, To MCP Tic Tac Toe runs without API keys or environment variables.
Is To MCP Tic Tac Toe hosted or self-hosted?
Self-hosted: the server runs locally on your machine via the install command above.
How do I install To MCP Tic Tac Toe in Claude Desktop, Claude Code or Cursor?
Open To MCP Tic Tac Toe on unyly.org, pick your client tab (Claude Desktop, Claude Code, Cursor) and press Install — the config is generated automatically, no JSON editing.
Related MCPs
Fetch
Web content fetching and conversion for efficient LLM usage.
AWS KB Retrieval
Retrieval from AWS Knowledge Base using Bedrock Agent Runtime.
by modelcontextprotocolSpring AI MCP Server
Provides auto-configuration for setting up an MCP server in Spring Boot applications.
llm-analysis-assistant
A very streamlined mcp client that supports calling and monitoring stdio/sse/streamableHttp, and can also view request responses through the /logs page. It also
by xuzexin-hzCompare To MCP Tic Tac Toe with
Not sure what to pick?
Find your stack in 60 seconds
Author?
Embed badge for your README
Browse similar
All ai MCPs
