๐ฒ Dice Server
December 17, 2024 ยท View on GitHub
๐ฒ 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
- Add the server to your Claude.app configuration file:
{
"mcpServers": {
"dice": {
"command": "dice-server",
"env": {}
}
}
}
- 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!
- Fork this repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'โจ feat: Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request