MCP bridge for CozyVTT (self-hosted virtual tabletop) — let an AI agent DM/KP your campaign: server-authoritative dice, chat narration, tokens, maps, initiative, character sheets, documents. 41 tools; pinned baseline CozyVTT v1.5.0
cozyvtt-mcp
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
**English** | 中文
MCP (Model Context Protocol) bridge for CozyVTT — the self-hosted, open-source virtual tabletop. It lets an AI agent join a campaign as **DM/KP**: narrate over chat, roll server-authoritative dice on the server, move tokens, switch maps, manage initiative, and settle character sheets.
Built for and tested with Hermes Agent, but works with any MCP client (stdio transport).
Upgrading
This README describes how to install and use the current release; the change history lives in
CHANGELOG.md. Two migration points are worth knowing before you wire up a client:
- **Three tools were renamed in 0.3.0**: campaign_status → campaign_get, initiative_state →
initiative_read, token_hp → token_hp_update. No aliases are registered — update client tool
selections. Old-to-new mapping.
- **chat_read paginates with limit/cursor** (the offset argument was removed in 0.2.0).
The default tool set is every tool; optional presets are described under Tool sets.
Tool sets
**The default is every tool.** Optional registration-time filtering drops excluded tools from
tools/list entirely; it changes nothing about how the remaining tools behave.
Choose comma-separated presets (union); duplicates are accepted and all wins.
The flag overrides COZYVTT_MCP_TOOLSETS. Empty values or unknown names fail with
valid preset names and counts. --list-toolsets prints all memberships and the default,
then exits successfully without connecting to CozyVTT.
| Preset | Tools | Selection |
|---|---:|---|
| play | 20 | campaign_get, chat_read, chat_send, creature_search, dice_roll, events_poll, initiative_manage, initiative_read, map_create, map_delete, map_list, map_switch, session_list, session_manage, session_notes_update, token_add, token_delete, token_hp_update, token_move, token_place_creature |
| docs | 9 | All document_* tools plus campaign_document_list |
| roster | 7 | All character_* tools |
| macros | 4 | All saved_roll_* tools |
| admin | 1 | campaign_transfer_dm |
| all (default) | 41 | Every tool |
For an MCP client, append "--toolsets", "play" to its server args, or set
COZYVTT_MCP_TOOLSETS in its server env.
Measured with .venv/bin/python scripts/measure_tool_budget.py (offline stdio).
Bytes sum UTF-8 JSON tool definitions, excluding JSON-RPC envelope/list separators;
tokens are estimates (bytes // 4), not tokenizer measurements.
| Preset | JSON bytes | Estimated tokens | Savings vs all |
|---|---:|---:|---:|
| play | 30,925 | 7,731 | 48% |
| docs | 13,418 | 3,354 | 77% |
| roster | 9,152 | 2,288 | 85% |
| macros | 4,664 | 1,166 | 92% |
| admin | 1,199 | 299 | 98% |
| all | 59,358 | 14,839 | 0% |
The surface also includes map_create, map_delete, token_delete, and character_delete.
Create maps from existing image assets; use map_switch before deleting the current
map. token_delete removes a map token; token_hp_update changes sheet HP using a
character ID. character_delete permanently deletes an owned sheet. Add roster or
docs when a session needs those tools.
Compatibility
| cozyvtt-mcp | CozyVTT | Notes |
|---|---|---|
| **0.5.0** | **v1.5.0** (b03e287) | Exact pinned baseline. 379 offline tests on Python 3.12.13 (89 adaptation + 62 helper + 228 historical); recorded 2026-10-04 15:44 CST DM read-only REST/passive WS smoke: 16/16 checks, post-cleanup teardown and observed exit 0. Deployment identity is operator-attested. |
| **0.4.0** | **v1.2.2 / v1.4.0** | Dual baseline. Tool-set presets plus map_create/map_delete/token_delete/character_delete. Offline contract suite 228/228; the Dockerfile was replayed inside the real python:3.12-slim rootfs (hash-checked layers) and boots with no environment set, listing 41 tools. No live campaign run, and no OCI image was built (no Docker daemon on the build host). |
| **0.3.0** | **v1.2.2 / v1.4.0** | Dual baseline. Parameter descriptions, MCP annotations, container image. Offline suite 176/176; image built and booted (37 tools, no environment). No live campaign run. |
| **0.2.0** | **v1.2.2 / v1.4.0** | Dual baseline: retain original tools; new REST routes degrade explicitly on old instances. Offline suite 176/176; live v1.4.0 smoke (read/write + Documents/Saved Rolls round-trips) passed 2026-09-17. |