d20-mcp
Enables dice rolling for RPG games using standard dice notation, supporting complex expressions like keep/drop, reroll, exploding dice, and batch rolls.
README
🎲 d20-mcp
🇹🇷 Türkçe README için tıklayın / Click here for Turkish README
A powerful MCP (Model Context Protocol) server for dice rolling in RPG games. Built with FastMCP and the d20 library, this server brings comprehensive dice mechanics to Claude and other MCP clients.
Perfect for D&D, Pathfinder, and any tabletop RPG that uses standard dice notation!
✨ Features
- 🎯 Simple Rolls: Quick
1d20+5expressions with instant results - 📊 Detailed Analysis: See every die roll with AST breakdown
- ⚡ Batch Rolling: Roll multiple expressions efficiently
- ✅ Syntax Validation: Check expressions before rolling
- 🎮 Advanced Mechanics: Keep/drop, reroll, exploding dice, and more
- 🤖 LLM-Optimized: Comprehensive tool descriptions for AI understanding
🚀 Quick Start
Easy Setup (Remote MCP)
The quickest way to use d20-mcp - no installation needed!
- Open Claude Desktop
- Go to Settings → Connectors
- Click Add Custom Connector
- Enter the URL:
https://d20-mcp.fastmcp.app/mcp
Note: Remote MCP support is currently in beta and available for Claude Pro, Max, Team, and Enterprise users.
Local Installation (Alternative)
For local installation with uvx:
uvx --from git+https://github.com/saidsurucu/d20-mcp d20-mcp
Claude Desktop Configuration (Local)
Add this to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"d20-mcp": {
"command": "uvx",
"args": [
"--from",
"git+https://github.com/saidsurucu/d20-mcp",
"d20-mcp"
]
}
}
}
Restart Claude Desktop completely (Quit and reopen), then look for the 🔨 hammer icon!
📸 Screenshot

🎮 Usage Examples
Once installed, try these prompts with Claude:
Basic Rolling
Roll 1d20+5 for my attack
Character Creation
Roll 6 sets of 4d6kh3 for ability scores
Combat
Roll attack (1d20+7) and damage (2d8+4) for my greatsword
With Advantage
Roll 2d20kh1+5 for my Perception check with advantage
Complex Expressions
Roll (1d4+1)*2 for Magic Missile damage
🛠️ Available Tools
roll
Quick dice rolls returning total and formatted result. Perfect for standard gameplay.
Use for: Attack rolls, ability checks, damage, saving throws
roll_detailed
Comprehensive breakdown with AST structure showing individual die values and operations.
Use for: Character creation, debugging complex rolls, transparency
roll_batch
Roll multiple different expressions in one operation.
Use for: Combat rounds, rolling all ability scores, party checks
validate_syntax
Validate expressions without rolling (no randomness).
Use for: Testing complex expressions, user input validation
📝 Supported Dice Notation
Basic
1d20- Roll one 20-sided die3d6- Roll three 6-sided diced20- Equivalent to 1d20
Keep/Drop
4d6kh3- Keep highest 34d6kl1- Keep lowest 14d6p1- Drop lowest 1
Reroll
1d20rr<10- Reroll until ≥101d20ro1- Reroll 1s once
Exploding Dice
1d6e- Explode on max1d6e6- Explode on 6
Min/Max
1d20mi10- Minimum 101d20ma20- Maximum 20
Arithmetic
1d20+5- Addition2d6-1- Subtraction3d6*2- Multiplication(1d4+1)*2- Parentheses
Advanced
2d20kh1+5- Advantage in D&D2d20kl1+2- Disadvantage8d6 [fire]- Annotated damage (withallow_comments)
🎯 Common RPG Use Cases
D&D 5e Character Creation
Roll me 6 ability scores using 4d6 keep highest 3
Attack with Advantage
I have advantage on this attack. Roll 2d20kh1+8
Critical Hit
I crit! Roll 4d6+2d6+5 for my sneak attack damage
Multiple Saves
Roll saves for 4 party members: 1d20+5, 1d20+2, 1d20+7, 1d20+3
🔧 Development
Local Testing
# Clone the repository
git clone https://github.com/saidsurucu/d20-mcp.git
cd d20-mcp
# Run with uv
uv run server.py
# Or with Python directly (after installing dependencies)
python server.py
Project Structure
d20-mcp/
├── server.py # Main MCP server with 4 tools
├── pyproject.toml # Project configuration
├── README.md # English documentation
├── README.tr.md # Turkish documentation
└── LICENSE # MIT License
🤝 Contributing
Contributions are welcome! Feel free to:
- Report bugs
- Suggest new features
- Submit pull requests
- Improve documentation
📄 License
MIT License - see LICENSE file for details.
🙏 Credits
Built with:
📚 Learn More
Made with ❤️ for the TTRPG community
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。