๐ŸŽฒ Dice Server

December 17, 2024 ยท View on GitHub

Dice Server Header
EN doc JA doc
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