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.
To install the MCP server, you'll need to have Go installed on your system. Follow these steps to get started:
Clone the repository:
git clone https://github.com/yourusername/mcp-server-diceroll.git
cd mcp-server-diceroll
Install the dependencies:
go mod tidy
Build the server:
go build
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).
You can interact with the server using HTTP requests. The server implements the MCP protocol for dice rolling functionality.
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.
You can configure the server by modifying the configuration file or setting environment variables. Common configuration options include:
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.
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.
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.
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"
]
}
}
}
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.
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.