wikijs-mcp

wikijs-mcp

An MCP server for interacting with Wiki.js via GraphQL API, enabling page management (CRUD, search, publish), user and group management, and blogging workflow with drafts.

Category
访问服务器

README

wikijs-mcp

This project is an English fork/adaptation of https://github.com/talosdeus/wiki-js-mcp. Original project licensed under the MIT License.

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 by ID
  • List pages with sorting options
  • Search pages by query
  • Create new pages
  • Update existing pages
  • Delete pages
  • 🆕 List all pages including unpublished
  • 🆕 Search unpublished pages
  • 🆕 Force delete pages (including unpublished)
  • 🆕 Get page publication status
  • 🆕 Publish unpublished pages

👥 User Management

  • List users
  • Search users by query
  • Create new users
  • Update user information

🔧 Group Management

  • List user groups

✍️ Blogging Tools

  • Fetch versioned blog-writing prompts from Wiki.js
  • Create unpublished blog drafts under a dedicated drafts path
  • Generate draft slugs automatically from titles
  • Support custom draft descriptions and tags

🌐 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
  1. Run automatic setup:
npm run setup

This script will automatically:

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

Configuration

  1. 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

# Optional blog workflow paths
WIKIJS_BLOG_PROMPT_PATH=blogs/_prompt/versions
WIKIJS_BLOG_DRAFTS_PATH=blogs/drafts
  1. 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)

# Start main HTTP server with Cursor MCP support
npm start
# or
npm run start:http

# Stop server
npm run stop

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
  1. Automatic configuration setup:
npm run setup:cursor
  1. 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": ["lib/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
│   └── README.md          # Source code documentation
├── lib/                   # JavaScript library files
│   ├── fixed_mcp_http_server.js    # Main HTTP server (compiled)
│   ├── mcp_wikijs_stdin.js         # STDIN server for editors
│   ├── mcp_client.js               # Demo MCP client
│   ├── mcp_wrapper.js              # MCP protocol utilities
│   └── README.md                   # Library documentation
├── scripts/               # Management scripts
│   ├── setup.sh          # Initial setup
│   ├── start_http.sh     # Start HTTP server
│   ├── stop_server.sh    # Stop 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
├── 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 stop - Stop all MCP servers
  • 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

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"
  }
}

### Search for pages:
```python
# Search in all content and metadata
result = await mcp_client.call_tool("search_pages", {
    "query": "magic system",
    "limit": 5
})

Working with Unpublished Pages:

# Get all pages including unpublished ones
all_pages = await mcp_client.call_tool("list_all_pages", {
    "limit": 100,
    "includeUnpublished": True
})

# Search only unpublished pages
unpublished = await mcp_client.call_tool("search_unpublished_pages", {
    "query": "draft",
    "limit": 10
})

# Check page publication status
status = await mcp_client.call_tool("get_page_status", {
    "id": 42
})

# Publish an unpublished page
result = await mcp_client.call_tool("publish_page", {
    "id": 42
})

# Force delete page (works with unpublished pages)
result = await mcp_client.call_tool("force_delete_page", {
    "id": 42
})

Blogging workflow:

# List available blog prompt versions
versions = await mcp_client.call_tool("get_blog_prompt", {})

# Fetch a specific prompt template
prompt = await mcp_client.call_tool("get_blog_prompt", {
    "version": "v1"
})

# After writing content from the prompt guidance, save it as an unpublished draft
draft = await mcp_client.call_tool("create_blog_draft", {
    "title": "Building Better Wiki.js Documentation",
    "content": "# Building Better Wiki.js Documentation\n\nDraft content...",
    "slug": "building-better-wikijs-documentation",
    "description": "A draft post about improving Wiki.js documentation workflows.",
    "tags": ["blog", "draft", "wikijs"]
})

User management:

# List all users
users = await mcp_client.call_tool("list_users")

# Search users by query
search_result = await mcp_client.call_tool("search_users", {
    "query": "John"
})

# Create new user
new_user = await mcp_client.call_tool("create_user", {
    "email": "john@example.com",
    "name": "John Doe",
    "passwordRaw": "password123",
    "providerKey": "local",
    "groups": [1],
    "mustChangePassword": false,
    "sendWelcomeEmail": true
})

# Update user information
updated_user = await mcp_client.call_tool("update_user", {
    "id": 1,
    "name": "John Doe Updated"
})

🐛 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

🤝 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

⭐ 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

📝 Changelog

Version 1.3.0 - Unpublished Pages Management (Latest)

🆕 New Features:

  • list_all_pages - Get all pages including unpublished ones
  • search_unpublished_pages - Search specifically in unpublished pages
  • force_delete_page - Enhanced deletion that works with unpublished pages
  • get_page_status - Check publication status of any page
  • publish_page - Publish unpublished pages programmatically
  • get_blog_prompt - Fetch versioned blog-writing prompts from Wiki.js
  • create_blog_draft - Create unpublished blog drafts for review

🔧 Improvements:

  • Enhanced server API with new routes for unpublished page management
  • Better error handling for page deletion operations
  • Comprehensive GraphQL mutation support for advanced page operations
  • Restructured project: Moved JavaScript files to lib/ directory for better organization
  • Blog workflow paths can be configured with WIKIJS_BLOG_PROMPT_PATH and WIKIJS_BLOG_DRAFTS_PATH

🐛 Bug Fixes:

  • Fixed issues with accessing unpublished pages through standard APIs
  • Improved authentication handling for admin-level operations

Version 1.2.0 - International Release

🌍 Internationalization:

  • Complete English translation of documentation
  • README.md and QUICK_START.md now available in English
  • Prepared for international market expansion

Version 1.1.0 - Enhanced Search & User Management

✨ Features:

  • Smart multi-method page search (GraphQL + content + metadata)
  • User management tools (create, update, search)
  • Group management capabilities
  • Improved content extraction from HTML pages

🛠️ Available Tools

📄 Page Tools

Tool Name Description Parameters
get_page Get page information by ID id: number
get_page_content Get page content by ID id: number
list_pages List pages with sorting limit?: number, orderBy?: string
search_pages Search pages by query query: string, limit?: number
create_page Create new page title: string, content: string, path: string, description?: string, tags?: string[]
update_page Update existing page id: number, content: string
delete_page Delete page id: number
list_all_pages 🆕 List all pages including unpublished limit?: number, orderBy?: string, includeUnpublished?: boolean
search_unpublished_pages 🆕 Search only unpublished pages query: string, limit?: number
force_delete_page 🆕 Force delete page (works with unpublished) id: number
get_page_status 🆕 Get page publication status id: number
publish_page 🆕 Publish unpublished page id: number

✍️ Blogging Tools

Tool Name Description Parameters
get_blog_prompt Fetch a blog prompt version or list versions version?: string
create_blog_draft Create an unpublished blog draft under drafts title: string, content: string, slug?: string, description?: string, tags?: string[]

👥 User Tools

Tool Name Description Parameters
list_users List all users None
search_users Search users by query query: string
create_user Create new user email: string, name: string, passwordRaw: string, providerKey?: string, groups?: number[], mustChangePassword?: boolean, sendWelcomeEmail?: boolean
update_user Update user information id: number, name: string

🔗 Group Tools

Tool Name Description Parameters
list_groups List user groups None

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选