
dokuwiki mcp
一个用于与 Dokuwiki API 交互的 MCP 服务器,支持语义相似性匹配和传统搜索。
Repository Info
About This Server
一个用于与 Dokuwiki API 交互的 MCP 服务器,支持语义相似性匹配和传统搜索。
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
Dokuwiki MCP Server
An MCP server for interacting with Dokuwiki API, allowing LLMs to find and retrieve content from Dokuwiki pages. The server provides AI-powered semantic similarity matching as the preferred method for finding relevant content, with traditional search as a fallback option.
Requirements
- Node.js 16 or higher
- A DokuWiki instance with:
- JSON-RPC API enabled
- Core search functionality
- AI Chat plugin for similar pages functionality (strongly recommended for optimal results)
Setup
-
Install dependencies:
npm install -
Configure API access:
export DOKUWIKI_API_URL="https://your-dokuwiki-instance/lib/exe/jsonrpc.php" export DOKUWIKI_API_TOKEN="your-api-token"Alternatively, edit the
src/config.tsfile directly.The configuration includes:
baseUrl: The URL to your DokuWiki JSON-RPC API endpointtoken: Your API authentication token (if required)endpoints: The API methods to call for each function:searchPages: "/core.searchPages"getPage: "/core.getPage"similar: "/plugin.aichat.similar" (requires the AI Chat plugin)
-
Build the project:
npm run build -
Run the server:
npm start
Available Tools
getSimilarDokuwikiPages (Preferred)
Find pages in Dokuwiki that are semantically similar to a given query. This tool uses AI-powered similarity matching and should be your first choice when looking for relevant content.
Parameters:
query: Query to find similar Dokuwiki pages for (string)
Returns:
- A formatted list of similar pages with titles and IDs
searchDokuwikiPages (Fallback)
Search for pages in Dokuwiki based on a query string. Use this tool only when getSimilarDokuwikiPages returns no results or when you need to search for specific terms rather than concepts.
Parameters:
query: Search query for Dokuwiki pages (string)
Returns:
- A formatted list of matching pages with titles, IDs, and snippets showing where the search terms were found
getDokuwikiPage
Retrieve the content of a specific Dokuwiki page.
Parameters:
pageId: ID of the Dokuwiki page to retrieve in a format like 'namespace:page_name' (string)
Returns:
- The full content of the requested page with a title derived from the page ID
Using with MCP Inspector
To test with the MCP Inspector, run:
npx @modelcontextprotocol/inspector node dist/index.js
Data Models
The server uses the following data models for interacting with the DokuWiki API:
Search Results
interface DokuwikiSearchResult {
score: number; // The number of hits this result got
snippet: string; // The HTML formatted snippet showing where the search term was found
id: string; // The page ID
revision: number; // The page revision aka last modified timestamp
size: number; // The page size in bytes
title: string; // The page title
permission: number; // The current user's permissions for this page
}
Page Content
interface DokuwikiPageContent {
text: string; // The page content
}
Page Information
interface DokuwikiPageInfo {
id: string; // The page ID
revision: number; // The page revision aka last modified timestamp
size: number; // The page size in bytes
title: string; // The page title
permission: number; // The current user's permissions for this page
hash?: string; // MD5 sum over the page's content (if available)
author?: string; // The author of this page revision (if available)
}
Similar Pages
interface DokuwikiSimilarResult {
page: string; // The page path or namespace:name format
title: string; // The human-readable title of the page
score: number; // Similarity score indicating relevance (higher is more relevant)
lang: string; // Language code of the page content
}
Response Format
All API responses follow this standard format:
interface DokuwikiApiResponse<T> {
result: T; // The result data, type varies by endpoint
error: {
code: number; // Error code (0 indicates success)
message: string; // Error message or "Success" when successful
};
}
Usage with LLM Integrations
This server implements the Model Context Protocol (MCP) and can be used with any LLM application that supports MCP.
Example:
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
const transport = new StdioClientTransport({
command: "node",
args: ["dist/index.js"]
});
const client = new Client({ name: "example-client", version: "1.0.0" });
await client.connect(transport);
// Example 1: Find similar pages (preferred approach)
const similarResult = await client.callTool({
name: "getSimilarDokuwikiPages",
arguments: {
query: "example topic"
}
});
console.log("Similar pages:", similarResult.content[0].text);
// Example 2: Fallback to search if no similar pages found
if (similarResult.content[0].text.includes("No similar pages found")) {
const searchResult = await client.callTool({
name: "searchDokuwikiPages",
arguments: {
query: "example topic"
}
});
console.log("Search results:", searchResult.content[0].text);
}
// Example 3: Get a specific page
const pageResult = await client.callTool({
name: "getDokuwikiPage",
arguments: {
pageId: "namespace:page_name"
}
});
console.log("Page content:", pageResult.content[0].text);
Quick Start
Clone the repository
git clone https://github.com/macin/dokuwiki-mcpInstall dependencies
cd dokuwiki-mcp
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.