LegendKeeper MCP
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@LegendKeeper MCP Create a tavern in Waterdeep with an infobox and a map pin."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
legendkeeper-mcp

An MCP server that lets AI assistants (Claude, Copilot, Cursor, …) read and build your LegendKeeper worlds: wiki pages, infobox facts, map pins, timelines, tags, templates and images, through LegendKeeper's official v3 REST API.
Unofficial. This project is not made, endorsed or supported by LegendKeeper. It runs locally on your machine with your own API key.
You: Create a tavern called The Drunken Dragon in Waterdeep, give it an infobox with its owner and
a pin on the city map, and mention it on Volo's page.
Claude: (search → create_resource → set_facts → create_map_feature → write_page) Done! ...Contents
Related MCP server: mcp-obsidian
Features
31 curated tools designed for LLMs. Resources accept names as well as ids, and errors explain how to fix them. An
api_requestescape hatch reaches every other v3 endpoint.Pages as Markdown, both ways.
[[Wiki Links]]become real LegendKeeper mentions. Callouts, GM-only secrets, collapsible sections, task lists, tables and images are supported. Blocks Markdown can't express (infoboxes, embeds, collections…) are preserved verbatim on rewrite. See How pages are edited.Section-level editing: append, prepend, replace or extend one heading's section without touching the rest of the page. Every write is version-checked (
If-Match), so concurrent edits in the app are never silently overwritten.Structured worldbuilding: infobox and sidebar facts, map pins/regions/paths (lat/lng or image pixels), timeline events and lanes (human dates such as
"3 March 1204"), templates, batch creation of up to 100 linked resources, and image uploads from disk or URL.Multiple worlds from one server (one API key per world), plus a read-only mode.
Two transports: stdio for desktop clients, or a long-running Docker container serving streamable HTTP behind a bearer token.
Robust client: retries with backoff, honors
Retry-After, idempotency keys on every POST so retries never double-create, and rate-limit tracking.Contract-tested: the test suite runs against a fake API that validates every request and response against LegendKeeper's published OpenAPI spec. A weekly CI job re-checks against the latest spec.
Requirements
A LegendKeeper project whose owner is on a paid plan. LegendKeeper only accepts API keys for those (a trial does not count), and answers
402 PAID_PLAN_REQUIREDotherwise.An API key: in LegendKeeper open your project, go to Project Settings → Developers → API Keys, name the key, pick a role and create it. Copy the
lk_…secret; it is shown only once.Member keys can read and write content.
Admin keys can also see and create hidden resources and GM secrets, read tags (
list_tagsfalls back to counting tags itself for Member keys), see member emails and save templates.A key never has more rights than its creator, and only works in its own project.
One of: uv (recommended), Docker, or Python ≥ 3.11 with pip.
Quick start
Pick one. All of them read the key from LEGENDKEEPER_API_KEY.
uvx (no install):
LEGENDKEEPER_API_KEY=lk_... uvx legendkeeper-mcp check # verify the keyDocker:
docker run -i --rm -e LEGENDKEEPER_API_KEY=lk_... ghcr.io/chase-roohms/legendkeeper-mcp:latest checkpip:
pip install legendkeeper-mcp
legendkeeper-mcp checkcheck prints the world each configured key opens, then exits. Without check, the command starts the MCP server
on stdio, which is what desktop clients launch for you (see below).
Before the first PyPI release, use
uvx --from git+https://github.com/chase-roohms/legendkeeper-mcp legendkeeper-mcp, or build the image yourself withdocker build -t legendkeeper-mcp ..
Long-running HTTP server (Docker Compose):
cp .env.example .env # set LEGENDKEEPER_API_KEY and MCP_AUTH_TOKEN (openssl rand -hex 32)
docker compose up -d # serves http://localhost:8000/mcp, bound to 127.0.0.1 only
curl http://localhost:8000/healthzPoint HTTP-capable clients at http://localhost:8000/mcp with the header Authorization: Bearer <MCP_AUTH_TOKEN>.
Images placed in ./uploads can be uploaded with upload_image (source: /uploads/<file>).
Client setup
Ready-to-use files are in examples/.
Claude Desktop: add to claude_desktop_config.json (macOS: ~/Library/Application Support/Claude/,
Windows: %APPDATA%\Claude\), then restart Claude:
{
"mcpServers": {
"legendkeeper": {
"command": "uvx",
"args": ["legendkeeper-mcp"],
"env": { "LEGENDKEEPER_API_KEY": "lk_your_key_here" }
}
}
}VS Code (.vscode/mcp.json, the key is prompted for and stored securely):
{
"inputs": [{ "type": "promptString", "id": "lk-key", "description": "LegendKeeper API key", "password": true }],
"servers": {
"legendkeeper": {
"type": "stdio",
"command": "docker",
"args": ["run", "-i", "--rm", "-e", "LEGENDKEEPER_API_KEY", "ghcr.io/chase-roohms/legendkeeper-mcp:latest"],
"env": { "LEGENDKEEPER_API_KEY": "${input:lk-key}" }
}
}
}Claude Code:
claude mcp add legendkeeper --env LEGENDKEEPER_API_KEY=lk_... -- uvx legendkeeper-mcpCursor, Windsurf, others: same command/args/env as Claude Desktop, in the client's MCP config file.
Configuration
Everything is configured with environment variables. CLI flags (--transport, --host, --port, --read-only)
override them.
Variable | Default | Description |
| — | API key for the project named |
| — | Additional worlds. |
| — | Read the key from a file (Docker secrets). |
|
| Which world tools use when |
| discovered | Skip the lookup of the project id behind a key. |
|
| Only register reading tools; |
|
| API origin (for proxies and mocks). |
|
| Request timeout in seconds. |
|
| Retries for 429/5xx/network errors. |
| unrestricted ( |
|
|
| Maximum image size. |
|
| Allow |
|
| Log level (logs go to stderr; keys are never logged). |
|
|
|
|
| HTTP bind address. |
|
| HTTP port. |
|
| HTTP endpoint path. |
| — | Bearer token required on every HTTP request (except |
|
| Permit HTTP on a non-loopback address without a token (not recommended). |
| — | Comma-separated |
Multiple worlds
LEGENDKEEPER_API_KEY_HOMEBREW=lk_aaa
LEGENDKEEPER_API_KEY_STRAHD=lk_bbb
LEGENDKEEPER_DEFAULT_PROJECT=homebrewEvery tool takes an optional project argument ("strahd"), and list_projects shows what is configured.
Tools
Area | Tools |
Discover |
|
Read |
|
Pages |
|
Resources |
|
Documents |
|
Facts |
|
Maps |
|
Timelines |
|
Assets |
|
Anything else |
|
The server also exposes two MCP resources the assistant can read:
legendkeeper://guides/markdown (the Markdown dialect) and legendkeeper://guides/style (conventions for tags,
icons, infoboxes, pins and events, adapted from LegendKeeper's style guide). Write tools are annotated so clients
can ask for confirmation; destructive tools also require confirm: true.
How pages are edited (Markdown)
LegendKeeper stores pages as a tree of typed blocks, not Markdown. This server converts in both directions:
Markdown | LegendKeeper |
| the matching blocks |
| task list |
| callout |
| secret block (GM-only, hidden from players and public pages) |
| collapsible section |
| text marks and colors |
| mention (link to another page) |
| image (upload first with |
| any raw block (infobox, embed, meter, collection…) |
When a page is read, blocks Markdown can't express appear as readable regions:
<!-- lk:keep id="kq3…" kind="infobox" -->
**Infobox**
*Facts*
- **Ruler:** [Princess Bubblegum](lk://resources/pb…)
<!-- /lk:keep -->Writing those marker lines back preserves the original block exactly. Edits inside the region are ignored with a
warning; use set_facts, or read with opaque_blocks: "json" to edit the raw JSON. In replace mode,
paragraphs and other blocks whose content didn't change are matched to the originals. Their ids and any styling
Markdown can't show (colors, alignment, callout icons) are kept.
The converter is fuzz-tested with Hypothesis for exact round trips, including tricky punctuation, nested marks and escaping.
Safety
Read-only mode (
LEGENDKEEPER_READ_ONLY=trueor--read-only) doesn't register write tools at all.Confirmation:
delete_*tools andapi_requestDELETE refuse to run withoutconfirm: true. Deleted resources go to LegendKeeper's trash and can be brought back withrestore_resource.No lost updates: page writes send the version they were based on (
If-Match) and retry once from a fresh read on conflict.No duplicates on retry: every POST carries an idempotency key.
HTTP mode refuses to listen on a non-loopback address without
MCP_AUTH_TOKEN; compose binds to127.0.0.1only, with a read-only filesystem, all capabilities dropped and a non-root user.Uploads: only real JPEG/PNG/GIF/WebP files (checked by content) up to the size limit, optionally restricted to
LEGENDKEEPER_UPLOAD_ROOT.Secrets: keys are never logged (only masked as
lk_ab…wxyz) and never sent anywhere but LegendKeeper. Signed upload URLs receive the image bytes, not the key.
Troubleshooting
Symptom | Fix |
| The project owner needs a paid LegendKeeper plan (trials don't count). |
| Key missing, mistyped, revoked or expired. Run |
| The key's role (or its creator's) is too low, e.g. hidden resources or tags with a Member key. |
| Keys only work in their own world; configure one key per world. |
| LegendKeeper allows 120 writes/min and 300 requests/min per key. Wait a minute; batch with |
Images rejected with | Image URLs must be LegendKeeper asset URLs; use |
Client shows no tools | Check the client's MCP logs. Run the configured command yourself; config errors are printed to stderr with exit code 2. |
Development
uv sync # create .venv with dev dependencies
uv run pytest # full test suite (downloads the OpenAPI spec once into tests/.cache)
uv run ruff check . && uv run ruff format --check . && uv run mypy
uv run legendkeeper-mcp # run from source
npx @modelcontextprotocol/inspector uv run legendkeeper-mcp # poke at it interactivelyTesting layers:
tests/test_markdown*.py: converter unit tests and Hypothesis property tests (round trips must be exact).tests/test_tools.py: every tool end to end through a real MCP client session againsttests/fake_lk.py, an in-memory LegendKeeper. When the OpenAPI spec is available, every request must hit a real route with a schema-valid body, and every fake response must match the documented response schema. CI requires the spec (LK_REQUIRE_SPEC=1).tests/test_live.py: opt-in smoke tests against the real API. Write tests build everything under one[mcp-test] …sandbox resource and delete it afterwards:LEGENDKEEPER_LIVE_TESTS=1 LEGENDKEEPER_LIVE_WRITE=1 LEGENDKEEPER_API_KEY=lk_... uv run pytest tests/test_live.py -v
Project layout:
src/legendkeeper_mcp/
client.py async HTTP client (auth, retries, idempotency, pagination, errors)
config.py environment configuration
service.py per-project sessions, project-id discovery, cached resource index
documents.py reading/writing documents (page Markdown, maps, timelines, boards)
markdown/ Markdown <-> block conversion (parse, render, merge)
tools/ MCP tool definitions
server.py server assembly; http_app.py streamable HTTP + bearer auth; cli.py entry pointReleasing
CI runs on every push and PR: lint, mypy, tests on Linux/macOS/Windows (Python 3.11-3.13), a wheel build, and a Docker build with stdio/HTTP smoke tests.
To release, bump version in pyproject.toml, src/legendkeeper_mcp/__init__.py and server.json (the server
and package versions plus the image tag), update CHANGELOG.md, commit, then git tag v0.2.0 && git push --tags. The
release workflow then:
verifies the tag matches the package version and reruns CI,
publishes to PyPI using trusted publishing,
pushes a multi-arch (amd64/arm64) image with SBOM and provenance to
ghcr.io/<owner>/legendkeeper-mcp,creates a GitHub release with the built distributions,
publishes
server.jsonto the official MCP Registry asio.github.chase-roohms/legendkeeper-mcp(GitHub OIDC login, no secret needed). The registry checks ownership through themcp-namecomment at the top of this README, which PyPI shows as the package description, and theio.modelcontextprotocol.server.namelabel on the Docker image.
One-time setup: on PyPI, add a pending trusted publisher for project legendkeeper-mcp → this repository,
workflow release.yml, environment pypi, and create a pypi environment in the repository settings. GHCR needs
no setup. After the first push, make the package public in its GitHub package settings.
License
MIT. LegendKeeper is a trademark of its respective owner; this project only uses its public API.
Available Tools
31 toolsapi_requestA
Call any LegendKeeper REST v3 endpoint of this project directly (advanced: boards, calendars, block-level edits, properties, invites, restores…). Returns the raw JSON response. Writes are disabled in read-only mode.
Inputs: path (required), method (required), body, query, +3 more.
browse_treeARead-onlyIdempotent
Show the resource tree (the world's wiki hierarchy) as an indented outline with ids, icons, tags and child counts. Start here to see how a world is organized.
Inputs: depth, parent, project, refresh, +1 more.
create_documentA
Add a document (tab) to a resource: a page, a map, a timeline or a board. A resource holds at most 5.
Inputs: name (required), type (required), resource (required), project, +3 more.
create_from_templateA
Create a resource from a template (copies its documents, properties, icon and tags).
Inputs: template (required), name, parent, project, +1 more.
create_map_featureA
Add a pin, label, region, path or folder to a map document. Coordinates are [lat, lng] in the map's frame (read_document on the map shows its bounds), or image pixels with pixel_coordinates=true.
Inputs: name (required), resource (required), link, type, +12 more.
create_resourceB
Create a resource (wiki article, location, character…), optionally with page content in Markdown. Reuse existing tags (list_tags) and give it an icon. Returns the new id and its documents.
Inputs: name (required), tags, after, parent, +10 more.
create_resourcesA
Create up to 100 resources in one atomic request: ideal for scaffolding a region, a cast of NPCs or a
whole hierarchy. Give items a key and nest later items under them with parent_key.
Inputs: resources (required), project.
create_timeline_eventC
Add an event to a timeline document. Link it to the page that tells the full story.
Inputs: name (required), resource (required), end, lane, +11 more.
create_timeline_laneB
Add a lane (row) to a timeline, placed after the existing lanes.
Inputs: name (required), resource (required), size, color, +2 more.
delete_documentADestructiveIdempotent
Delete one document (tab) of a resource. It can be restored with api_request (POST /resources/{id}/docs/{docId}/restore).
Inputs: document (required), resource (required), confirm, project.
delete_map_featureCDestructiveIdempotent
Delete a feature (pin, label, region, path or folder) from a map.
Inputs: resource (required), feature_id (required), confirm, project, +1 more.
delete_resourceADestructiveIdempotent
Move a resource (with its documents, and children if cascade=true) to the trash. Restore it with restore_resource using the id returned here.
Inputs: resource (required), cascade, confirm, project.
delete_timeline_eventCDestructiveIdempotent
Delete an event from a timeline.
Inputs: event_id (required), resource (required), confirm, project, +1 more.
get_resourceARead-onlyIdempotent
Get one resource's details: path, tags, aliases, icon, banner, documents, sidebar properties (facts) and children. Use read_document to read a document's content.
Inputs: resource (required), project.
list_assetsBRead-onlyIdempotent
List the world's asset library (uploaded images, maps, folders) with ids and URLs. Image URLs can be used in page images, banners, map images and events.
Inputs: limit, project, folder_id.
list_calendarsARead-onlyIdempotent
List the calendars timelines can use (built-in ones like gregorian, harptos, exandria, plus custom calendars): id, name, months and eras.
Inputs: project.
list_membersARead-onlyIdempotent
List the members of the world and their roles (emails are only visible to ADMIN keys).
Inputs: project.
list_projectsARead-onlyIdempotent
List the LegendKeeper projects (worlds) this server is configured for, with the default project and whether writes are enabled. Each API key belongs to exactly one project.
Inputs: no named parameters.
list_tagsARead-onlyIdempotent
List every tag used in the world with how many resources carry it. Check this before tagging so you reuse existing tags with the exact same spelling.
Inputs: project.
list_templatesARead-onlyIdempotent
List resource templates (id, name, parent). Use create_from_template to instantiate one.
Inputs: project.
move_resourceAIdempotent
Move a resource (and its children) to another parent and/or position among its siblings.
Inputs: resource (required), after, before, project, +1 more.
read_documentARead-onlyIdempotent
Read a document of a resource. Pages come back as Markdown (with mentions as Name
links); maps list their pins/regions/paths with coordinates; timelines list lanes and events; boards list
their text. Without document, the first page is used, else the first map, timeline or board.
Inputs: resource (required), format, project, document, +1 more.
restore_resourceAIdempotent
Restore a deleted resource from the trash (its parent must not be deleted).
Inputs: resource_id (required), project.
searchARead-onlyIdempotent
Full-text search across resource names, aliases and document content (best match first). Returns ids, paths, tags and the matching passage.
Inputs: query (required), limit, project.
set_factsBIdempotent
Set at-a-glance facts (e.g. Race, Age, Ruler, Population) as key-value rows in the page's infobox or the resource's sidebar. Creates the infobox / property group when it does not exist yet.
Inputs: facts (required), resource (required), title, target, +2 more.
update_documentBIdempotent
Rename a document, hide/show it, toggle full width, set a timeline's calendar or a map's image.
Inputs: document (required), resource (required), name, project, +4 more.
update_map_featureCIdempotent
Change a map feature: rename, move, reshape, relink, restyle or hide it.
Inputs: resource (required), feature_id (required), link, name, +11 more.
update_resourceAIdempotent
Change a resource's name, tags, aliases, icon, visibility, lock or banner. Content is edited with write_page; facts with set_facts; position in the tree with move_resource.
Inputs: resource (required), name, tags, aliases, +12 more.
update_timeline_eventCIdempotent
Change a timeline event's name, dates, lane, link or style.
Inputs: event_id (required), resource (required), end, lane, +11 more.
upload_imageA
Upload an image to the world's asset library and return its asset id and URL. Use the URL in a page
image (), a resource banner (update_resource banner_url) or as a map image
(create_document / update_document map_image_asset_id).
Inputs: source (required), name, project, folder_id, +1 more.
write_pageA
Write Markdown to a page document. [[Name]] and text become mentions; callouts, secrets, tables, task lists and images are supported. Writes are atomic; pass expected_version (from read_document) so edits made in the app after you read the page are never overwritten.
Inputs: mode (required), markdown (required), resource (required), project, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 31 tools
Most tools target a distinct resource+action (resources, documents, map features, timeline events each have their own verbs). A few pairs could be confused at a glance — create_resource vs create_resources vs create_from_template, and get_resource vs read_document (metadata vs content) — but the descriptions clearly delineate them.
Strong verb_noun snake_case pattern dominates (list_projects, create_resource, update_map_feature, delete_timeline_event). Minor deviations are 'search' (bare verb, no noun) and 'api_request' (noun_verb ordering), but overall the convention is predictable.
31 tools is on the heavy side, but the domain is genuinely broad — wiki resources, documents (pages/maps/timelines/boards), assets, tags, calendars and members. The count is defensible for that surface, though some document/map/timeline CRUD could arguably be folded together.
Near-complete lifecycle coverage: full CRUD plus trash/restore for resources, documents, map features and timeline events, plus search, tree browsing, tags, templates, facts, and asset upload. The api_request escape hatch explicitly covers remaining gaps (boards, calendars, invites, block edits).
Maintenance
Related MCP Connectors
Persistent memory, hybrid search and a goal graph for AI agents, over stdio or remote HTTP.
D&D and TTRPG campaign manager for GMs: your AI reads and writes a live, typed campaign database.
Personal wiki and memory layer for AI assistants. Persistent, structured memory across sessions.
Access your Kazkar TTRPG world — campaigns, chronicles, transcripts, lore — in any MCP client.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with Obsidian vaults for creating, reading, searching, and managing notes, daily notes, TODOs, session reports, and backlinks through both stdio and HTTP/SSE transports.103,585 npm4MIT
- AlicenseNot gradedqualityCmaintenanceConnects AI assistants to Obsidian vaults via the Local REST API to search notes, retrieve content, and perform semantic searches. It features self-healing multi-URL connectivity and supports both stdio and HTTP transports for flexible deployment.202 npm13MIT
- AlicenseNot gradedqualityBmaintenanceConnects AI assistants to TTRPG campaign data for managing characters, sessions, locations, factions, items, quests, and more.4MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI assistants to read and write a shared D&D campaign world, with tools for searching, retrieving, creating, updating, and linking pages, accessible via HTTP or stdio.-