Skip to main content
Glama
fritzprix

Rubik's Cube MCP Server

by fritzprix

Rubik's Cube MCP Server

A Model Context Protocol (MCP) server that provides AI agents with the ability to solve Rubi### 4. finish

Complete the Rubik's Cube game session.

Parameters:

  • gameId (string): The game session ID

Returns:

  • Final game statistics

  • Move history

  • Completion status with congratulations messageles through systematic manipulation and real-time visualization.

Features

  • Interactive Cube Manipulation: Execute standard Rubik's Cube moves (U, D, L, R, F, B and their variations)

  • Configurable Difficulty: Set scramble difficulty from 1-100 moves for varied challenge levels

  • MCP UI Integration: Interactive web components delivered directly from the MCP server with clickable game links

  • Game Session Management: Join existing games or create new ones with customizable settings

  • 3D Real-time Visualization: Beautiful 3D cube visualization using Three.js and WebGL

  • WebSocket Live Updates: Real-time state synchronization between MCP server and web interface

  • Mouse Interaction: Rotate and examine the 3D cube with mouse controls

  • Recursive Workflow: AI agents can systematically work through cube solving using nextAction guidance

  • State Tracking: Complete move history and current cube state monitoring

  • Solution Detection: Automatic detection when the cube is solved with celebration effects

Related MCP server: Chess MCP Server

Installation & Setup

Prerequisites

  • Node.js 18.x or higher

  • npm or yarn

Install Dependencies

cd rubiks-cube-mcp-server
npm install

Build the Project

npm run build

Run the Server

npx rubiks-cube-mcp-server

This will start both:

  • MCP server on stdio (for AI agent communication)

  • Web visualization server on http://localhost:3000

Claude Desktop Configuration

To use this MCP server with Claude Desktop, add the following to your claude_desktop_config.json:

{
  "mcpServers": {
    "rubiks-cube": {
      "command": "npx",
      "args": ["rubiks-cube-mcp-server"]
    }
  }
}

Configuration file locations:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%\Claude\claude_desktop_config.json

After adding the configuration, restart Claude Desktop to load the MCP server.

MCP Tools

1. startCube

Initialize a new Rubik's Cube game session.

Parameters:

  • scramble (optional, boolean): Whether to scramble the cube initially (default: true)

  • difficulty (optional, number): Number of scramble moves (1-100, default: 20)

Returns:

  • MCP UI resource with clickable game link

  • Game ID for the session

  • Initial cube state with difficulty level

  • Visualization URL

  • Next action guidance

2. joinGame

Join an existing Rubik's Cube game session.

Parameters:

  • gameId (string): The game session ID to join

Returns:

  • Current cube state

  • Game metadata including difficulty

  • Next action guidance

3. manipulateCube

Execute a move on the Rubik's Cube.

Parameters:

  • gameId (string): The game session ID

  • move (string): Standard cube notation (U, D, L, R, F, B, U', D', L', R', F', B', U2, D2, L2, R2, F2, B2)

Returns:

  • Updated cube state

  • Move execution confirmation

  • Total moves count

  • Next action guidance

4. finish

Complete the Rubik's Cube game session.

Parameters:

  • gameId (string): The game session ID

Returns:

  • Final game statistics

  • Move history

  • Completion status

Cube Notation

The server uses standard Rubik's Cube notation:

  • U: Up face clockwise

  • D: Down face clockwise

  • L: Left face clockwise

  • R: Right face clockwise

  • F: Front face clockwise

  • B: Back face clockwise

  • ': Counter-clockwise (e.g., U')

  • 2: Double turn (e.g., U2)

Example Usage with AI Agent

Agent: "Start a new Rubik's cube puzzle with easy difficulty"
→ startCube tool called with { scramble: true, difficulty: 5 }
→ Returns MCP UI resource with clickable game link + game state

Agent: "Join existing game cube_123456789_abc"
→ joinGame tool called with gameId
→ Returns current cube state and game metadata

Agent: "Execute move U"
→ manipulateCube tool called with move "U"
→ Returns updated state and nextAction guidance

Agent: "Continue solving..."
→ Recursive manipulateCube calls until solved
→ finish tool called when complete with celebration message

Web Visualization

Visit http://localhost:3000/game/{gameId} to see:

  • Real-time 3D cube representation

  • Color-coded faces (White, Yellow, Red, Orange, Blue, Green)

  • Move counter and history

  • Interactive move buttons

  • Solution status indicator

MCP UI Features

The server now includes MCP UI integration for enhanced user experience:

  • Clickable Game Links: When starting a new game, the server returns an interactive UI resource with a clickable link to the web visualization

  • Game Session Management: Support for joining existing games created by other users or sessions

  • Visual Feedback: Clear indication of game status, difficulty level, and next actions

