LegendKeeper
io.github.chase-roohms由 GitHub 帳號 chase-roohms 發布v0.1.2更新於 Oct 31, 2026
Read and build LegendKeeper worlds from AI assistants: wiki pages, maps, timelines, facts and tags.
概覽
非官方 MCP 伺服器,讓助理讀取並建立 LegendKeeper 世界:維基頁面、資訊框事實、地圖標記、時間軸、標籤與圖片。
- 可以做什麼
- 探索與搜尋世界:列出專案、瀏覽目錄樹、搜尋、取得資源、標籤、範本、行事曆、成員與素材
- 以 Markdown 或原始 JSON 讀取文件:頁面、含座標的地圖、時間軸與看板
- 編輯頁面:支援附加、前置、取代及依章節局部寫入,寫入具版本檢查
- 管理資源與文件:建立、批次建立、更新、移動、刪除、還原、從範本建立
- 設定資訊框與側欄事實,建立地圖要素、時間軸事件與泳道,上傳圖片
- 透過 api_request 呼叫其他任意 v3 端點
- 適用情境
- 適合在 LegendKeeper 維護跑團或世界觀資料的使用者,讓助理在對話中草擬頁面、加入地圖標記、時間軸事件與事實,或搜尋既有設定。
- 執行需求
- 以本機 stdio 執行,可用 uvx、Docker 或 Python 3.11 以上搭配 pip。需要 LEGENDKEEPER_API_KEY 中的 LegendKeeper 專案 API 金鑰,且專案擁有者須為付費方案。選用變數可設定多世界、唯讀模式、上傳限制,以及帶 MCP_AUTH_TOKEN 的 HTTP 傳輸。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 LegendKeeper,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
legendkeeper-mcp
[legendkeeper-mcp: let AI assistants read and build your LegendKeeper worlds]
[CI] [PyPI] [Docker image] [MCP Registry] [License: MIT]
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.
Contents
- Features
- Requirements
- Quick start
- Client setup
- Configuration
- Tools
- How pages are edited (Markdown)
- Safety
- Troubleshooting
- Development
- Releasing
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):
Docker:
pip:
check 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):
Point 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:
VS Code (.vscode/mcp.json, the key is prompted for and stored securely):
Claude Code:
Cursor, 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.
Multiple worlds
Every tool takes an optional project argument ("strahd"), and list_projects shows what is configured.
Tools
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:
When a page is read, blocks Markdown can't express appear as readable regions:
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
Development
Testing 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:
Project layout:
Releasing
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.
來源:README.md,提交 e036d8a
工具
0版本歷史
1- v0.1.2最新Oct 17, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分