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.
Before installation, you need to have Roo Code installed:
code --install-extension RooVeterinaryInc.roo-cline
# Game State Server
cd game-state-server
npm install && npm run build
# Combat Engine Server
cd ../combat-engine-server
npm install && npm run build
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
# Terminal 1
cd game-state-server && npm start
# Terminal 2
cd combat-engine-server && npm start
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
).
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 }
})
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" })
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
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 })
1d20+5
, 3d6
, 1d8+3
2d20kh1+5
(keep highest), 2d20kl1+5
(keep lowest)The MCP servers provide:
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.
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 > 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"
]
}
}
}
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 explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.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