@smith8ca/wikijs-mcp-server
v1.0.0
Published
Model Context Protocol server for Wiki.js - enables AI assistants to interact with Wiki.js wikis
Maintainers
Readme
Wiki.js MCP Server
A Model Context Protocol (MCP) server that provides AI assistants like Claude with programmatic access to Wiki.js instances. Built with TypeScript and Node.js.
- Features
- Requirements
- Installation
- Configuration
- Usage
- Development
- Tool Reference
- Troubleshooting
- Contributing
- License
- Related Projects
- Support
Features
MCP Tools (12 total)
- search_pages - Search for pages by keyword or phrase
- list_pages - List all pages with metadata
- get_page - Get full content of a specific page
- create_page - Create new markdown pages
- update_page - Update existing pages
- delete_page - Delete pages
- get_page_tree - Get hierarchical page structure
- get_page_tags - Get tags for a specific page
- add_page_tags - Add tags to a page
- remove_page_tags - Remove tags from a page
- search_by_tags - Find pages by tags
- list_all_tags - List all tags in the wiki
MCP Resources
- Exposes all Wiki.js pages as MCP resources
- URI format:
wikijs://page/{path} - Allows AI assistants to browse and read pages directly
Requirements
- Node.js 18 or higher
- A running Wiki.js instance
- Wiki.js API token with appropriate permissions
Installation
Local Installation
# Clone the repository
git clone <repository-url>
cd wikijs-mcp-server-npm
# Install dependencies
npm install
# Copy environment template
cp .env.example .env
# Edit .env with your Wiki.js credentials
# WIKIJS_API_URL=https://your-wiki.com/graphql
# WIKIJS_API_TOKEN=your_api_token
# Build the project
npm run buildDocker Installation
# Build the Docker image
docker-compose build
# Or pull from registry (if published)
docker pull wikijs-mcp-server:latestConfiguration
Environment Variables
Create a .env file in the project root:
# Required
WIKIJS_API_URL=http://localhost:3000/graphql
WIKIJS_API_TOKEN=your_api_token_here
# Optional
WIKIJS_SSL_VERIFY=true
# WIKIJS_CA_BUNDLE=/path/to/ca-bundle.crtGetting a Wiki.js API Token
- Log into your Wiki.js instance as an administrator
- Go to Administration → API Access
- Click New API Key
- Give it a name and select appropriate permissions:
- Read:Pages (required)
- Write:Pages (required for create/update/delete)
- Copy the generated token to your
.envfile
SSL Configuration
Default: Standard SSL certificate validation
Disable SSL verification (testing only):
WIKIJS_SSL_VERIFY=falseCustom CA certificate:
WIKIJS_CA_BUNDLE=/path/to/your/ca-bundle.crtUsage
Running Locally
# Development mode (with auto-reload)
npm run dev
# Production mode
npm startIntegration with MCP Clients
Claude Desktop
Add to your claude_desktop_config.json:
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"wikijs": {
"command": "node",
"args": ["/absolute/path/to/wikijs-mcp-server-npm/dist/index.js"],
"env": {
"WIKIJS_API_URL": "http://localhost:3000/graphql",
"WIKIJS_API_TOKEN": "your_token_here"
}
}
}
}VS Code with Continue
Add to .continue/config.json:
{
"mcpServers": [
{
"name": "wikijs",
"command": "node",
"args": ["/absolute/path/to/wikijs-mcp-server-npm/dist/index.js"],
"env": {
"WIKIJS_API_URL": "http://localhost:3000/graphql",
"WIKIJS_API_TOKEN": "your_token_here"
}
}
]
}VS Code with Cline
- Open Cline settings
- Go to MCP Servers
- Add new server with:
- Command:
node - Args:
/absolute/path/to/wikijs-mcp-server-npm/dist/index.js - Environment variables as above
- Command:
Docker Usage
# Using docker-compose
docker-compose up
# Or run directly
docker run -i --rm \
-e WIKIJS_API_URL="https://your-wiki.com/graphql" \
-e WIKIJS_API_TOKEN="your_token" \
wikijs-mcp-server:latestDevelopment
Project Structure
wikijs-mcp-server-npm/
├── src/
│ ├── index.ts # Entry point
│ ├── server.ts # MCP server setup
│ ├── config/
│ │ └── env.ts # Environment configuration
│ ├── graphql/
│ │ ├── client.ts # GraphQL client
│ │ ├── queries.ts # Query definitions
│ │ └── mutations.ts # Mutation definitions
│ ├── handlers/
│ │ ├── tools.ts # Tool implementations
│ │ └── resources.ts # Resource implementations
│ ├── types/
│ │ ├── wikijs.ts # Type definitions
│ │ └── index.ts # Type exports
│ └── utils/
│ └── formatters.ts # Formatting utilities
├── tests/ # Test files
├── package.json
├── tsconfig.json
└── README.mdAvailable Scripts
npm run build # Compile TypeScript to JavaScript
npm run dev # Run in development mode with auto-reload
npm start # Run compiled server
npm test # Run tests
npm run test:watch # Run tests in watch mode
npm run test:coverage # Generate coverage report
npm run type-check # Check types without compiling
npm run lint # Lint code
npm run lint:fix # Fix linting issues
npm run clean # Remove build artifactsRunning Tests
# Run all tests
npm test
# Watch mode
npm run test:watch
# With coverage
npm run test:coverageAdding New Tools
Define the tool in
src/handlers/tools.ts:- Add to
toolDefinitionswith Zod schema - Implement handler in
toolHandlers
- Add to
If needed, add new GraphQL queries/mutations in:
src/graphql/queries.tssrc/graphql/mutations.ts
Add tests in
tests/handlers/tools.test.ts
Tool Reference
search_pages
Search for pages by keyword or phrase.
Input:
query(string, required): Search query text
Example:
{
"query": "authentication"
}list_pages
List all pages in the wiki with metadata.
Input: None
get_page
Get the full content of a specific page.
Input:
path(string, required): Page path (e.g., "home" or "docs/api")locale(string, optional): Locale code (default: "en")
Example:
{
"path": "docs/getting-started",
"locale": "en"
}create_page
Create a new markdown page.
Input:
path(string, required): Path for the new pagetitle(string, required): Page titlecontent(string, required): Markdown contentdescription(string, optional): Page descriptionlocale(string, optional): Locale code (default: "en")isPublished(boolean, optional): Publish immediately (default: true)
update_page
Update an existing page.
Input:
page_id(number, required): ID of the page to updatetitle(string, optional): New titlecontent(string, optional): New contentdescription(string, optional): New descriptionisPublished(boolean, optional): New publication status
delete_page
Delete a page.
Input:
page_id(number, required): ID of the page to delete
get_page_tree
Get a hierarchical tree view of all pages.
Input:
parent(string, optional): Parent path to filter bylocale(string, optional): Locale to filter by (default: "en")
get_page_tags
Get all tags associated with a page.
Input:
page_id(number, required): ID of the page
add_page_tags
Add tags to a page.
Input:
page_id(number, required): ID of the pagetags(array of strings, required): Tag names to add
remove_page_tags
Remove tags from a page.
Input:
page_id(number, required): ID of the pagetags(array of strings, required): Tag names to remove
search_by_tags
Find pages that have specific tags.
Input:
tags(array of strings, required): Tag names to search forlocale(string, optional): Locale to filter by (default: "en")
list_all_tags
List all tags used in the wiki.
Input: None
Troubleshooting
Connection Issues
Error: "Failed to connect to Wiki.js API"
- Verify
WIKIJS_API_URLis correct and accessible - Check that Wiki.js is running
- Ensure network connectivity
Authentication Issues
Error: "GraphQL Error: Unauthorized"
- Verify
WIKIJS_API_TOKENis correct - Check token hasn't expired
- Ensure token has required permissions
SSL Certificate Issues
Error: "SSL certificate verification failed"
Solutions:
- Use valid SSL certificate on Wiki.js
- Provide custom CA bundle:
WIKIJS_CA_BUNDLE=/path/to/cert - Disable verification (testing only):
WIKIJS_SSL_VERIFY=false
Build Issues
Error: "Cannot find module" or type errors
# Clean and rebuild
npm run clean
npm install
npm run buildServer Not Starting
Check logs for specific errors:
npm start 2>&1 | tee server.logCommon issues:
- Missing
.envfile - copy from.env.example - Invalid environment variables - check Zod validation errors
- Port conflicts - ensure stdio is available
Contributing
Contributions welcome! Please:
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Run
npm run lintandnpm test - Submit a pull request
License
MIT License - see LICENSE file for details
Related Projects
Support
For issues and questions:
- Open an issue on GitHub
- Check Wiki.js documentation
- Review MCP protocol documentation
