---
title: "Mastermind"
url: "https://aigamehub.app/en/games/mastermind-web-de6733"
source: "https://github.com/gextam/mastermind-web"
source_type: "github"
play_url: "https://gextam.github.io/mastermind-web/docs/"
platform: "desktop"
login_required: false
pricing: "free"
origin: "original"
ai_tools: []
game_languages: ["en"]
author: "gextam"
author_handle: "gextam"
category: "Casual"
categories: ["casual", "puzzle"]
tags: ["board-game", "code-breaking", "html5-canvas", "mastermind", "mcp", "solver"]
added: "2026-11-15T11:20:58.305Z"
updated: "2026-11-15T11:20:58.305Z"
locale: "en"
content_locale: "en"
---

# Mastermind

A browser version of the classic Mastermind code-breaking game on a wooden board, with a live shared scoreboard and an offline copy.

## Description

You play either as codebreaker, guessing the hidden colour code with as few rows as possible, or as codemaker, hiding a code and watching the server's Knuth minimax solver take it apart. Six preset boards (classic 4 pegs x 6 colours x 10 guesses up to 6 pegs x 8 colours x 15 guesses) plus custom rules with 2-8 pegs, 2-10 colours, optional repeats and blanks, and solver hints that show how many codes remain. Play is by mouse drag-and-drop or full keyboard, and a REST API plus MCP server let an AI agent play on the same scoreboard.

## Original post

Mastermind in the browser plus a game server with REST API and MCP server so Claude can play remotely

Topics: claude, game, html5-canvas, mastermind, mcp, mcp-server, model-context-protocol, nodejs, rest-api

<div align="center"> <img src="assets/logo.png" alt="MASTERMIND" width="640"> ### The code-breaking classic on a walnut board, with a game server, a REST API and an MCP server so Claude can play against it remotely ![HTML5 Canvas](https://img.shields.io/badge/HTML5-Canvas-e34f26) ![Web Audio](https://img.shields.io/badge/Web%20Audio-synthesized-7b61ff) ![Node](https://img.shields.io/badge/Node.js-20%2B-339933) ![MCP](https://img.shields.io/badge/MCP-2025--06--18-6b4fbb) ![Dependencies](https://img.shields.io/badge/dependencies-none-success) ![Tests](https://img.shields.io/badge/tests-engine%2079%20%C2%B7%20api%2084%20%C2%B7%20smoke%2018-blue) <img src="docs/screenshots/hero.jpg" alt="The decoding board mid-game: codemaker shield, key pegs, the tray and the scoreboard" width="900"> </div> Plain HTML5 Canvas, Web Audio and vanilla JavaScript in the browser; one dependency-free Node.js process behind it that serves the game, a REST API and a Model Context Protocol server. You break the codemaker's code with as few guesses as possible, or set a code and watch Knuth's solver break it. Every player, human or agent, plays on the same scoreboard. > Unofficial recreation of the classic game for entertainment only. Play money, no wagering. **Live table:** <https://cocojs.com/games/mastermind/> (shared scoreboard) · **MCP endpoint for agents:** `https://cocojs.com/games/mastermind/mcp` · **Docs:** <https://cocojs.com/games/mastermind/docs/mcp.html> · The GitHub Pages copy at <https://gextam.github.io/mastermind-web/> plays offline with a local scoreboard. --- ## Contents 1. [Features](#features) 2. [Platforms](#platforms) 3. [Installation](#installation) 4. [Let Claude play (MCP server & API)](#let-claude-play-mcp-server--api) 5. [Configuration reference](#configuration-reference) 6. [User guide](#user-guide) 7. [Keyboard shortcuts](#keyboard-shortcuts) 8. [Scoring](#scoring) 9. [Known limitations](#known-limitations) 10. [Project layout](#project-layout) 11. [Development](#development) --- ## Features **The table** * A walnut decoding board under a banker's lamp: drilled rows, routed channel, engraved row numbers, a 2×2 (or 3×2, 4×2) key-peg cluster per row, a brass hinged shield over the codemaker's row * Glossy pre-rendered pegs that drop into their holes with a bounce; key pegs that pop in one by one; a brass marker that slides to the next row; the shield swings open on its hinge to reveal the code; confetti for a win, a shake for a loss * Click, drag and drop, right-click to remove, full keyboard play **The game** * Both roles: **codebreaker** (the server hides a code) and **codemaker** (you hide a code, the server's Knuth minimax solver breaks it row by row while you watch) * Six boards: Classic 4 pegs × 6 colours × 10 guesses, Mini, No repeats, With blanks, Super 5 × 8 × 12, Grand 6 × 8 × 15, plus custom rules (2–8 pegs, 2–10 colours, 1–30 guesses, repeats and blanks on or off) * Hints from the solver (how many codes are still possible, a sample, and
