A Go MCP server for D&D campaign state management, dice rolling, and session memory. - Serves a Model Context Protocol (MCP) toolset over stdio or streamable HTTP. - Stores campaign data in per-campaign SQLite databases. - Tracks characters, plot events/hooks, world flags, roll history, checkpoints, and session summaries. - Generates session briefs and markdown recaps for fast DM context restorati
Add this skill
npx mdskills install andr1an/llmdmWell-architected D&D campaign manager with comprehensive tooling and robust persistence
A Go MCP server for D&D campaign state management, dice rolling, and session memory.
stdio or streamable HTTP.1.25.6github.com/mark3labs/mcp-gomodernc.org/sqlite).env via github.com/joho/godotenvcmd/server/main.go # MCP server bootstrap, transport, tool registration/handlers
config/config.go # Environment config parsing and defaults
internal/db/ # SQLite open/migrations and embedded schema
internal/dice/ # Dice parser/roller and log models
internal/memory/ # Data access layer for campaign entities
internal/session/ # Brief rendering, recap rendering, event compression
internal/dm/ # DM system prompt generation
internal/types/ # Shared domain structs
>= 1.25Environment variables (see .env.example):
| Variable | Default | Description |
|---|---|---|
ANTHROPIC_API_KEY | (empty) | Optional key for Anthropic summarization in end_session |
DB_PATH | ./data/campaigns | Base directory for campaign database files |
LOG_LEVEL | info | debug, info, warn, error |
MCP_TRANSPORT | stdio | stdio, http, or streamable-http |
HTTP_ADDR | 127.0.0.1:8080 | Bind address for HTTP mode (loopback by default) |
MCP_HTTP_ENDPOINT | /mcp | MCP endpoint path in HTTP mode |
READ_TIMEOUT | 15s | HTTP read timeout (also used for read header timeout) |
WRITE_TIMEOUT | 60s | HTTP write timeout |
IDLE_TIMEOUT | 60s | HTTP idle timeout |
.envcp .env.example .env
make build
make test
make run
Additional targets:
make lint (requires golangci-lint)make build-linux (cross-compile to bin/dnd-mcp-linux)make cleango run ./cmd/server serve
Binary usage:
./bin/dnd-mcp serve
stdio (default)Use when launching the server as a local MCP subprocess from an MCP client.
MCP_TRANSPORT=stdio ./bin/dnd-mcp serve
MCP_TRANSPORT=http HTTP_ADDR=127.0.0.1:8080 MCP_HTTP_ENDPOINT=/mcp ./bin/dnd-mcp serve
Security note: HTTP transport does not provide built-in authentication. Keep HTTP_ADDR bound to loopback (for example, 127.0.0.1:8080) unless you place it behind a trusted authn/authz proxy.
Health endpoint:
curl http://127.0.0.1:8080/health
MCP endpoint:
http://127.0.0.1:8080/mcpThis repo includes .mcp.json for a local HTTP MCP server:
{
"mcpServers": {
"dnd-campaign": {
"type": "http",
"url": "http://127.0.0.1:8080/mcp"
}
}
}
stdio transport)Use this when configuring Claude to launch the MCP server as a local subprocess:
{
"mcpServers": {
"dnd-campaign": {
"command": "/absolute/path/to/bin/dnd-mcp",
"args": ["serve"],
"env": {
"MCP_TRANSPORT": "stdio"
}
}
}
}
rollroll_contestedroll_saving_throwget_roll_historycreate_campaignsave_characterupdate_characterget_characterlist_characterssave_plot_eventlist_open_hooksresolve_hookset_world_flagget_world_flagsstart_sessionend_sessioncheckpointget_session_brieflist_sessionsget_npc_relationshipsexport_session_recapEach campaign is persisted in its own SQLite file:
/.dbCore tables (auto-migrated on access):
campaignscharactersplot_eventsplot_hooksworld_flagsroll_logsessionscheckpointsSchema source: internal/db/schema.sql.
end_session always returns a summary:
ANTHROPIC_API_KEY is set and the API call succeeds, summary is model-generated.OPEN HOOKS scaffold.This keeps workflows resilient in offline or degraded network/API conditions.
log/slog.make test.invalid MCP_TRANSPORT ...: set to one of stdio, http, streamable-http.Failed to load config: verify env values and .env formatting.end_session: confirm raw_events is non-empty.HTTP_ADDR, MCP_HTTP_ENDPOINT, and that client URL matches exactly.Install via CLI
npx mdskills install andr1an/llmdmllmdm is a free, open-source AI agent skill. A Go MCP server for D&D campaign state management, dice rolling, and session memory. - Serves a Model Context Protocol (MCP) toolset over stdio or streamable HTTP. - Stores campaign data in per-campaign SQLite databases. - Tracks characters, plot events/hooks, world flags, roll history, checkpoints, and session summaries. - Generates session briefs and markdown recaps for fast DM context restorati
Install llmdm with a single command:
npx mdskills install andr1an/llmdmThis downloads the skill files into your project and your AI agent picks them up automatically.
llmdm works with Claude Code, Claude Desktop, Cursor, Vscode Copilot, Windsurf, Continue Dev, Gemini Cli, Amp, Roo Code, Goose. Skills use the open SKILL.md format which is compatible with any AI coding agent that reads markdown instructions.