Skip to main content

MCP server enabling LLMs to roll dice

Project description

mcp-dice: A MCP Server for Rolling Dice

screenshot

A Model Context Protocol (MCP) server that enables Large Language Models (LLMs) to roll dice. It accepts standard dice notation (e.g., 1d20) and returns both individual rolls and their sum.

Features

  • Supports standard dice notation (e.g., 1d20, 3d6, 2d8+1)
  • Returns both individual rolls and the total sum
  • Easy integration with Claude Desktop
  • Compatible with MCP Inspector for debugging

Installation

# Install using uv
uv pip install mcp-dice

Usage

Basic Command Line Usage

# Using uvx
uvx mcp-dice

Input Format

The server accepts a JSON object with a notation field:

{
  "notation": "2d6+3"
}

Example responses:

{
  "rolls": [
    3,
    1
  ],
  "sum": 4,
  "modifier": 3,
  "total": 7,
  "notation": "2d6+3",
  "timestamp": "2024-12-03T16:36:38.926452"
}

Claude Desktop Configuration

Location

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

Examples

macOS Configuration
{
  "mcpServers": {
    "dice_service": {
      "command": "uvx",
      "args": ["mcp-dice"]
    }
  }
}
WSL Configuration
{
  "mcpServers": {
    "dice": {
      "command": "wsl",
      "args": [
        "-e",
        "zsh",
        "-lc",
        "uvx mcp-dice"
      ]
    }
  }
}

Note: Replace zsh with your login shell.

Development and Debugging

Installing Development Dependencies

# Clone the repository
git clone https://github.com/yourusername/mcp-dice
cd mcp-dice

# Install development dependencies
uv pip install -e ".[dev]"

Running Tests

uv run pytest

Using MCP Inspector

The MCP Inspector is a useful tool for debugging your MCP server. Install and run it using npm:

npx @modelcontextprotocol/inspector uvx mcp-dice

Claude Desktop Configuration for Development

macOS Configuration (local dev) ```json { "mcpServers": { "dice_service": { "command": "uv", "args": [ "run", "--directory", "path/to/mcp-dice-repo mcp-dice" ] } } } ```
Windows (WSL) Configuration (local dev)
{
  "mcpServers": {
    "dice": {
      "command": "wsl",
      "args": [
        "-e",
        "zsh",
        "-lc",
        "uv run --directory path/to/mcp-dice-repo mcp-dice"
      ]
    }
  }
}

Note: Replace zsh with your login shell.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_dice-0.1.2.tar.gz (22.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_dice-0.1.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file mcp_dice-0.1.2.tar.gz.

File metadata

  • Download URL: mcp_dice-0.1.2.tar.gz
  • Upload date:
  • Size: 22.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for mcp_dice-0.1.2.tar.gz
Algorithm Hash digest
SHA256 7a6d1502ccb3220f8ea39ba4abe7f67d96e4e63fcde086d5ec75b96ef3c2231b
MD5 0cdc4dd1dd1271a32a3921223ce59680
BLAKE2b-256 c39d7fa3c9b8fdf9985126ed35682dac70fbee1a1466e614f6f619700b52eba2

See more details on using hashes here.

File details

Details for the file mcp_dice-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: mcp_dice-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.5.5

File hashes

Hashes for mcp_dice-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f0b7790a6f1927182ede9acea62ee820141a9e56d2e703cde46ce49329705345
MD5 275694f7f5ba2aaf508dcf5384c4a8e5
BLAKE2b-256 6127c2e50ccd6146467d3de3ef18ab79b2c2c39bec9c4aad1c624aefc323ae13

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page