dice-server

dice-server

0

The Dice Server is a Model Context Protocol (MCP) server designed for rolling dice. It supports rolling dice with any number of sides and can handle multiple simultaneous rolls, automatically calculating the total of all dice rolls. The server can be integrated into applications or used directly in code.

Dice Server Header
npm version npm downloads license

🎲 Dice Server

A Model Context Protocol (MCP) server for rolling dice

🌟 Features

  • Roll dice with any number of sides
  • Roll multiple dice simultaneously
  • Automatically calculate the total of all dice rolls

🚀 Installation

npm install @makimaki/dice-server

💡 Usage

As an MCP Server

  1. Add the server to your Claude.app configuration file:
{
  "mcpServers": {
    "dice": {
      "command": "dice-server",
      "env": {}
    }
  }
}
  1. Use it in Claude like this:
Please use the roll_dice tool to roll two six-sided dice.

Direct Usage in Code

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

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

🛠️ API

roll_dice

A tool for rolling dice

Parameters
  • sides (number, optional): Number of sides on each die (default: 6)
  • count (number, optional): Number of dice to roll (default: 1, max: 10)
Return Value
{
  "dice": "2d6",
  "results": [3, 5],
  "total": 8
}

🔧 Development

Setup

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

Running Tests

npm test

Building

npm run build

📝 License

MIT

👥 Contributing

Issues and Pull Requests are always welcome!

  1. Fork this repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m '✨ feat: Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request