Documentation must never contradict the code:
package.json, src/ and the build output. No stale instructions.README.md, AGENTS.md (tool list) and
env.example in the same change.--version smoke, or a dry call), the same way code is verified.Model Context Protocol (MCP) server bridging AI assistants with WikiJS v2.5 instances (GraphQL API). Three-layer architecture:
src/mcp/) — WikiJSMcpServer manages lifecycle and tool
registration in src/mcp/index.ts; each tool is a module in src/mcp/tools/.src/wikijs/) — WikiJSClient wraps GraphQL
operations via the codegen SDK; queries in src/wikijs/queries/pages.graphql;
generated types in src/wikijs/generated/ (schema-types.ts + graphql.ts).src/index.ts) — config from environment, stdio transport,
--version flag for smoke tests.Every tool in src/mcp/tools/ exports:
PARAMETERS — Zod schema for runtime validationcreateTool(wikiClient) — returns the ToolCallback handlerRegistration order and the WIKIJS_ENABLE_EDIT write-gate live in
src/mcp/index.ts. Write tools (create_page, edit_page, move_page,
delete_page, restore_page_version, convert_page_editor) are only
registered when edits are enabled.
This repo is manageable with either pnpm or npm; pnpm is primary.
Both lockfiles are committed (pnpm-lock.yaml for pnpm, package-lock.json
for the npm-based GitHub CI workflows — they were not migrated).
| Task | pnpm | npm equivalent |
|---|---|---|
| install | pnpm install |
npm install / npm ci (CI) |
| build | pnpm build |
npm run build |
| lint | pnpm lint |
npm run lint |
| test | pnpm test |
npm test |
| codegen | pnpm codegen |
npm run codegen |
| run local | node build/index.js |
same |
Run the compiled server with env vars: WIKIJS_URL=... WIKIJS_API_KEY=... node build/index.js.
Note: the package's own bin wikijs-mcp-edit is only installed for
consumers of the published package — package managers do not link the
root package's own bin into node_modules/.bin, so pnpm exec wikijs-mcp-edit
does not work from the repo itself.
pnpm-workspace.yaml)minimumReleaseAge: 7200 — dependencies (incl. transitive) must be at
least 5 days old; resolution fails otherwise
(ERR_PNPM_NO_MATURE_MATCHING_VERSION), it does not silently fall back.allowBuilds explicitly denies @parcel/watcher and unrs-resolver
postinstall scripts (both optional; lint/build/test pass without them).minimumReleaseAge — for manual version bumps
the 5-day review rule still applies.WIKIJS_URL — Wiki.js base URL without /graphql (required)WIKIJS_API_KEY — Bearer token from Admin → API Access (required)WIKIJS_ENABLE_EDIT — true enables the write tools (default off)WIKIJS_DEFAULT_LOCALE — only used for URL building; the create_page
zod default for locale is hardcoded 'en' (known asymmetry, see
src/mcp/tools/createPage.ts).env is loaded via dotenv; copy env.example as template.
NodeNext module resolution — relative imports need
.js extensions in source files.src/wikijs/generated/
(eslint ignores it).