DM20 Protocol

DM20 Protocol

A comprehensive MCP server for managing AI-assisted Dungeons & Dragons campaigns, featuring tools for character sheets, combat tracking, and world-building. It enables players and DMs to interact with 5e game mechanics and query personal PDF rulebooks using RAG capabilities.

Category
访问服务器

README

DM20 Protocol

A comprehensive Model Context Protocol server for managing AI-assisted Dungeons & Dragons campaigns, built with FastMCP 2.9+.

  • For Groups — A toolkit to help run campaigns more effectively
  • For Solo Players — A complete virtual D&D experience with AI as the DM
  • For Worldbuilders — Tools to create rich, interconnected game worlds

Status: Under active development. See Roadmap for what's next.

Features

  • Campaign Management — Create and switch between multiple campaigns
  • Character Sheets — Full D&D 5e stats, inventory, spellcasting, progression
  • NPCs & Locations — Rich world-building with relationships and connections
  • Quest Tracking — Objectives, status, rewards, and branching paths
  • Combat System — Initiative, turns, conditions, damage/healing
  • Session Notes — Per-session summaries, XP, loot, attendance
  • Adventure Log — Searchable timeline of all campaign events
  • Dice & Utilities — Rolls, XP calculations, rules lookup
  • PDF Rulebook Library — Import and query your own PDFs and homebrew content
  • 50+ MCP Tools — Full list in the User Guide

Installation

This server implements the open Model Context Protocol standard. It works with any MCP-compatible client — not just Claude. If your AI tool supports MCP, it can run this server.

Tested with: Claude Desktop, Claude Code, Cursor, VS Code (Copilot), Windsurf, Cline, OpenAI Codex, Gemini CLI.

Quick Install (Recommended)

bash <(curl -fsSL https://raw.githubusercontent.com/Polloinfilzato/dm20-protocol/main/install.sh)

The interactive installer is designed to get you running with zero prior setup. It handles everything from prerequisites to MCP client configuration in a single command.

What the installer does for you:

Step What happens
Platform detection Identifies your OS (macOS, Linux, WSL) and CPU architecture
Dependency resolution Detects missing tools and offers to install them automatically
Homebrew (macOS) If not installed, explains what it is and offers one-click setup
uv Auto-installs via Homebrew (macOS) or official installer (Linux)
Python 3.12 Auto-installs via uv python install — no system Python needed
git Auto-installs via Homebrew (macOS) or system package manager (Linux)
Repository clone Clones the repo or updates an existing copy
iCloud Drive protection Detects iCloud-synced directories and shields .venv from sync corruption
Virtual environment Creates .venv and installs all Python dependencies
MCP client config Writes the JSON config for Claude Desktop, Claude Code, or both
Data directory Sets up campaign storage in your preferred location
Verification Smoke-tests the server to confirm everything works

Supported platforms:

Platform Status Notes
macOS (Apple Silicon) Full support Homebrew integration for all dependencies
macOS (Intel) Full support RAG/semantic search unavailable (onnxruntime limitation)
Linux (x86_64 / arm64) Full support Auto-detects apt, dnf, pacman, zypper, apk
Windows (via WSL) Full support WSL is detected as Linux — everything works
Windows (native) Not supported Use WSL instead

You don't need to install anything beforehand. The only requirement is curl and bash, which you already have if you're running the command above. The installer takes care of the rest, asking permission before each step.

Manual Install

Clone and install dependencies (same for all clients):

git clone https://github.com/Polloinfilzato/dm20-protocol.git
cd dm20-protocol
uv sync

Then configure your client:

<details> <summary><strong>Claude Desktop</strong></summary>

Add to ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "dm20-protocol": {
      "command": "/absolute/path/to/uv",
      "args": ["run", "python", "-m", "dm20_protocol"],
      "cwd": "/absolute/path/to/dm20-protocol",
      "env": {
        "DM20_STORAGE_DIR": "/absolute/path/to/your/data"
      }
    }
  }
}

Important: Claude Desktop does not inherit your shell PATH. Use the absolute path to uv (find it with which uv).

</details>

<details> <summary><strong>Claude Code</strong></summary>

Add to ~/.claude/mcp.json (global) or .mcp.json (project-level):

