# Multi Agents Dnd Game

> D&D AI game master built with Strands SDK — multi-agent orchestration using MCP, A2A protocol, and RAG-based rules lookup

- **Type:** MCP server
- **Install:** `agentstack add mcp-jeannineshiu-multi-agents-dnd-game`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [jeannineshiu](https://agentstack.voostack.com/s/jeannineshiu)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT-0
- **Upstream author:** [jeannineshiu](https://github.com/jeannineshiu)
- **Source:** https://github.com/jeannineshiu/multi-agents-dnd-game

## Install

```sh
agentstack add mcp-jeannineshiu-multi-agents-dnd-game
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Multi-Agent D&D Game

A Dungeons & Dragons AI game master built with the **Strands SDK**, demonstrating multi-agent orchestration, MCP integration, and RAG-based rules lookup.

## Screenshots

| | |
|---|---|
|  |  |

## Architecture

```
Browser (React UI, port 5173)
        │
        ▼
Gamemaster Orchestrator  (FastAPI, port 8009)
        ├── Rules Agent          (A2A, port 8000)  ← ChromaDB + D&D Basic Rules PDF
        ├── Character Agent      (A2A, port 8001)  ← TinyDB character storage
        └── Dice Roll MCP Server (MCP, port 8080)  ← Real dice rolls
```

### Agents

| Agent | Port | Responsibility |
|-------|------|----------------|
| Gamemaster Orchestrator | 8009 | Receives player input, coordinates all agents, returns structured story output |
| Rules Agent | 8000 | Queries ChromaDB knowledge base built from D&D Basic Rules PDF |
| Character Agent | 8001 | Creates and retrieves characters stored in TinyDB |
| Dice Roll MCP Server | 8080 | Rolls dice via MCP protocol — no made-up results |

### Key Concepts Demonstrated

- **Multi-agent orchestration** — Gamemaster delegates tasks to specialized agents instead of doing everything itself
- **MCP (Model Context Protocol)** — Dice rolling runs as an independent server, callable by any MCP-compatible client
- **A2A (Agent-to-Agent)** — Agents communicate over HTTP with a standard protocol
- **RAG** — Rules lookup queries an actual PDF, preventing hallucinated rule answers
- **Structured output** — Orchestrator returns a typed `StoryOutput` Pydantic model with narrative, action suggestions, and dice roll details

## Setup

### Prerequisites

- Python 3.13
- Node.js 18+
- An [Anthropic API key](https://console.anthropic.com)

### Install

```bash
# Create conda environment
conda create -n strands-workshop python=3.13 -y
conda activate strands-workshop

# Install Python dependencies
pip install strands-agents strands-agents-tools "strands-agents[a2a]" \
    "fastapi[standard]" uvicorn python-dotenv \
    "chromadb>=0.4.0" "PyPDF2>=3.0.0" tinydb \
    langchain_aws langchain_chroma ollama anthropic
```

### Set API Key

```bash
export ANTHROPIC_API_KEY="sk-ant-..."
```

### Build Knowledge Base

```bash
cd 5_a2a_integration/utils
python -c "
from create_knowledge_base import create_knowledge_base
create_knowledge_base('', './dnd_knowledge_base')
"
```

## Running

Start each service in a separate terminal (all from the repo root):

```bash
# Terminal 1 — Dice MCP Server
python 4_mcp_integration/dice_roll_mcp_server.py

# Terminal 2 — Rules Agent
cd 5_a2a_integration/agents/rules_agent && python rules_agent.py

# Terminal 3 — Character Agent
cd 5_a2a_integration/agents/character_agent && python character_agent.py

# Terminal 4 — Gamemaster Orchestrator
cd 5_a2a_integration/agents/gamemaster_orchestrator && python gamemaster_orchestrator.py
```

Test with curl:

```bash
curl -X POST http://localhost:8009/inquire \
  -H "Content-Type: application/json" \
  -d '{"question": "Create a new Elf Wizard named Gandalf"}'
```

### Frontend UI (optional)

```bash
git clone https://github.com/salihgueler/game-master-frontend.git
cd game-master-frontend && npm install && npm run dev
```

Open `http://localhost:5173` and set Server URL to `http://localhost:8009`.

## Project Structure

```
├── 1_strands_basics/           Basic Agent with system prompt
├── 2_built_in_tools/           Agent with http_request tool
├── 3_custom_tools/             Custom @tool dice roller
├── 4_mcp_integration/
│   ├── dice_roll_mcp_server.py FastMCP server (port 8080)
│   └── gamemaster_mcp_client.py Interactive CLI client
└── 5_a2a_integration/
    ├── agents/
    │   ├── rules_agent/        D&D rules lookup via ChromaDB
    │   ├── character_agent/    Character CRUD with TinyDB
    │   └── gamemaster_orchestrator/  FastAPI orchestrator
    └── utils/
        └── create_knowledge_base.py  PDF → ChromaDB ingestion
```

## Based On

AWS Workshop: [Once Upon Agentic AI](https://catalog.us-east-1.prod.workshops.aws/workshops/e1493217-4bc7-42f4-87d9-e231acd743bc/en-US/0-pre-requisites)

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [jeannineshiu](https://github.com/jeannineshiu)
- **Source:** [jeannineshiu/multi-agents-dnd-game](https://github.com/jeannineshiu/multi-agents-dnd-game)
- **License:** MIT-0

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** yes
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** yes
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-jeannineshiu-multi-agents-dnd-game
- Seller: https://agentstack.voostack.com/s/jeannineshiu
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
