A simple MCP (Model Context Protocol) server for playing RPGs with Large Language Models. It provides tools for dice rolling, success checks, and random event generation.
check_success(probability, critical_rate)- Determines success/failure with optional critical resultsroll_dice(expr)- Rolls dice using standard RPG notation (e.g., '1d6', '2d8+3')generate_event()- Generates random RPG events for plot twists and surpriseslist_tools()- Lists all available tools
- Python 3
- uv - A fast Python package installer
- Clone the repository:
git clone https://github.com/jnaskali/rpg-mcp.git
cd rpg-mcp- Install dependencies with uv:
uv syncAdd the following to your MCP client's configuration file (e.g., mcp.json in Claude Desktop or other MCP-compatible clients):
{
"mcpServers": {
"rpg-mcp": {
"command": "/usr/bin/uv",
"args": [
"run",
"python",
"app.py"
],
"cwd": "/PATH_TO/rpg-mcp/"
}
}
}Replace /PATH_TO/rpg-mcp/ with the actual path to your rpg-mcp directory.
Once configured, the LLM can call the tools to:
- Roll dice for attacks, damage, or skill checks
- Determine action outcomes with customizable success probabilities
- Generate random events to drive the narrative forward
Include instructions in your prompt like:
"Call check_success whenever a player character attempts something with a chance of failure, and generate_event to generate a random event at the start of a new scene or when moving to a new location."
The event generation system is inspired by Mythic Game Master Emulator.
Important
Tool calling works best with models that support function calling, such as Claude, GPT-4, Mistral, Llama, or Qwen.
Test the server by asking the LLM to generate a random event. The unique format should make it clear whether the tool is working or if the LLM is hallucinating results.