mcp-dice: A MCP Server for Rolling Dice
一个能够让大语言模型掷骰子的MCP Server。
mcp-dice
是一个MCP服务器,让大语言模型能够掷骰子。支持标准骰子表示法(如1d20
、3d6+2
)并返回详细结果。
安装
首先确保安装了 uv
:安装指南
基本用法
运行服务器:
uvx mcp-dice
与Claude桌面版集成
配置位置
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
配置示例
macOS
{
"mcpServers": {
"dice": {
"command": "uvx",
"args": ["mcp-dice"]
}
}
}
WSL
{
"mcpServers": {
"dice": {
"command": "wsl",
"args": [
"-e",
"zsh",
"-lc",
"uvx mcp-dice"
]
}
}
}
注意:将 zsh
替换为您的登录shell
MCP请求格式
输入:
{
"notation": "2d6+3"
}
响应示例:
{
"rolls": [3, 1],
"sum": 4,
"modifier": 3,
"total": 7,
"notation": "2d6+3",
"timestamp": "2024-12-03T16:36:38.926452"
}
调试
使用MCP Inspector进行调试:
npx @modelcontextprotocol/inspector uvx mcp-dice
开发
安装开发依赖:
git clone https://github.com/yourusername/mcp-dice
cd mcp-dice
uv pip install -e ".[dev]"
运行测试:
uv run pytest