Dice MCP Server

1

Add it to Claude Code

Run this in a terminal.

Run in terminal
claude mcp add dice-mcp -- docker run -i --rm aaronmeis/dice-mcp
README.md

Provides dice rolling and coin flipping functionality for AI assistants

šŸŽ² Dice MCP Server

A Model Context Protocol (MCP) server that provides dice rolling and coin flipping functionality for AI assistants like Claude.

Overview


What is MCP?

The Model Context Protocol (MCP) is an open standard that allows AI assistants to securely connect to external tools and data sources. Think of it as a universal adapter that lets Claude use custom tools you create.

MCP servers run in Docker containers, providing:

  • Isolation — Secure sandboxed environment
  • Portability — Works on any system with Docker
  • Standardization — Consistent protocol across all tools

How MCP Communication Works

MCP uses JSON-RPC 2.0 over stdio (standard input/output). Communication happens through a structured conversation between the client (Claude Desktop) and your server.

The 3-Step Handshake

Before any tools can be used, the client and server must complete an initialization handshake:

Step 1: Initialize (Client → Server)
{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":0}

"Hey server, I'm a client. Here's my protocol version and capabilities."

The server responds with its own capabilities and version info.

Step 2: Initialized Notification (Client → Server)
{"jsonrpc":"2.0","method":"notifications/initialized"}

"Got it! We're connected and ready to work."

Step 3: List Tools (Client → Server)
{"jsonrpc":"2.0","method":"tools/list","id":1}

"What tools do you have available?"

The server responds with all available tools, their parameters, and descriptions.

Visual Flow

ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”                    ā”Œā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”
│  Claude Desktop  │                    │  Your MCP Server │
│    (Client)      │                    │  (dice-mcp)      │
ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜                    ā””ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”¬ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”˜
         │                                       │
         │  1. initialize                        │
         │──────────────────────────────────────>│
         │                                       │
         │  Response: capabilities               │
         │<──────────────────────────────────────│
         │                                       │
         │  2. notifications/initialized         │
         │──────────────────────────────────────>│
         │                                       │
         │  3. tools/list                        │
         │──────────────────────────────────────>│
         │                                       │
         │  Response: [roll_dice, roll_multiple, │
         │            coin_flip]                 │
         │<──────────────────────────────────────│
         │                                       │
         │  4. tools/call (when you ask Claude)  │
         │──────────────────────────────────────>│
         │                                       │
         │  Response: "šŸŽ² Rolled d20: 17"        │
         │<──────────────────────────────────────│

Why Docker + stdio?

Component Purpose
Docker Isolated container for security and portability
stdio Communication via stdin/stdout pipes
-i flag Keeps stdin open so messages can flow both ways
--rm flag Automatically remove container when it exits

Claude Desktop handles all of this automatically — you just say "roll a d20" and it manages the JSON-RPC behind the scenes!


Available Tools

Tool Parameters Description
roll_dice sides (default: "6") Roll a single die with configurable sides
roll_multiple count (default: "2"), sides (default: "6") Roll multiple dice and get total
coin_flip None Flip a coin for heads or tails

Common Dice Notation

Dice Sides Common Use
d4 4 Damage dice
d6 6 Standard dice
d8 8 Weapon damage
d10 10 Percentile
d12 12 Barbarian damage
d20 20 Attack rolls, skill checks
d100 100 Percentile rolls

Prerequisites

Tools (3)

roll_diceRoll a single die with configurable sides
roll_multipleRoll multiple dice and get total
coin_flipFlip a coin for heads or tails

Configuration

claude_desktop_config.json
{"mcpServers":{"dice":{"command":"docker","args":["run","-i","--rm","aaronmeis/dice-mcp"]}}}

Try it

→Roll a d20 for my attack check.
→Flip a coin to decide who goes first.
→Roll 3d6 to determine my character's strength stat.
→Roll a 10-sided die.

Frequently Asked Questions

What are the key features of Dice MCP Server?

Single die rolling with configurable sides. Multi-die rolling with total calculation. Randomized coin flip functionality. Standardized JSON-RPC 2.0 communication. Docker-based isolated execution.

What can I use Dice MCP Server for?

Automating dice rolls for tabletop RPG sessions with AI. Generating random outcomes for game design prototyping. Making binary decisions using the coin flip tool. Testing MCP server integration with Claude Desktop.

How do I install Dice MCP Server?

Install Dice MCP Server by running: docker run -i --rm aaronmeis/dice-mcp

What MCP clients work with Dice MCP Server?

Dice MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Dice MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Need the old visual installer? Open Conare IDE.
Open Conare