Starting a Game with UI

When you call the startCube tool, you'll receive:

  1. A clickable UI resource linking directly to the game

  2. Complete game state data in JSON format

  3. Metadata including difficulty level and next action guidance

Joining Existing Games

Use the joinGame tool with a game ID to participate in games created elsewhere:

  • Perfect for collaborative solving

  • Maintains full game state and history

  • Seamless integration with existing MCP workflow

Architecture

  • MCP Protocol: Standard Model Context Protocol for AI agent communication

  • MCP UI Integration: Interactive web components with @mcp-ui/server for clickable resources

  • 3D Rendering: Three.js WebGL-based 3D cube visualization

  • Real-time Communication: Socket.io WebSocket server for live updates

  • Web Server: Express.js server for HTTP API and static content

  • State Management: In-memory game session tracking with live synchronization

  • Configurable Difficulty: Scalable scramble complexity from beginner to expert levels

Workflow Pattern

The server follows the recursive MCP pattern:

  1. Start → Returns nextAction: 'manipulateCube'

  2. Manipulate → Returns nextAction: 'manipulateCube' (if not solved) or 'finish' (if solved)

  3. Finish → Returns nextAction: null (workflow complete)

This allows AI agents to work autonomously through the solving process.

Development

Watch Mode

npm run dev

Building

npm run build

Project Structure

src/
  ├── app.ts              # Main MCP server setup
  ├── cubeLogic.ts        # Rubik's Cube simulation logic
  ├── visualizationServer.ts  # Web visualization server
  └── types.ts            # TypeScript interfaces

License

MIT License - see LICENSE file for details.

Available Tools

4 tools
finishC

Complete the Rubik's Cube game session

ParametersJSON Schema
NameRequiredDescriptionDefault
gameIdYesThe game session ID

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'completes' a game session, implying a mutation or finalization, but doesn't describe what 'complete' entails (e.g., saves results, ends gameplay, triggers scoring) or any side effects like permissions or rate limits. This leaves significant gaps in understanding the tool's behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It is front-loaded and wastes no space, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a game completion tool with no annotations and no output schema, the description is insufficient. It doesn't explain what happens upon completion (e.g., returns a score, saves state, or provides confirmation), leaving the agent uncertain about the outcome or how to handle the result.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting the single required parameter 'gameId' as 'The game session ID'. The description adds no additional semantic meaning beyond this, such as format examples or constraints, so it meets the baseline for high schema coverage without compensating value.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Complete') and the resource ('Rubik's Cube game session'), which is specific and unambiguous. However, it doesn't explicitly differentiate from sibling tools like 'joinGame' or 'manipulateCube', which might involve similar game sessions but different operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'startCube' or 'manipulateCube'. It lacks context about prerequisites (e.g., must be an active session) or exclusions, leaving the agent to infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

joinGameC

Join an existing Rubik's Cube game session

ParametersJSON Schema
NameRequiredDescriptionDefault
gameIdYesThe game session ID to join

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('join') but doesn't explain what happens upon joining (e.g., does it return game state, require authentication, have rate limits, or affect other players?). For a tool that likely involves multi-user interaction with no annotation coverage, this lack of behavioral context is inadequate, though not contradictory.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse. There's zero waste, and every part of the sentence earns its place by clearly conveying the essential function.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of joining a game session (likely involving multi-user state changes), the description is incomplete. No annotations exist to cover behavioral aspects like safety or side effects, and there's no output schema to explain return values (e.g., success confirmation or game details). The description alone doesn't provide enough context for an agent to understand the full implications of using this tool, especially compared to siblings like 'manipulateCube' or 'finish'.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with the single parameter 'gameId' fully documented in the schema as 'The game session ID to join'. The description doesn't add any meaning beyond this (e.g., format examples, source of the ID, or validation rules). With high schema coverage and only one parameter, the baseline score of 3 is appropriate, as the schema handles the heavy lifting without extra value from the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('join') and resource ('an existing Rubik's Cube game session'), making the purpose immediately understandable. It distinguishes from sibling tools like 'startCube' (which creates a new game) and 'manipulateCube' (which interacts with an ongoing game), though it doesn't explicitly mention these alternatives. The description is specific but lacks explicit sibling differentiation, which keeps it from a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a valid game ID from 'startCube'), exclusions (e.g., cannot join a finished game), or contextual cues (e.g., use after starting a game). With sibling tools like 'finish' and 'manipulateCube' available, the absence of usage guidelines is a significant gap, leaving the agent to infer appropriate contexts.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

manipulateCubeC

Execute a move on the Rubik's Cube

