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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7b68bce89db89ef72fe1902bddd10e39fa682b2dbff6375b0e20b24fa71345be
|
|
| MD5 |
93d2f433f9129e94716d64521d1bb2c6
|
|
| BLAKE2b-256 |
9fb789bd355a3d17b9d644829ab4c3939971f687c468c19e200e6673a4b824ce
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d4d41820cc25bca2667478f29953b4ae8cc1e295642332ce386bd12534fb323c
|
|
| MD5 |
c67a62c1f04e3b31c74c5078657d36a7
|
|
| BLAKE2b-256 |
5a9bb735c38d515985e2c22ad9947d2e8757e7b71fef1b34f96ba89437e036f2
|