name: 2d6-mcp-core description: Master reference for the 2d6mcp MCP server — all tools, workflows, and environment configuration for 2d6 TTRPGs (sci-fi and fantasy).
2D6 MCP Server — Agent Instructions
You have access to the 2d6mcp MCP server. It provides a mechanical engine, dice roller, and rules reference for 2d6-based tabletop RPGs, supporting sci-fi (OGL/Cepheus Engine), fantasy (Dungeon World), percentile (Basic Roleplaying), and d20 fantasy (5E-compatible) games.
Deployment Modes
2d6mcp has two deployment modes:
- Self-Hosted MCP Server (
packages/server/) — traditional MCP stdio server, local MLX, BYOD, session DB, 32 tools - Hosted Discord Bot (
apps/worker/) — Cloudflare Worker with Discord slash commands and Workers AI (Whisper + Qwen3 MoE)
Both modes share rules databases, dice engine, prompt templates, and quality filters via packages/shared/.
Tool loyalty: Once you invoke 2d6mcp tools (particularly BYOD — query_local_byod, get_byod_chunk, synthesize_ruling), continue using them for all game content queries. Do not switch to external file-reading MCP tools unless the user explicitly asks you to examine a file outside the indexed BYOD content.
Available Tools
| Tool | Purpose |
|---|---|
roll_2d6 |
Roll 2d6 with modifier, compare against target number |
roll_d20 |
Roll d20 with modifier, advantage/disadvantage, AC/DC comparison, critical hits, fumbles |
roll_percentile |
Roll d100 with BRP-style roll-under, critical success, and fumble detection |
roll_damage |
Roll damage dice with optional type (e.g., "2d6+3 fire", "1d8 piercing") |
roll_custom |
Roll any dice notation (3d6, 1d20, 4d6+2, d66) |
roll_table |
Roll on a named table (Reaction, Encounters, Patrons) from any rules system |
query_ogl_rules |
Search OGL rules database for skills, careers, equipment, combat |
query_dw_rules |
Search DW rules database for moves, classes, spells, equipment, monsters, GM tools |
query_brp_rules |
Search BRP rules for characteristics, skills, professions, weapons, armor, spot rules, foes |
query_5ecompatible_rules |
Search 5E-compatible rules for spells, monsters, classes, feats, and rules |
query_orcus_rules |
Search Orcus 4e-compatible rules for classes, monsters, feats, and core rules |
query_local_byod |
Full-text search across your locally ingested files |
parse_character |
Parse a character sheet file into structured data |
sync_byod |
Index/re-index files from your BYOD directory |
clear_byod |
Delete the BYOD index to start fresh |
list_byod_files |
List all indexed files with chunk counts and status |
inspect_byod_file |
Show chunks for a specific indexed file |
sync_file |
Index a single file by relative path (for large files or selective indexing) |
get_byod_chunk |
Retrieve full chunk content by file path + chunk index |
discord_post |
Post messages to Discord webhooks with smart routing based on context tags |
discord_add_webhook |
Add a Discord webhook with name, URL, tags, and description |
discord_remove_webhook |
Remove a stored Discord webhook by name |
discord_list_webhooks |
List all configured webhooks (URLs partially masked) |
discord_test_webhook |
Send a test message to verify webhook connectivity |
synthesize_ruling |
Synthesize a rules ruling using local MLX LLM. Auto-looks up OGL/DW/BRP/5E-compatible/BYOD rules, returns a cited ruling. Requires mlx_lm.generate. |
resolve_from_context |
Full producer pipeline: take recent session transcript, detect rules question, look up rules, synthesize ruling, log it. |
session_start |
Start a new game session for transcript logging, rulings tracking, and context. Returns a session ID. |
session_end |
End the active game session. |
session_list |
List all recorded game sessions, most recent first. |
session_summarize |
Generate an AI summary for a session using the full transcript via MLX LLM. |
log_transcript |
Log a transcript segment to the current session — what was just said at the table. |
get_session_context |
Get recent transcript segments and rulings from a session — the last N minutes of game context. |
search_transcript |
Full-text search across session transcripts — find what was said about a topic. |
transcribe_audio |
Transcribe an audio file using local MLX Whisper. Requires mlx_whisper to be installed. |
Discord Bot Commands (Hosted, apps/worker/)
| Command | Description |
|---|---|
/ask <question> |
AI ruling with FTS5 rules search + Qwen3 MoE + quality filter |
/roll <notation> |
Dice rolling |
/session start <name> |
Start a game session |
/session end |
End the current session |
/session context [minutes] |
View recent transcript and rulings |
/search <query> |
FTS search across session transcripts |
/help |
Show available commands |
Key Principles
- System-agnostic language: Use generic descriptors — "2d6 sci-fi RPG", "2d6 fantasy RPG", "starship", "star system", "characteristic", "move", "front", "monster". Never use third-party trademarked terms.
- Task resolution by system:
- 2d6 systems (OGL, DW): 2d6 + modifier vs. target number (typically 8+). Effect margin = total - target. Use
roll_2d6. - d20 systems (5E, Orcus): d20 + modifier vs. AC/DC. Natural 20 = critical hit, natural 1 = fumble. Supports advantage/disadvantage. Use
roll_d20. - d100 systems (BRP, CoC): Roll under target percentile. ≤5% of target = critical success, 96-100 = fumble. Use
roll_percentile. - Damage: Use
roll_damage("2d6+3 fire")for damage with type labels.
- 2d6 systems (OGL, DW): 2d6 + modifier vs. target number (typically 8+). Effect margin = total - target. Use
- d66 tables: Roll two d6s and treat them as tens (first die) and ones (second die), producing 11-66. Use
roll_tablewith"dice_type": "d66". - The OGL database is pre-populated with Cepheus Engine SRD content. It covers rules, skills, careers, equipment, combat, starship operations, and world building. Always try
query_ogl_rulesbefore falling back to BYOD search. - The DW database is pre-populated with Dungeon World content (CC-BY-3.0, by Sage LaTorra and Adam Koebel). It covers moves, classes, spells, equipment, monsters, and GM tools (agendas, principles, fronts, dangers). Use
query_dw_rulesfor fantasy RPG content. - The BRP database is pre-populated with Basic Roleplaying SRD. It covers characteristics, skills, professions, weapons, armor, spot rules, and sample foes. Use
query_brp_rulesfor percentile RPG content. - The 5E-compatible database covers d20 fantasy (spells, monsters, classes, feats). Use
query_5ecompatible_rules. - The Orcus database is pre-populated with Orcus 4e-compatible SRD. It covers classes, monsters, feats, and core rules. Use
query_orcus_rulesfor 4e-compatible content. - BYOD search is for your personal files. It requires consent (
AGREE_BYOD_USE="true") and a configuredBYOD_PATH. Files must be synced before they are searchable. EachBYOD_PATHgets its own isolated database. A shared content cache deduplicates identical files across workspaces.
When to Use Each Tool
Dice Rolling
- Use
roll_2d6for standard 2d6 task resolution (skill checks, attack rolls, characteristic checks) - Use
roll_d20for d20-based fantasy RPG resolution (5E, 4E, Orcus, OSE) — supports advantage/disadvantage, AC comparison, critical hits/fumbles - Use
roll_percentilefor BRP/percentile RPG resolution (Call of Cthulhu, Basic Roleplaying, Against the Darkmaster, Pendragon) — supports roll-under with critical success/fumble - Use
roll_damagefor damage dice with optional type labels ("2d6+3 fire","1d8 piercing","4d6") - Use
roll_customfor non-standard dice (damage dice, 1d6 tables, character creation 2d6 across six characteristics) - Use
roll_tablefor random tables — this looks up the result in the OGL database
Rules Lookup
- Use
query_ogl_rulesas primary sci-fi rules reference. Specify acategoryfor targeted results (skills, careers, equipment, combat, starships, worlds, tables, categories, list_tables) - Use
query_dw_rulesfor fantasy/Dungeon World content. Specify acategoryfor targeted results (moves, classes, spells, equipment, monsters, gm_tools, rules) - Use
query_brp_rulesfor percentile RPG content. Specify acategoryfor targeted results (characteristics, skills, professions, weapons, armor, spot_rules, foes) - Use
query_5ecompatible_rulesfor d20 fantasy content. Specify acategoryfor targeted results (spells, monsters, classes, feats, rules) - Use
query_orcus_rulesfor 4e-compatible content. Specify acategoryfor targeted results (classes, monsters, feats, rules) - Use
query_local_byodwhen you need content from your personal files (supplements, house rules, campaign notes) - Use
roll_tablewith a table name to both roll on it AND see the full table entries. Use thesystemparameter to specify the rules database (ogl/dw/brp/5ecompatible/orcus).
Character Handling
- Use
parse_characterto read a character sheet file and extract UPP, characteristics, skills, name, and career
BYOD Management
- Use
sync_byodafter adding or modifying files in your BYOD directory - Use
list_byod_filesto see what's indexed and available for search - Use
inspect_byod_fileto see how a file was chunked (page breaks, heading structure) - Use
clear_byodto reset the index completely - Use
sync_fileto index a single file by relative path (for large files that timeout in bulk sync, or selective indexing) - Use
get_byod_chunkto retrieve full chunk content afterquery_local_byodreturns snippets — pass file path and chunk index
Session Management
- Use
session_startto begin a new game session — logs transcripts, rulings, and context for continuity - Use
log_transcriptto record what was said at the table during play (with speaker, source, and intent) - Use
get_session_contextto recall the last N minutes of game context (transcripts + rulings) - Use
search_transcriptto search what was said about a specific topic across the full session - Use
session_listto browse all recorded sessions - Use
session_endto close the active session - Use
session_summarizeto generate an AI summary of the full session transcript (requires MLX LLM)
Ruling Synthesis
- Use
synthesize_rulingto ask a rules question and get an AI-generated ruling with OGL/DW/BRP/5E-compatible/BYOD citations (requiresmlx_lm.generate) - Use
resolve_from_contextto run the full producer pipeline: take recent transcript, detect rules question, look up rules, synthesize ruling, and log it to the session - Use
transcribe_audioto convert recorded audio to text using local MLX Whisper (requiresmlx_whisper)
Discord Posting
- Use
discord_postto send messages to Discord webhooks — supports smart routing based on context tags and rich embeds - Use
discord_add_webhookto configure a new webhook with name, URL, and routing tags - Use
discord_remove_webhookto remove a stored webhook - Use
discord_list_webhooksto view all configured webhooks - Use
discord_test_webhookto verify connectivity to a specific webhook
Common Workflows
Resolving a Task
- Determine the appropriate characteristic or skill modifier
- Apply any difficulty modifiers (easy +2, routine +1, difficult -2, etc.)
- Call
roll_2d6with themodifierandtarget_number - Report the total, individual dice, and effect margin
- Interpret: margin 0–5 = marginal success, 6+ = exceptional success; margin -1 to -5 = marginal failure, -6 or worse = exceptional failure
Looking Up Rules
- Call
query_ogl_ruleswith a descriptivesearch_termfor sci-fi content - Call
query_dw_ruleswith a descriptivesearch_termfor fantasy content - If the result is empty or insufficient, try a different search term or add a
category - For combat mechanics, use
category: "combat". For starships, usecategory: "starships". For world building, usecategory: "worlds" - For DW monsters, use
category: "monsters". For GM tools, usecategory: "gm_tools" - For specific tables, use
category: "tables"orroll_tabledirectly
Reference Round — Turn 0
When starting a session, ensure knowledge is available:
- Call
list_byod_filesto know what personal content is indexed - Call
sync_byodif you added files recently - Pre-load relevant rules with
query_ogl_rulesfor the session's expected activities
Environment Variables
Self-Hosted MCP Server (packages/server/)
| Variable | Default | Purpose |
|---|---|---|
AGREE_BYOD_USE |
"false" |
Enable BYOD mode |
BYOD_PATH |
.reference/ (auto-discovered in project root if not set) |
Directory of local source files |
BYOD_CHUNK_SIZE |
8000 |
Characters per chunk (500–50000) |
BYOD_CHUNK_OVERLAP |
400 |
Overlap between chunks |
BYOD_MAX_FILES |
2000 |
Max files per sync |
BYOD_MAX_CHUNKS_PER_FILE |
500 |
Max chunks per file |
BYOD_SYNC_TIMEOUT_MS |
15000 |
Max ms per sync batch |
BYOD_CONTENT_CACHE_PATH |
data/byod/content_cache.db |
Shared content-addressable cache path |
OGL_DB_PATH |
data/ogl/cepheus.db |
Custom OGL database path |
DW_DB_PATH |
data/dw/dungeon-world.db |
Custom DW database path |
BRP_DB_PATH |
data/brp/basic-roleplaying.db |
Custom BRP database path |
SR5E_DB_PATH |
data/5ecompatible/5ecompatible-srd.db |
Custom 5E-compatible database path |
ORCUS_DB_PATH |
data/orcus/orcus.db |
Custom Orcus database path |
MLX_WHISPER_MODEL |
mlx-community/whisper-large-v3-turbo |
MLX Whisper model for STT |
MLX_LLM_MODEL |
mlx-community/Llama-3.2-3B-Instruct-4bit |
MLX LM model for ruling synthesis |
SESSION_DB_PATH |
~/.2d6mcp/sessions.db |
Session database location |
Hosted Cloudflare Worker (apps/worker/)
| Variable | Purpose |
|---|---|
DISCORD_BOT_TOKEN |
Discord bot token |
DISCORD_PUBLIC_KEY |
Discord interactions public key |
DISCORD_CLIENT_ID |
Discord application client ID |
DISCORD_CLIENT_SECRET |
Discord OAuth2 client secret |
JWT_SECRET |
HMAC secret for user session tokens |
STRIPE_SECRET_KEY |
Stripe secret key |
STRIPE_WEBHOOK_SECRET |
Stripe webhook signing secret |
API_URL |
Worker base URL (set in wrangler.toml) |
WEB_URL |
Web dashboard URL (set in wrangler.toml) |
Security: Never commit secrets. Worker secrets must be set via wrangler secret put.