ParametersJSON Schema
NameRequiredDescriptionDefault
gameIdYesThe game session ID
moveYesThe cube move to execute

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool 'execute[s] a move,' implying a mutation or action, but doesn't clarify if this changes the cube state permanently, requires specific permissions, has side effects, or what happens on failure. This is a significant gap for a mutation tool with zero annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's function without any fluff or redundancy. It's appropriately sized and front-loaded, making it easy for an agent to parse quickly, with every word earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (a mutation operation with no output schema and no annotations), the description is incomplete. It lacks information on behavioral traits, return values, error handling, and how it integrates with sibling tools, making it inadequate for an agent to use confidently without additional context.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with clear descriptions for both parameters ('gameId' and 'move'), including an enum for valid moves. The description adds no additional meaning beyond what the schema provides, such as explaining move notation or game session context, so it meets the baseline score of 3 when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('execute a move') and the target resource ('on the Rubik's Cube'), making the purpose immediately understandable. However, it doesn't differentiate this tool from its siblings like 'startCube' or 'finish', which likely handle different aspects of cube manipulation, so it doesn't reach the highest score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing an active game session from 'startCube' or 'joinGame'), exclusions, or how it relates to sibling tools like 'finish' for ending a session, leaving the agent to infer usage context.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

startCubeC

Initialize a new Rubik's Cube game session

ParametersJSON Schema
NameRequiredDescriptionDefault
scrambleNoWhether to scramble the cube initially
difficultyNoNumber of scramble moves (1-100)

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool initializes a session but doesn't cover key aspects like whether this creates persistent state, requires authentication, has side effects, or returns session details, which are critical for a mutation tool.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded and wastes no space, earning full marks for conciseness.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a game session tool with no annotations and no output schema, the description is incomplete. It fails to explain what the tool returns (e.g., session ID, cube state) or behavioral traits like side effects, leaving significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, clearly documenting both parameters. The description doesn't add any meaning beyond the schema, such as explaining how 'scramble' and 'difficulty' interact or default behaviors. Baseline 3 is appropriate since the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Initialize') and resource ('a new Rubik's Cube game session'), making the purpose understandable. However, it doesn't explicitly differentiate from sibling tools like 'joinGame' or 'manipulateCube', which prevents a perfect score.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'joinGame' or 'manipulateCube'. It lacks context about prerequisites or scenarios for starting a new session, leaving usage unclear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 2 tool updatesv1.0.0
    • AddedjoinGame
    • ChangedstartCube1 field changed
      • addedInput schema / properties / difficulty
        Added value: +{
        +  "description": "Number of scramble moves (1-100)",
        +  "maximum": 100,
        +  "minimum": 1,
        +  "type": "number"
        +}
  2. 3 tool updates
    • First observedfinish
    • First observedmanipulateCube
    • First observedstartCube

TDQS

B3.3/5.0

Scored across 4 tools

Disambiguation5/5

Each tool has a clearly distinct purpose with no overlap: startCube initializes a game, joinGame connects to an existing one, manipulateCube performs moves, and finish ends the session. The actions are mutually exclusive and well-defined for the Rubik's Cube domain.

Naming Consistency3/5

The naming is mixed with inconsistent patterns: startCube and joinGame use verbNoun format, manipulateCube uses verbNoun but with a different structure, and finish is a standalone verb. While readable, the lack of a uniform convention (e.g., snake_case or consistent verb placement) reduces predictability.

Tool Count5/5

With 4 tools, this is well-scoped for a Rubik's Cube game server, covering essential actions: start, join, manipulate, and finish. Each tool earns its place without bloat, aligning with typical game lifecycle management.

Completeness4/5

The toolset covers core game operations (initialize, join, execute moves, end), but minor gaps exist, such as lacking tools for querying game state (e.g., get_cube_state) or listing active games. Agents can work around this by inferring state from context, but it's not fully comprehensive.

Maintenance

ActivityInactive
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • F
    license
    B
    quality
    D
    maintenance
    Enables AI assistants to play, analyze, and track chess games with full rule validation and support for standard algebraic notation. It provides tools for position evaluation and game state persistence during user sessions.
    2
    -
  • A
    license
    A
    quality
    A
    maintenance
    Enables Large Language Models to play chess agentically with real-time HTML board visualization and a hybrid AI engine featuring ten difficulty levels. It supports interactive games between users and agents, including a web dashboard to monitor active matches.
    4
    MIT
  • F
    license
    Not graded
    quality
    D
    maintenance
    Enables users to load and solve Boxoban puzzles by providing tools to get game state, list valid moves, and take actions.
    -
  • F
    license
    Not graded
    quality
    D
    maintenance
    Exposes a Rubik's cube to an AI agent, allowing it to manipulate and solve the cube, with a web dashboard for monitoring agent runs.
    -