骰子服务器

一个用于掷骰子的模型上下文协议(MCP)服务器,支持多种骰子面数和同时掷多个骰子,并自动计算总和。

  • by Sunwood-ai-labs
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 sunwood-ai-labs/dice-server

使用说明

🎲 骰子服务器

一种用于掷骰子的模型上下文协议(MCP)服务器

🌟 特性

  • 掷任意数量的骰子
  • 同时掷多个骰子
  • 自动计算所有骰子滚动的总和

🚀 安装

npm install @makimaki/dice-server

💡 用法

作为MCP服务器

  1. 将服务器添加到Claude.app配置文件中:
{
  "mcpServers": {
    "dice": {
      "command": "dice-server",
      "env": {}
    }
  }
}
  1. 在Claude中使用它,如下所示:
Please use the roll_dice tool to roll two six-sided dice.

代码中的直接使用

import { Server } from '@modelcontextprotocol/sdk';
import { StdioServerTransport } from '@modelcontextprotocol/sdk';

// Create server instance
const server = new DiceServer();
await server.run();

🛠️ API

roll_dice

掷骰子的工具

参数

  • sides (数字,可选):每个模具上的边数(默认值:6)
  • count (数字,可选):要掷骰子的数量(默认值:1,最大值:10)

返回值

{
  "dice": "2d6",
  "results": [3, 5],
  "total": 8
}

🔧 发展

设置

git clone https://github.com/yourusername/dice-server.git
cd dice-server
npm install

运行测试

npm test

建筑

npm run build

📝 许可证

麻省理工学院

👥 贡献

问题和拉取请求总是受欢迎的!

  1. 分叉此存储库
  2. 创建功能分支(git checkout -b feature/amazing-feature)
  3. 提交您的更改(git commit -m '✨ feat: Add amazing feature')
  4. 推到分支(git push origin feature/amazing-feature)
  5. 打开拉取请求