
MCP Server implementation of the DnD 5e API using resources, tools, and prompts.
MCP Server implementation of the DnD 5e API using resources, tools, and prompts.
·
A Python-based server implementing the Model Context Protocol (MCP) that connects Claude and other AI assistants to Dungeons & Dragons 5e game information.
The Model Context Protocol (MCP) is a framework developed by Anthropic that enables AI assistants like Claude to communicate with external tools and services. This server leverages FastMCP, Anthropic's Python implementation of the protocol, to create a structured bridge between AI assistants and the D&D 5e API.
For a detailed explanation of MCP and how this project implements it, check out our blog article.
Clone this repository:
git clone https://github.com/yourusername/dnd-knowledge-navigator.git
cd dnd-knowledge-navigatorInstall dependencies:
uv pip install -r requirements.txtor
pip install .Configure Claude Desktop (if using with Claude):
claude_desktop_config.json file in your Claude Desktop configuration directory{
"mcpServers": {
"dnd": {
"command": "/path/to/uv",
"args": [
"--directory",
"/path/to/dnd-knowledge-navigator",
"run",
"dnd_mcp_server.py"
]
}
}
}Run the server:
uv run python dnd_mcp_server.pyWhen connected to an AI assistant, the following tools are available:
search_all_categories: Search across all D&D resources for specific termsverify_with_api: Verify D&D statements against official API datacheck_api_health: Check the health and status of the D&D 5e APIThe server includes a comprehensive source attribution system that:
The server includes a template system for formatting D&D content:
To disable templates, set TEMPLATES_ENABLED = False in src/templates/config.py.
The server includes a query enhancement system that improves search results:
To disable query enhancement, set parameters in the enhance_query function to False.
Comprehensive documentation is available in the docs/ directory:
The server maintains a local cache in the cache/ directory to minimize API calls and improve response time. This directory is excluded from git via .gitignore.
Edit prompts.py to modify or add new prompt templates, or resources.py to adjust resource endpoints.
Contributions are welcome! Please feel free to submit a Pull Request.
git checkout -b feature/amazing-feature)git commit -m 'Add some amazing feature')git push origin feature/amazing-feature)This project is licensed under the MIT License - see the LICENSE file for details.
The D&D Knowledge Navigator is organized as a Python package with the following structure:
dnd-knowledge-navigator/
├── dnd_mcp_server.py # Main server entry point
├── run_tests.py # Script to run all tests
├── setup.py # Package installation configuration
├── src/ # Source code directory
│ ├── __init__.py # Package initialization
│ ├── attribution/ # Source attribution system
│ ├── core/ # Core functionality
│ ├── query_enhancement/ # Query enhancement system
│ └── templates/ # Response formatting templates
├── tests/ # Test directory
│ ├── __init__.py # Test package initialization
│ └── test_*.py # Test files
└── docs/ # DocumentationFor a more detailed explanation of the package structure, see Package Structure Documentation.
To install the package for development:
# Clone the repository
git clone https://github.com/yourusername/dnd-knowledge-navigator.git
cd dnd-knowledge-navigator
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install the package in development mode
pip install -e .To start the D&D Knowledge Navigator server:
python dnd_mcp_server.pyTo run all tests:
./run_tests.pyPick your client and paste the snippet. Each one is the same server, written the way that client expects it.
claude mcp add dnd -- /path/to/uv --directory /path/to/dnd-knowledge-navigator run dnd_mcp_server.py{
"mcpServers": {
"dnd": {
"args": [
"--directory",
"/path/to/dnd-knowledge-navigator",
"run",
"dnd_mcp_server.py"
],
"command": "/path/to/uv"
}
}
}code --add-mcp '{"name":"dnd","args":["--directory","/path/to/dnd-knowledge-navigator","run","dnd_mcp_server.py"],"command":"/path/to/uv"}'[mcp_servers.dnd]
command = "/path/to/uv"
args = ["--directory", "/path/to/dnd-knowledge-navigator", "run", "dnd_mcp_server.py"]Runs locally on your device. Your client starts the server itself, so nothing has to be hosted.
Paste this prompt into your agent. It reads this page and does the setup for you.
Read https://aiagentslisting.com/mcp/d-and-d-knowledge-navigator to learn what the "D&D Knowledge Navigator" MCP server does and how to install it. Add it to my coding agent's MCP configuration as documented on that page, then confirm the server connects and list the tools it exposes.Agents can also browse this directory over MCP at https://aiagentslisting.com/api/mcp
This server runs locally, so we can't read its tool list over the web yet.
We could not run this server: it ships no npx package for our sandbox and no public endpoint. The four checks that need a live server are left out, and the grade tops out at B until one exists.
Maintain this server? Claiming proves you own the listing and earns the last 4 points.
Claim this listingPaste this line near the top of your repository's README. The badge always renders the current score.
[](https://aiagentslisting.com/mcp/d-and-d-knowledge-navigator)Nothing comparable is listed yet.
No tagged releases on record.
Connect to the AI Agents Listing MCP server at https://aiagentslisting.com/api/mcp using the HTTP transport and complete the sign-in when it asks. Then call the submit_review tool for the listing "d-and-d-knowledge-navigator" with a rating from 1 to 5 and a short note on what worked and what did not.No reviews yet
Be the first to share your experience with this tool.
One email a week. New agents, MCP servers and skills, and what is actually getting traction.