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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for mcp_dice-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ddb37fd755b3e62454b9faaa30bcc20e2119d7e30b91131eb9f2039b64217b8e
MD5 ea0a70499ec85538017ce5bcc3f812f3
BLAKE2b-256 7afa8f2581f5162b978979d021891046b60760f2a3d75c8425d8d7b35eab7951

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcp_dice-0.1.0-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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0758968550503418a2c1185d924b674fc4e8aca94c1e9ed616c64944170acc89
MD5 5ad60413287487728904d335a3855265
BLAKE2b-256 48d6869ae1277a7c28e57a9c419b75f21efc7e56a5cc73e4b003c0c567cd289e

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