D&D 5e Tabletop Gaming MCP server

Provides D&D 5e tabletop gaming mechanics including dice rolling, character management, combat resolution, and persistent game state storage for dungeon master assistance and solo gaming experiences.
Back to servers
Setup instructions
Provider
Mnehmos
Release date
Jun 02, 2025
Stats
16 stars

The RPG MCP Servers provide advanced D&D 5e combat and game state management through a suite of servers that feature 3D spatial combat, ASCII battlefield visualization, and complete character management for AI-powered D&D experiences.

Prerequisites

Before installation, you need to have Roo Code installed:

  • Install from the VS Code Marketplace
  • Or via CLI: code --install-extension RooVeterinaryInc.roo-cline
  • Configure your AI provider (OpenAI, Anthropic, etc.)
  • Visit Roo Code docs for detailed setup instructions

Installation

1. Install and Build Servers

# Game State Server
cd game-state-server
npm install && npm run build

# Combat Engine Server  
cd ../combat-engine-server
npm install && npm run build

2. Configure Environment (Optional)

Create .env files in each server directory:

For game-state-server/.env:

DATABASE_PATH=./data/my_rpg.db
PORT=3001

For combat-engine-server/.env:

PORT=3002

3. Start the Servers

# Terminal 1
cd game-state-server && npm start

# Terminal 2  
cd combat-engine-server && npm start

4. Configure Roo Code MCP Settings

Add to your mcp_settings.json (typically located at %APPDATA%\Code\User\globalStorage\rooveterinaryinc.roo-cline\settings\mcp_settings.json):

{
  "mcpServers": {
    "rpg-game-state": {
      "name": "rpg-game-state-server",
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/game-state-server",
      "enabled": true,
      "alwaysAllow": [
        "create_character", "get_character", "get_character_by_name", "list_characters", "update_character",
        "add_item", "get_inventory", "remove_item", "update_item",
        "save_world_state", "get_world_state", "update_world_state",
        "create_npc", "create_npc_group", "get_npc", "list_npcs", "update_npc", "remove_npc",
        "create_encounter", "add_to_encounter", "get_encounter_state", "get_active_encounter",
        "start_turn", "end_turn", "next_turn", "consume_action", "end_encounter", "apply_damage",
        "save_story_progress", "add_quest", "get_active_quests", "update_quest_state", "assign_quest_to_character"
      ]
    },
    "rpg-combat-engine": {
      "name": "rpg-combat-engine-server", 
      "command": "node",
      "args": ["dist/index.js"],
      "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/combat-engine-server",
      "enabled": true,
      "alwaysAllow": [
        "roll_dice", "roll_check", "attack_roll", "initiative_roll", "damage_roll", "saving_throw",
        "use_reaction", "use_legendary_action", "trigger_lair_action", "execute_multiattack",
        "initialize_battlefield", "place_creature", "move_creature", "check_line_of_sight",
        "get_area_effect_targets", "get_tactical_summary", "check_flanking", "check_height_advantage",
        "describe_battlefield", "describe_detailed_tactical_situation", "generate_battlefield_map",
        "get_combat_log", "clear_combat_log"
      ]
    }
  }
}

Note: Replace PATH_TO_YOUR_PROJECT with your actual project path (e.g., C:/projects/rpg-mcp-servers).

Usage Examples

Character Management

Create a new D&D character with full stats:

create_character({
  name: "Lyra Swiftarrow",
  class: "Ranger", 
  stats: { strength: 14, dexterity: 18, constitution: 16, intelligence: 12, wisdom: 15, charisma: 10 }
})

Setting Up 3D Combat

Initialize a battlefield with terrain:

initialize_battlefield({
  width: 15, height: 12,
  terrain: [
    { type: "wall", position: {x: 8, y: 2, z: 0}, dimensions: {width: 1, height: 4, depth: 5} },
    { type: "stairs", position: {x: 5, y: 4, z: 0}, dimensions: {width: 2, height: 2, depth: 5} }
  ]
})

