Wikijs Mcp Server

by heAdz0r

509 downloads
Not rated
GitHub

About

Model Context Protocol (MCP) server for Wiki.js integration via GraphQL API.

Details

Author
heAdz0r
Downloads
509
Categories
Knowledge Base

- Page management: get, create, update, delete, and search pages
- User management: list, search, create, and update users
- Group management: list groups and manage membership
- Two transport modes: STDIO and HTTP
- Multi‑stage search with GraphQL, metadata, and HTTP fallback
- Editor integration for Cursor and VS Code via MCP

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Wikijs Mcp Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Clone the repository, run npm run setup to install dependencies and create the .env file, then edit .env with your Wiki.js base URL and API token. Start the HTTP server with npm start (or npm run server:stdio for STDIO mode). For Cursor IDE, ensure .cursor/mcp.json is configured with transport: "http", url, events, and your real API token.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "wikijs mcp server": {
            "wikijs": {
                "command": "docker",
                "transport": "http",
                "url": "http://localhost:3200/mcp",
                "events": "http://localhost:3200/mcp/events",
                "cwd": "/path/to/your/wikijs-mcp-server",
                "env": {
                    "WIKIJS_BASE_URL": "https://wiki.example.com",
                    "WIKIJS_TOKEN": "WikiJS-API-TOKEN"
                }
            }
        }
    }
}

McpServers

{
    "wikijs": {
        "command": "docker",
        "transport": "http",
        "url": "http://localhost:3200/mcp",
        "events": "http://localhost:3200/mcp/events",
        "cwd": "/path/to/your/wikijs-mcp-server",
        "env": {
            "WIKIJS_BASE_URL": "https://wiki.example.com",
            "WIKIJS_TOKEN": "WikiJS-API-TOKEN"
        }
    }
}

Wiki.js MCP Server

MCP
License
Node.js

Model Context Protocol (MCP) server for Wiki.js integration via GraphQL API.

πŸ“– Description

This project provides an MCP server for interacting with Wiki.js through GraphQL API. MCP (Model Context Protocol) is an open protocol developed by Anthropic that enables AI models to safely interact with external services and tools.

The server provides a unified interface for working with Wiki.js that can be used by various AI agents and tools supporting MCP.

✨ Features

πŸ“„ Page Management

- Get Wiki.js pages by ID
- Get page content
- Get list of pages with sorting
- Smart page search (by content, titles, and metadata)
- Create new pages
- Update existing pages
- Delete pages

πŸ‘₯ User Management

- Get list of users
- Search users
- Create new users
- Update user information

πŸ”§ Group Management

- Get list of user groups
- Manage group membership

🌐 Transports

- STDIO: for editor integration (Cursor, VS Code)
- HTTP: for web integrations and API access

πŸš€ Quick Start

> ⚑ Want to start right now? See 5-Minute Guide

Installation

1. Clone the repository:

git clone https://github.com/heAdz0r/wikijs-mcp-server.git
cd wikijs-mcp-server

2. Run automatic setup:

npm run setup

This script will automatically:

- Install dependencies
- Create .env file based on example.env
- Build TypeScript code

Configuration

3. Edit the .env file and specify your Wiki.js settings:

# Port for HTTP MCP server
PORT=3200

Base URL for Wiki.js (without /graphql)

WIKIJS_BASE_URL=http://localhost:3000

Wiki.js API token

WIKIJS_TOKEN=your_wikijs_api_token_here

4. Edit the .cursor/mcp.json file and replace your_wikijs_api_token_here with your real token

> How to get Wiki.js API token:
>
> 1. Log into Wiki.js admin panel
> 2. Go to "API" section
> 3. Create a new API key with necessary permissions
> 4. Copy the token to .env AND to .cursor/mcp.json

πŸ“¦ Running

HTTP server (recommended)

# Main HTTP server with Cursor MCP support
npm start

or

npm run start:http

TypeScript version

npm run start:typescript

STDIO mode (for direct editor integration)

npm run server:stdio

Development mode

npm run dev

Testing

npm test

πŸ”Œ Editor Integration

Cursor IDE

> ⚠️ IMPORTANT: Without .cursor/mcp.json file, Cursor integration will NOT work!

Quick Setup

1. Start HTTP server:

npm start

2. Automatic configuration setup:

npm run setup:cursor

3. Edit .cursor/mcp.json and specify your real token:

{
  "mcpServers": {
    "wikijs": {
      "transport": "http",
      "url": "http://localhost:3200/mcp",
      "events": "http://localhost:3200/mcp/events",
      "cwd": ".",
      "env": {
        "WIKIJS_BASE_URL": "http://localhost:3000",
        "WIKIJS_TOKEN": "your_real_wiki_js_token_here"
      }
    }
  }
}

Critical Parameters

- transport: "http" - mandatory HTTP transport
- url: "http://localhost:3200/mcp" - exact URL for JSON-RPC
- events: "http://localhost:3200/mcp/events" - URL for Server-Sent Events
- WIKIJS_TOKEN - real Wiki.js API token (not placeholder!)

Verification

After setup, tools with mcp_wikijs_ prefix should appear in Cursor:

- mcp_wikijs_list_pages()
- mcp_wikijs_search_pages()
- mcp_wikijs_get_page()
- And others...

VS Code (with MCP extension)

Add to VS Code settings:

{
  "mcp.servers": {
    "wikijs": {
      "command": "node",
      "args": ["mcp_wikijs_stdin.js"],
      "cwd": "/path/to/wikijs-mcp"
    }
  }
}

πŸ›  Development