{
  "mcpServers": {
    "dm20-protocol": {
      "type": "stdio",
      "command": "uv",
      "args": ["run", "python", "-m", "dm20_protocol"],
      "cwd": "/path/to/dm20-protocol",
      "env": {
        "DM20_STORAGE_DIR": "/path/to/your/data"
      }
    }
  }
}

</details>

<details> <summary><strong>Cursor / Windsurf / Cline</strong></summary>

These editors have built-in MCP support. Add the server through their MCP settings UI, or edit the config file directly:

  • Cursor: ~/.cursor/mcp.json
  • Windsurf: ~/.codeium/windsurf/mcp_config.json
  • Cline: VS Code settings → Cline → MCP Servers
{
  "mcpServers": {
    "dm20-protocol": {
      "command": "uv",
      "args": ["run", "python", "-m", "dm20_protocol"],
      "cwd": "/path/to/dm20-protocol",
      "env": {
        "DM20_STORAGE_DIR": "/path/to/your/data"
      }
    }
  }
}

</details>

<details> <summary><strong>VS Code + GitHub Copilot</strong></summary>

Add to your VS Code settings.json or .vscode/mcp.json:

{
  "mcp": {
    "servers": {
      "dm20-protocol": {
        "command": "uv",
        "args": ["run", "python", "-m", "dm20_protocol"],
        "cwd": "/path/to/dm20-protocol",
        "env": {
          "DM20_STORAGE_DIR": "/path/to/your/data"
        }
      }
    }
  }
}

Requires Copilot Chat in Agent Mode (VS Code 1.99+).

</details>

<details> <summary><strong>Other MCP Clients (Codex, Gemini CLI, etc.)</strong></summary>

Any MCP-compatible client can use this server. The key configuration:

  • Command: uv run python -m dm20_protocol
  • Working directory: The cloned repository root
  • Environment: DM20_STORAGE_DIR — path where campaign data is stored
    • Default: ./data relative to the repository root (created automatically on first run)
    • Recommended: use an absolute path like ~/dm20-data to keep campaign data separate from the repo, making backups and updates easier

Refer to your client's documentation for where to add MCP server entries. The transport is stdio (the default for most clients).

</details>

Quick Start

Once your MCP client is configured, try these natural language commands to get started:

Create a new campaign called "The Lost Kingdom"
Create a character named Elara, a High Elf Wizard with 16 INT
Create a location called "Silverdale", a peaceful village surrounded by ancient forests
Create an NPC named Marta, an elderly herbalist who lives in Silverdale
Create a quest called "The Missing Amulet" given by Marta

The AI will use DM20's tools automatically — no special syntax needed. Just describe what you want in plain English.

For the full list of 50+ tools and advanced usage, see the User Guide. For a complete example campaign, see example/dnd/.

Optional: RAG Dependencies

For semantic search capabilities (vector-based library queries via ask_books):

uv sync --extra rag

Note: RAG dependencies (chromadb, onnxruntime) are not available on macOS Intel (x86_64). The server works fine without them — only the ask_books tool requires RAG. All other library tools use keyword search.

Development

git clone https://github.com/Polloinfilzato/dm20-protocol.git
cd dm20-protocol
uv sync --group dev

Run tests:

uv run pytest tests/

Run the server locally:

uv run python -m dm20_protocol

Claudmaster — AI Dungeon Master

The Claudmaster multi-agent AI DM system is architecturally complete — Narrator, Archivist, and Module Keeper agents, consistency engine, improvisation control, and multi-player support are all implemented. Next step is wiring agents to real LLM calls and validating with actual gameplay.

Based on academic research showing multi-agent GM outperforms single-agent approaches.

See the full Roadmap for what's next.

Documentation

Credits

This project started as a fork of gamemaster-mcp by Joel Casimir, who created the initial foundation for D&D campaign management via MCP.

Component Origin Lines
Original code (v0.1.0 foundation) Joel Casimir ~3.9%
New code (library system, claudmaster, tools, tests) DM20 Protocol contributors ~96.1%

The project has since been extensively rewritten and expanded with 50+ new tools, a PDF rulebook library system, the Claudmaster multi-agent architecture, and comprehensive test coverage.

License

MIT License

推荐服务器

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 多个工具。

官方
精选
本地
Kagi MCP Server

Kagi MCP Server

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

官方
精选
Python
graphlit-mcp-server

graphlit-mcp-server

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

官方
精选
TypeScript
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 模型以安全和受控的方式获取实时的网络信息。

官方
精选