A comprehensive Model Context Protocol (MCP) server for Wiki.js that enables hierarchical documentation management. This server integrates with Cursor IDE to provide intelligent documentation organization and maintenance across multiple repositories.
First, clone the repository and set up environment variables:
# Copy environment template
cp config/example.env .env
# Edit .env with your credentials:
# - Set POSTGRES_PASSWORD to a secure password
# - Update other settings as needed
# Start Wiki.js with Docker
docker-compose -f docker.yml up -d
Wiki.js will be available at http://localhost:3000. Complete the initial setup in the web interface.
# Install Python dependencies
./setup.sh
# Update .env with Wiki.js API credentials:
# - Get API key from Wiki.js admin panel
# - Set WIKIJS_TOKEN in .env file
# Test the connection
./test-server.sh
# Start MCP server
./start-server.sh
Add to your ~/.cursor/mcp.json
:
{
"mcpServers": {
"wikijs": {
"command": "/path/to/wiki-js-mcp/start-server.sh"
}
}
}
Add these Global Rules in Cursor to automatically leverage documentation before coding:
Before writing any code, always:
1. Search existing documentation using wikijs_search_pages to understand current patterns and architecture
2. Check for related components, functions, or modules that might already exist
3. If documentation exists for similar functionality, follow the established patterns and naming conventions
4. If no documentation exists, create it using wikijs_create_page or wikijs_create_nested_page before implementing
5. Always update documentation when making changes using wikijs_sync_file_docs
6. For new features, use wikijs_create_repo_structure to plan the documentation hierarchy first
# Before starting a new feature
"Search the documentation for authentication patterns before implementing login"
# When creating components
"Create nested documentation under frontend-app/components before building the React component"
# For API development
"Check existing API documentation and create endpoint docs using the established structure"
# During refactoring
"Update all related documentation pages for the files I'm about to modify"
wikijs_create_repo_structure
- Create complete repository documentation structurewikijs_create_nested_page
- Create pages with hierarchical pathswikijs_get_page_children
- Navigate parent-child page relationshipswikijs_create_documentation_hierarchy
- Auto-organize project files into docswikijs_create_page
- Create new pages (with parent support)wikijs_update_page
- Update existing pageswikijs_get_page
- Retrieve page content and metadatawikijs_search_pages
- Search pages by textwikijs_delete_page
- Delete specific pages by ID or pathwikijs_batch_delete_pages
- Batch delete with pattern matching and safety checkswikijs_delete_hierarchy
- Delete entire page hierarchies with multiple modeswikijs_cleanup_orphaned_mappings
- Clean up orphaned file-to-page mappingswikijs_list_spaces
- List top-level documentation spaceswikijs_create_space
- Create new documentation spaceswikijs_manage_collections
- Manage page collectionswikijs_link_file_to_page
- Link source files to documentation pageswikijs_sync_file_docs
- Sync code changes to documentationwikijs_generate_file_overview
- Auto-generate file documentation# Create complete repository structure
await wikijs_create_repo_structure(
"My Frontend App",
"Modern React application with TypeScript",
["Overview", "Components", "API", "Testing", "Deployment"]
)
# Create nested component documentation
await wikijs_create_nested_page(
"Button Component",
"# Button Component\n\nReusable button with multiple variants...",
"my-frontend-app/components"
)
# Auto-organize entire project
await wikijs_create_documentation_hierarchy(
"My Project",
[
{"file_path": "src/components/Button.tsx"},
{"file_path": "src/api/users.ts"},
{"file_path": "src/utils/helpers.ts"}
],
auto_organize=True
)
# Preview what would be deleted (safe)
preview = await wikijs_delete_hierarchy(
"old-project",
delete_mode="include_root",
confirm_deletion=False
)
# Delete entire deprecated project
await wikijs_delete_hierarchy(
"old-project",
delete_mode="include_root",
confirm_deletion=True
)
# Batch delete test pages
await wikijs_batch_delete_pages(
path_pattern="*test*",
confirm_deletion=True
)
# Clean up orphaned file mappings
await wikijs_cleanup_orphaned_mappings()
# Docker Database Configuration
POSTGRES_DB=wikijs
POSTGRES_USER=wikijs
POSTGRES_PASSWORD=your_secure_password_here
# Wiki.js Connection
WIKIJS_API_URL=http://localhost:3000
WIKIJS_API_KEY=your_jwt_token_here
# Alternative: Username/Password
WIKIJS_USERNAME=your_username
WIKIJS_PASSWORD=your_password
# Database & Logging
WIKIJS_MCP_DB=./wikijs_mappings.db
LOG_LEVEL=INFO
LOG_FILE=wikijs_mcp.log
# Repository Settings
REPOSITORY_ROOT=./
DEFAULT_SPACE_NAME=Documentation
# Check containers
docker-compose -f docker.yml ps
# View logs
docker-compose -f docker.yml logs wiki
docker-compose -f docker.yml logs postgres
# Reset everything
docker-compose -f docker.yml down -v
docker-compose -f docker.yml up -d
# Check Wiki.js is running
curl http://localhost:3000/graphql
# Verify authentication
./test-server.sh
# Debug mode
export LOG_LEVEL=DEBUG
./start-server.sh
docker.yml
if neededpostgres_data/
and restart./setup.sh
to reinstallTo add this MCP server to Claude Code, run this command in your terminal:
claude mcp add-json "wikijs" '{"command":"/path/to/wiki-js-mcp/start-server.sh"}'
See the official Claude Code MCP documentation for more details.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > Tools & Integrations and click "New MCP Server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"wikijs": {
"command": "/path/to/wiki-js-mcp/start-server.sh"
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explicitly ask the agent to use the tool by mentioning the tool name and describing what the function does.
To add this MCP server to Claude Desktop:
1. Find your configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%\Claude\claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
2. Add this to your configuration file:
{
"mcpServers": {
"wikijs": {
"command": "/path/to/wiki-js-mcp/start-server.sh"
}
}
}
3. Restart Claude Desktop for the changes to take effect