ChatRPG

ChatRPG

A lightweight ChatGPT app that converts your LLM into a Dungeon Master!

Category
访问服务器

README

ChatRPG

Lightweight D&D 5e LLM-as-DM Engine A Model Context Protocol (MCP) server providing 50 core D&D 5e tools for AI Dungeon Masters.

Status Progress Build


Quick Start

1. Build the Server

npm install
npm run build

2. Test the Server

# Run the built-in test
node test-server.mjs

# Or manually test a tool call
npm start
# (Server runs on stdio - send JSON-RPC messages)

3. Register with Claude Desktop

Add this configuration to your Claude Desktop config file:

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

{
  "mcpServers": {
    "rpg-lite": {
      "command": "node",
      "args": [
        "C:\\Users\\mnehm\\AppData\\Roaming\\Roo-Code\\MCP\\rpg-lite-mcp\\dist\\index.js"
      ]
    }
  }
}

Important: Replace the path with your actual installation directory!

4. Restart Claude Desktop

The server will auto-start when Claude Desktop launches.


Available Tools (9/50)

Combat Module (4)

  • roll_dice - Standard dice notation with modifiers (2d6+3, 4d6kh3)
  • manage_condition - Apply/remove D&D 5e conditions with duration tracking
  • create_encounter - Initialize combat encounters with participants and terrain
  • execute_action - Execute combat actions (attack, dash, disengage, dodge, grapple, shove) including opportunity attacks

Characters Module (4)

  • create_character - Full D&D 5e character creation with auto-calculated stats
  • get_character - Retrieve character by ID with rich formatting
  • update_character - Update character stats, HP, level, equipment with before/after comparison
  • roll_check - Perform skill checks, saving throws, and ability checks

Spatial Module (1)

  • measure_distance - Grid-based distance calculation (5e rules)

Testing

# Run all tests
npm test

# Run tests once (no watch mode)
npm test -- --run

# Run with coverage
npm run test:coverage

Current Status: 250/250 tests passing across 12 test files


Project Structure

rpg-lite-mcp/
├── src/
│   ├── index.ts           # MCP server entry point
│   ├── registry.ts        # Tool registration hub
│   ├── types.ts           # Shared TypeScript types
│   └── modules/
│       ├── dice.ts        # Dice rolling engine
│       ├── characters.ts  # Character CRUD
│       ├── combat.ts      # Encounter management
│       ├── spatial.ts     # Grid mechanics
│       ├── magic.ts       # Spellcasting (planned)
│       └── data.ts        # Session persistence (planned)
├── tests/                 # Vitest test suites
├── data/                  # Runtime JSON storage
│   └── characters/        # Character persistence
└── dist/                  # Compiled output (npm run build)

Development

Watch Mode (Auto-rebuild)

npm run dev

Adding a New Tool

  1. Define Schema in src/modules/[module].ts
  2. Write Tests in tests/[module]/[tool].test.ts (TDD: Red phase)
  3. Implement Handler (Green phase)
  4. Register Tool in src/registry.ts
  5. Verify with npm test -- --run

Git Workflow

This project acts as a Lite Gitflow repository:

  • main: Stable, production-ready code. Only checked-out for release.
  • development: Active development branch. All features merged here first.

Architecture

MCP Protocol

  • Transport: stdio (standard input/output)
  • Format: JSON-RPC 2.0
  • Capabilities: Tools only (no resources/prompts yet)

Tool Design Principles

  1. Immersive ASCII Art - All responses use box drawing for a retro-game aesthetic
  2. Zod Validation - Every tool has strict input schema validation
  3. Stateful Persistence - Characters/encounters saved to ./data/
  4. D&D 5e Accurate - Proficiency bonuses, hit dice, grid mechanics all SRD-compliant
  5. Terminal-First - Monospace-optimized, works in any CLI/chat interface

Example Usage

Once registered with Claude Desktop, you can ask:

"Create a level 5 halfling rogue named Finn with high dexterity"

Claude will call create_character and return:

╔═══════════════════════ CHARACTER SHEET ════════════════════════╗
║                             Finn                                ║
║                  PC - Halfling Rogue (Level 5)                  ║
║                                                                 ║
║                   HP: [████████████████] 35/35                  ║
║                                                                 ║
║ ──────────────────────────────────────────────────────────────  ║
║                                                                 ║
║ AC         │ Speed        │ Initiative   │ Prof Bonus          ║
║ 15         │ 25 ft        │ +4           │ +3                  ║
║                                                                 ║
║ ──────────────────────────────────────────────────────────────  ║
║                                                                 ║
║            STR              DEX              CON                ║
║             10               18               14                ║
║            (+0)             (+4)             (+2)               ║
║                                                                 ║
║            INT              WIS              CHA                ║
║             12               13               10                ║
║            (+1)             (+1)             (+0)               ║
║                                                                 ║
║ ──────────────────────────────────────────────────────────────  ║
║                                                                 ║
║ Character ID: a7f3e8d1-4c2b-9f3a-8d6e-1b2c3d4e5f6g             ║
║ Created: 2025-12-17 18:45:00                                   ║
║ ╚════════════════════════════════════════════════════════════════╝

Try other commands:

  • "Roll 2d6+3 for damage"
  • "Measure distance from (0,0) to (5,8)"
  • "Add the blinded condition to goblin-1 for 3 rounds"

Roadmap

Tier 1: Foundation (In Progress)

  • [x] roll_dice
  • [x] create_character, get_character, update_character
  • [x] manage_condition
  • [x] measure_distance
  • [ ] list_characters
  • [x] create_encounter, execute_action(Phases 1-2), apply_damage(merged)

Tier 2: Combat Support

  • [ ] advance_turn, render_battlefield
  • [x] roll_check
  • [ ] resolve_attack (merged into execute_action)
  • [ ] roll_death_save

Tier 3: Advanced Features

  • [ ] Magic system (spell slots, concentration)
  • [ ] Spatial mechanics (AoE, line of sight, cover)
  • [ ] Session management (notes, locations, party)

See TOOLS_CHECKLIST.md for full implementation status.


Troubleshooting

Server Won't Start in Claude Desktop

  1. Check the path in claude_desktop_config.json is absolute and correct
  2. Verify build with npm run build
  3. Test manually with node dist/index.js (should print "RPG-Lite MCP Server running on stdio")
  4. Check Claude logs (usually in %APPDATA%\Claude\logs on Windows)

Tool Calls Failing

  1. Rebuild with npm run build
  2. Check test suite with npm test -- --run
  3. Verify data directory exists: mkdir -p data/characters

Contributing

This project follows strict TDD protocol:

  1. Red: Write failing tests first
  2. Green: Implement minimal code to pass
  3. Refactor: Clean up and optimize

All PRs must:

  • Include tests for new functionality
  • Maintain 100% test pass rate
  • Pass TypeScript strict mode compilation
  • Follow existing code structure

License

Proprietary - See LICENSE for details. Personal, non-commercial use permitted.


Credits

Built with:


Status: Alpha - 9/50 tools operational | TDD-driven development | 250/250 tests passing

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选