Skip to main content

MCP server enabling LLMs to roll dice

Project description

mcp-dice: A MCP Server for Rolling Dice

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.1.tar.gz (21.7 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.1-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mcp_dice-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7b68bce89db89ef72fe1902bddd10e39fa682b2dbff6375b0e20b24fa71345be
MD5 93d2f433f9129e94716d64521d1bb2c6
BLAKE2b-256 9fb789bd355a3d17b9d644829ab4c3939971f687c468c19e200e6673a4b824ce

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for mcp_dice-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d4d41820cc25bca2667478f29953b4ae8cc1e295642332ce386bd12534fb323c
MD5 c67a62c1f04e3b31c74c5078657d36a7
BLAKE2b-256 5a9bb735c38d515985e2c22ad9947d2e8757e7b71fef1b34f96ba89437e036f2

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