Skip to main content
Glama
README.md
# dnd-5e-mcp

MCP server for the [D&D 5e community wiki](https://dnd5e.wikidot.com) (2014 rules).
Lets an LLM search the rule catalogue and pull any page back as Markdown.

## Tools

| Tool | Description |
|------|-------------|
| `build_index(force?)` | Refresh the page index from the wiki's `system:list-all-pages` (~2,600 pages). Returns the count. |
| `search_rules(query)` | Fuzzy-match titles in the local index. Returns `[{slug, title, type, url}]`. |
| `get_page(slug, force?)` | Fetch one page (by `slug` from search) and return its content as Markdown. Cached on disk. |

## Install

```bash
npm install
node test.mjs        # self-check (pure + live smoke tests)
node index.js        # run the stdio server
```

## Use with an MCP client

Point your client at `npx` or `node` in this directory:

```json
{
  "mcpServers": {
    "dnd-5e-mcp": {
      "command": "node",
      "args": ["/absolute/path/to/dnd-5e-mcp/index.js"]
    }
  }
}
```

Typical flow for an LLM:

1. `build_index` once (or let it build lazily).
2. `search_rules` to locate a page by name, e.g. `"fireball"`, `"fighter"`, `"bag of holding"`.
3. `get_page` with the returned `slug`, e.g. `spell:fireball`, `fighter`, `wondrous-items:bag-of-holding`.

## Notes

- 2014 rules only. The 2024 ruleset is a separate site (`dnd2024.wikidot.com`) and is not covered.
- Page content is extracted from `#page-content`, tables (`wiki-content-table`) and TOC blocks handled, converted to Markdown.
- Fetched pages and the index are cached under `.cache/` (git-ignored). Delete it to force a rebuild.
- No auth needed; the wiki is public.