MCP server for a Wiki.js project. Provides full-text search, page retrieval, and optional page creation via the Model Context Protocol.
WikiMCP
MCP server for a Wiki.js project. Provides full-text search, page retrieval, and optional page creation via the Model Context Protocol.
What this repo gives you
- A Wiki.js stack (Wiki.js + Postgres) you can run locally with Docker.
- An MCP server (Node/TypeScript) that exposes Wiki tools over stdio (spawned by a client like LM Studio / Cursor / Claude Desktop).
- Receipts-first tooling:
wiki.quotereturns exact line ranges so answers can cite sources.
Architecture in one picture
┌──────────────┐ ┌───────────────────────┐
│ MCP Client │ │ Wiki.js (UI) │
│ (LM Studio / │ │ + Postgres │
│ Cursor / …) │ └──────────┬────────────┘
└──────┬───────┘ │
│ spawns (stdio) │
▼ │ reads/imports
┌───────────────────────┐ │ markdown
│ WikiMCP (this repo) │◄─────────┘
│ - tools: search/get/ │
│ quote/list/(create) │
└───────────────────────┘
Important: Docker is for Wiki.js + Postgres. The MCP server is typically spawned directly by your MCP client (no Docker required for the MCP server unless you want it).
Quick Start (sample data)
git clone https://github.com/raydeStar/WikiMCP WikiMCP
cd WikiMCP
.\bootstrap-local.ps1 -OpenUi
- Wiki.js opens at:
http://localhost:3030 - The stack includes sample content in
./wiki-content
Setup paths (choose your adventure)
1) Local with sample data (default)
.\bootstrap-local.ps1 -OpenUi
Uses ./wiki-content (characters, locations, chapters, etc.).
2) Local with empty wiki
.\bootstrap-local.ps1 -ContentMode Empty -OpenUi
Creates ./wiki-content-empty with just the en/ locale folder (sample data stays untouched).
3) Local with custom content path
.\bootstrap-local.ps1 -ContentMode Path -ContentPath "D:\my-wiki" -OpenUi
Points to any folder on your machine.
4) Reset everything (wipe DB, keep content)
.\bootstrap-local.ps1 -Reset -OpenUi
Removes Docker volumes and rebuilds from scratch. Your content folder survives.
Wiki.js first-run setup
After containers start:
- Open
http://localhost:3030 - Complete the Wiki.js setup wizard (create admin account)
- Go to Administration → Storage → Local File System (or Git)
- Set the path to:
file:///wiki-storage - Click Apply and Import Everything
Your markdown files will appear in the wiki.
Connect an LLM / MCP client (the fun part)
WikiMCP communicates via stdio (stdin/stdout). Your MCP client spawns the server directly.
1) Build the MCP server
npm install
npm run build
This produces dist/index.js.
2) Configure your MCP client
Cursor / Claude Desktop (example)
Add to your MCP config (example file: mcp-config.example.json):
{
"mcpServers": {
"novel-wiki": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "C:/Users/YourName/WikiMCP",
"env": {
"WIKI_REPO_PATH": "C:/Users/YourName/WikiMCP/wiki-content",
"WIKI_WRITE_ENABLED": "false",
"MCP_AUTH_USERNAME": "",
"MCP_AUTH_PASSWORD": ""
}
}
}
}
Adjust paths for your system.
LM Studio (concept)
LM Studio can act as an MCP host as well. Add a server entry that spawns:
node dist/index.js…and passWIKI_REPO_PATHto point at your content directory.
MCP vs REST/Swagger (1-minute version)
If you’re used to normal APIs, MCP can feel weird at first. Here’s the simple mapping:
- REST/Swagger: You design lots of URLs like
GET /pages/{id}and document them in OpenAPI. - MCP: You expose a tool list (functions) like
wiki.search,wiki.get_page,wiki.quotewith JSON schemas.
In other words:
- REST is resource-oriented (endpoints)
- MCP is capability-oriented (tools)
A typical REST call:
GET /api/wiki/pages/Tim
A typical MCP call (conceptually):
call tool wiki.get_page({ path: "/characters/white-bunny" })
The MCP client/host (LM Studio, Cursor, etc.) is the thing that:
- discovers the tool list
- decides when to call a tool
- feeds tool results back into the model
MCP Authentication (optional) (optional)
If MCP_AUTH_USERNAME and MCP_AUTH_PASSWORD are both set, every tool call must include:
{
"auth": {
"username": "your-user",
"password": "your-pass"
},
"query": "The Knights who say Ni"
}
Bootstrap helpers:
.\bootstrap-local.ps1 -AuthFromDb
or:
.\bootstrap-local.ps1 -McpAuthUsername "admin" -McpAuthPassword "secret"
Write operations
wiki.create_page is disabled by default.
Enable it by either:
.env
Tools (8)
wiki.searchFull-text search across wiki content.wiki.get_pageRetrieve a specific wiki page by path.wiki.quoteGet exact line ranges from wiki content for citations.wiki.listList wiki pages.wiki.create_pageCreate a new wiki page (disabled by default).wiki.get_pagePage retrieval.wiki.searchFull-text search.wiki.quoteReturns exact line ranges so answers can cite sources.Environment Variables
WIKI_REPO_PATHrequiredPath to the wiki content directory.WIKI_WRITE_ENABLEDEnable write operations like page creation.MCP_AUTH_USERNAMEUsername for MCP authentication (optional).MCP_AUTH_PASSWORDPassword for MCP authentication (optional).Configuration
{
"mcpServers": {
"novel-wiki": {
"command": "node",
"args": ["dist/index.js"],
"cwd": "C:/Users/YourName/WikiMCP",
"env": {
"WIKI_REPO_PATH": "C:/Users/YourName/WikiMCP/wiki-content",
"WIKI_WRITE_ENABLED": "false",
"MCP_AUTH_USERNAME": "",
"MCP_AUTH_PASSWORD": ""
}
}
}
}