Project Structure

wikijs-mcp-server/
β”œβ”€β”€ src/                    # TypeScript source code
β”‚   β”œβ”€β”€ server.ts          # HTTP server
β”‚   β”œβ”€β”€ tools.ts           # Tool definitions
β”‚   β”œβ”€β”€ api.ts             # Wiki.js API client
β”‚   β”œβ”€β”€ types.ts           # Data types
β”‚   └── schemas.ts         # Zod validation schemas
β”œβ”€β”€ scripts/               # Management scripts
β”‚   β”œβ”€β”€ setup.sh          # Initial setup
β”‚   β”œβ”€β”€ start_http.sh     # Start HTTP server
β”‚   β”œβ”€β”€ start_typescript.sh # Start TypeScript version
β”‚   β”œβ”€β”€ setup_cursor_mcp.sh # Cursor setup
β”‚   β”œβ”€β”€ test.sh           # Run tests
β”‚   β”œβ”€β”€ test_mcp.js       # Test HTTP server
β”‚   β”œβ”€β”€ test_mcp_stdin.js # Test STDIN server
β”‚   └── README.md         # Scripts documentation
β”œβ”€β”€ .cursor/               # Cursor MCP configuration
β”‚   └── mcp.json          # MCP configuration file (CRITICALLY IMPORTANT!)
β”œβ”€β”€ dist/                  # Compiled TypeScript code
β”œβ”€β”€ .js                   # Main JS files
β”œβ”€β”€ example.env            # Environment configuration example
β”œβ”€β”€ package.json           # Project metadata
└── README.md             # Main documentation

> 🚨 CRITICALLY IMPORTANT: .cursor/mcp.json file is required for Cursor integration!

Available Scripts

Setup and Build

- npm run setup - Initial project setup
- npm run build - Build TypeScript project
- npm run setup:cursor - Setup Cursor integration

Running Servers

- npm start / npm run start:http - HTTP MCP server (port 3200)
- npm run start:typescript - TypeScript version of server (port 8000)
- npm run server:stdio - STDIO version for direct integration

Development and Testing

- npm run dev - Development mode with hot reload
- npm run demo - Capability demonstration
- npm test - Run tests
- npm run client - Run demo client
- npm run http-client - Run HTTP client

API Endpoints (HTTP mode)

- GET /tools - List of available tools
- GET /health - Server health check
- POST /mcp - MCP JSON-RPC endpoint

Usage Examples

// Get list of pages
{
  "method": "list_pages",
  "params": {
    "limit": 10,
    "orderBy": "TITLE"
  }
}

// Create new page
{
"method": "create_page",
"params": {
"title": "New Page",
"content": "# Title\n\nContent...",
"path": "folder/new-page"
}
}

πŸ› Troubleshooting

Connection Issues

1. Ensure Wiki.js is running and accessible
2. Check WIKIJS_BASE_URL correctness
3. Verify API token is valid

MCP Issues

1. Check Node.js version (requires >=18.0.0)
2. Ensure all dependencies are installed
3. Check server logs for errors

πŸ“š Documentation

- Scripts Documentation - description of all management scripts
- Changelog - release and update log
- License - project usage terms

🀝 Contributing

1. Fork the repository
2. Create a feature branch (git checkout -b feature/amazing-feature)
3. Commit your changes (git commit -m 'Add amazing feature')
4. Push to the branch (git push origin feature/amazing-feature)
5. Open a Pull Request

πŸ“„ License

This project is distributed under the MIT License. See LICENSE file for details.

πŸ”— Useful Links

- Wiki.js - Official Wiki.js website
- Model Context Protocol - MCP specification
- Anthropic - MCP protocol developer
- GraphQL - Query language for APIs

⭐ Support

If this project helped you, please give it a ⭐ on GitHub!

Have questions? Create an Issue or refer to the documentation.

πŸ†• New Feature: Automatic URLs

Search Stages

Search works in 4 stages:

1. GraphQL API search - fast search through indexed content
2. Metadata search - search in titles, paths, and page descriptions
3. HTTP content search - deep search in page content via HTTP
4. Forced verification - fallback search on known pages

Usage Examples

Content Search

{
  "method": "search_pages",
  "params": {
    "query": "ZELEBOBA",
    "limit": 5
  }
}

Result:

[
  {
    "id": 103,
    "path": "test/test-page",
    "title": "Test Page",
    "description": "Test page to demonstrate Wiki.js API capabilities",
    "url": "http://localhost:8080/en/test/test-page"
  }
]

Title Search

{
  "method": "search_pages",
  "params": {
    "query": "find me",
    "limit": 3
  }
}

Result:

[
  {
    "id": 108,
    "path": "test/test-gemini-mcp",
    "title": "Test Gemini MCP Page (find me)",
    "url": "http://localhost:8080/en/test/test-gemini-mcp"
  }
]

New Search Benefits

- βœ… Finds pages even with limited API permissions - uses HTTP fallback
- βœ… Multi-level search - combines multiple strategies
- βœ… Content search - finds text inside pages
- βœ… Metadata search - titles, paths, descriptions
- βœ… Fallback methods - guaranteed results for known pages
- βœ… Correct URLs - all results contain ready-to-use links

Technical Details

HTML Content Processing

The system automatically extracts text from HTML using:

- Search in <template slot="contents"> block
- HTML tags and entities cleanup
- Fallback to full page content

With limited GraphQL API permissions, the system:

- Switches to HTTP method for content retrieval
- Uses direct requests to HTML pages
- Preserves all page metadata

No reviews yet β€” be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.