Dice Roll MCP server

Provides a simple dice rolling tool that generates random rolls with customizable dice faces and quantities, returning both individual results and their sum.
Back to servers
Provider
shimapon
Release date
Apr 06, 2025
Language
TypeScript
Package
Stats
194 downloads
1 star

This MCP server is a simple implementation that supports dice rolling functionality. It's based on the Model Context Protocol (MCP) and provides a practical example of how to implement and use this protocol in your applications.

Installation

To install the MCP server, you'll need to have Go installed on your system. Follow these steps to get started:

  1. Clone the repository:

    git clone https://github.com/yourusername/mcp-server-diceroll.git
    cd mcp-server-diceroll
    
  2. Install the dependencies:

    go mod tidy
    
  3. Build the server:

    go build
    

Usage

Starting the Server

To start the MCP server, run the compiled binary:

./mcp-server-diceroll

By default, the server will listen on a specified port (typically port 8080).

Sending Requests

You can interact with the server using HTTP requests. The server implements the MCP protocol for dice rolling functionality.

Example Request

Here's an example of how to send a request to roll a dice:

curl -X POST http://localhost:8080/api/roll \
  -H "Content-Type: application/json" \
  -d '{"sides": 6, "count": 2}'

This request will simulate rolling two six-sided dice.

Configuration

You can configure the server by modifying the configuration file or setting environment variables. Common configuration options include:

  • Port number
  • Logging level
  • Default dice parameters

Advanced Usage

Custom Dice Configurations

You can customize the dice rolling behavior by specifying different parameters:

curl -X POST http://localhost:8080/api/roll \
  -H "Content-Type: application/json" \
  -d '{"sides": 20, "count": 1, "modifier": 5}'

This will roll a 20-sided die and add 5 to the result.

Integrating with Other Applications

The MCP server can be integrated with other applications by making HTTP requests to its API endpoints. Make sure to follow the MCP protocol specifications for proper interaction.

For more information on the Model Context Protocol, refer to the original article at https://zenn.dev/herp_inc/articles/00917098b3ffd3.

How to add this MCP server to Cursor

There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json file so that it is available in all of your projects.

If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json file.

Adding an MCP server to Cursor globally

To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".

When you click that button the ~/.cursor/mcp.json file will be opened and you can add your server like this:

{
    "mcpServers": {
        "cursor-rules-mcp": {
            "command": "npx",
            "args": [
                "-y",
                "cursor-rules-mcp"
            ]
        }
    }
}

Adding an MCP server to a project

To add an MCP server to a project you can create a new .cursor/mcp.json file or add it to the existing one. This will look exactly the same as the global MCP server example above.

How to use the MCP server

Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.

The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.

You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.

Want to 10x your AI skills?

Get a free account and learn to code + market your apps using AI (with or without vibes!).

Nah, maybe later