Place creatures in 3D space:

place_creature({
  creature_id: "ranger_lyra", name: "Lyra Swiftarrow",
  x: 6, y: 5, z: 5, size: "medium", speed: 30, reach: 5
})

Get a tactical situation analysis:

describe_detailed_tactical_situation({ creature_id: "ranger_lyra" })

Visualizing the Battlefield

Generate an ASCII battlefield map:

generate_battlefield_map()

This will produce a visual representation of the battlefield:

๐Ÿ“ **BATTLEFIELD MAP** (Xโ†’, Yโ†“):

 0โ”‚ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท 
 1โ”‚ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท 
 2โ”‚ยท ยท ยท ยท ยท ยท ยท ยท โ–ˆ ยท ยท ยท ยท ยท ยท 
 3โ”‚ยท ยท ยท ยท ยท ยท ยท ยท โ–ˆ ยท ยท ยท ยท ยท ยท 
 4โ”‚ยท ยท ยท ยท ยท โ‰ก โ‰ก ยท โ–ˆ ยท ยท ยท ยท ยท ยท 
 5โ”‚ยท ยท ยท ยท ยท โ‰ก L ยท โ–ˆ ยท ยท ยท ยท ยท ยท 
 6โ”‚ยท ยท ยท K ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท 
 7โ”‚ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท 
 8โ”‚ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท S ยท ยท 
 9โ”‚ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท ยท 
  โ””0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 

**LEGEND**: โ–ˆ=wall, โ– =pillar, โ‰ก=stairs, Letters=creatures

Combat Mechanics

Roll dice with advantage:

roll_dice({ notation: "2d20kh1+5", reason: "Attack with advantage" })

Check line of sight with cover detection:

check_line_of_sight({ from_creature: "ranger_lyra", to_creature: "goblin_1" })

Move a creature with opportunity attack validation:

move_creature({ creature_id: "fighter_kael", target_x: 10, target_y: 8, speed: 25 })

Advanced Features

Dice System

  • Standard D&D notation support: 1d20+5, 3d6, 1d8+3
  • Advantage/Disadvantage: 2d20kh1+5 (keep highest), 2d20kl1+5 (keep lowest)
  • Critical hits with automatic damage doubling
  • Support for custom modifiers and situational bonuses

Combat System

The MCP servers provide:

  • Initiative tracking: Automatic turn order management
  • Action economy: Tracking of actions, bonus actions, movement, and reactions
  • Spatial awareness: 3D positioning with full X, Y, Z coordinate system
  • Tactical intelligence: Detection of flanking, height advantage, and reach calculations
  • Terrain interaction: Support for walls, pillars, stairs, and other features
  • Visibility calculation: Line of sight with partial cover detection

How to install this MCP server

For Claude Code

To add this MCP server to Claude Code, run this command in your terminal:

claude mcp add-json "rpg-game-state" '{"name":"rpg-game-state-server","command":"node","args":["dist/index.js"],"cwd":"PATH_TO_YOUR_PROJECT/rpg-mcp-servers/game-state-server","enabled":true,"alwaysAllow":["create_character","get_character","get_character_by_name","list_characters","update_character","add_item","get_inventory","remove_item","update_item","save_world_state","get_world_state","update_world_state","create_npc","create_npc_group","get_npc","list_npcs","update_npc","remove_npc","create_encounter","add_to_encounter","get_encounter_state","get_active_encounter","start_turn","end_turn","next_turn","consume_action","end_encounter","apply_damage","save_story_progress","add_quest","get_active_quests","update_quest_state","assign_quest_to_character"]}'

See the official Claude Code MCP documentation for more details.

For 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 > Tools & Integrations and click "New MCP Server".

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

{
    "mcpServers": {
        "rpg-game-state": {
            "name": "rpg-game-state-server",
            "command": "node",
            "args": [
                "dist/index.js"
            ],
            "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/game-state-server",
            "enabled": true,
            "alwaysAllow": [
                "create_character",
                "get_character",
                "get_character_by_name",
                "list_characters",
                "update_character",
                "add_item",
                "get_inventory",
                "remove_item",
                "update_item",
                "save_world_state",
                "get_world_state",
                "update_world_state",
                "create_npc",
                "create_npc_group",
                "get_npc",
                "list_npcs",
                "update_npc",
                "remove_npc",
                "create_encounter",
                "add_to_encounter",
                "get_encounter_state",
                "get_active_encounter",
                "start_turn",
                "end_turn",
                "next_turn",
                "consume_action",
                "end_encounter",
                "apply_damage",
                "save_story_progress",
                "add_quest",
                "get_active_quests",
                "update_quest_state",
                "assign_quest_to_character"
            ]
        },
        "rpg-combat-engine": {
            "name": "rpg-combat-engine-server",
            "command": "node",
            "args": [
                "dist/index.js"
            ],
            "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/combat-engine-server",
            "enabled": true,
            "alwaysAllow": [
                "roll_dice",
                "roll_check",
                "attack_roll",
                "initiative_roll",
                "damage_roll",
                "saving_throw",
                "use_reaction",
                "use_legendary_action",
                "trigger_lair_action",
                "execute_multiattack",
                "initialize_battlefield",
                "place_creature",
                "move_creature",
                "check_line_of_sight",
                "get_area_effect_targets",
                "get_tactical_summary",
                "check_flanking",
                "check_height_advantage",
                "describe_battlefield",
                "describe_detailed_tactical_situation",
                "generate_battlefield_map",
                "get_combat_log",
                "clear_combat_log"
            ]
        }
    }
}

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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.

For Claude Desktop

To add this MCP server to Claude Desktop:

1. Find your configuration file:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
  • Windows: %APPDATA%\Claude\claude_desktop_config.json
  • Linux: ~/.config/Claude/claude_desktop_config.json

2. Add this to your configuration file:

{
    "mcpServers": {
        "rpg-game-state": {
            "name": "rpg-game-state-server",
            "command": "node",
            "args": [
                "dist/index.js"
            ],
            "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/game-state-server",
            "enabled": true,
            "alwaysAllow": [
                "create_character",
                "get_character",
                "get_character_by_name",
                "list_characters",
                "update_character",
                "add_item",
                "get_inventory",
                "remove_item",
                "update_item",
                "save_world_state",
                "get_world_state",
                "update_world_state",
                "create_npc",
                "create_npc_group",
                "get_npc",
                "list_npcs",
                "update_npc",
                "remove_npc",
                "create_encounter",
                "add_to_encounter",
                "get_encounter_state",
                "get_active_encounter",
                "start_turn",
                "end_turn",
                "next_turn",
                "consume_action",
                "end_encounter",
                "apply_damage",
                "save_story_progress",
                "add_quest",
                "get_active_quests",
                "update_quest_state",
                "assign_quest_to_character"
            ]
        },
        "rpg-combat-engine": {
            "name": "rpg-combat-engine-server",
            "command": "node",
            "args": [
                "dist/index.js"
            ],
            "cwd": "PATH_TO_YOUR_PROJECT/rpg-mcp-servers/combat-engine-server",
            "enabled": true,
            "alwaysAllow": [
                "roll_dice",
                "roll_check",
                "attack_roll",
                "initiative_roll",
                "damage_roll",
                "saving_throw",
                "use_reaction",
                "use_legendary_action",
                "trigger_lair_action",
                "execute_multiattack",
                "initialize_battlefield",
                "place_creature",
                "move_creature",
                "check_line_of_sight",
                "get_area_effect_targets",
                "get_tactical_summary",
                "check_flanking",
                "check_height_advantage",
                "describe_battlefield",
                "describe_detailed_tactical_situation",
                "generate_battlefield_map",
                "get_combat_log",
                "clear_combat_log"
            ]
        }
    }
}

3. Restart Claude Desktop for the changes to take effect

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