Wiki.js

Overview

Wiki.js has an optional (off by default) built-in Model Context Protocol (MCP) server. With it, AI assistants such as Claude Code, Claude Desktop, VS Code, Cursor, and the claude.ai and ChatGPT connectors can search and read (and optionally write and contribute to) your wiki.

These assistants using the MCP endpoint always act on behalf of a user by using Personal Access Tokens (PATs). They can only perform actions the user is allowed to perform. The user can further limit access by selecting specific access scopes.

Capabilities

Answering from the wiki

The main use is letting an assistant answer questions from your documentation instead of from its own memory or from the web. For example:

To answer, an assistant can:

Every answer can be cited. Each page in a result carries its URL, title, locale, last-updated date and version, so the assistant can link you to its source. Because the last updated date is always included, the assistant can tell you when the information it relies on is old.

Contributing to the wiki

An assistant can write new / updated knowledge back:

An assistant's contribution is an ordinary page edit. It lives in the same tree, under the same page rules and in the same history as any other edit. It shows up in search and recent changes, it notifies the page's watchers, and it is mirrored to storage targets. Nothing an assistant writes is hidden, and anything it writes can be reviewed and reverted.

Note

  • Every write needs a reason. This applies even on sites where a reason for change is normally optional. The reason appears in the page history, and it becomes the commit message on a Git storage target.
  • Every write is marked as made through MCP. The version shows an AI badge next to the author's name in the page history, and on the page itself while the latest version is the assistant's version. The author is still the person who owns the token, because they are accountable for it. The badge tells readers which edits that person typed and which an assistant made for them. This badge can be hidden in the Administration Area.
  • Writes are checked against the version the assistant read. If someone saved the page in the meantime, the edit is refused and the assistant is shown the current version, so it never overwrites a change it didn't see.
  • An edit is refused while someone has the page open in the editor to prevent an assistant overwriting an active editing session. The assistant is told to suggest the edit or try again later.
  • Broken links are reported. After a write, the assistant is told about any links in the new content that don't lead to a page, so it can fix them in the same task.

What it does not do

Getting Connected

Requirements

Create a token

  1. Go to the Profile Personal Access Tokens page.
  2. Open the Connect an AI Assistant tab.
  3. Click the Create a Token for an Assistant button. This opens a dialog with read-only defaults preselected.

    Note

    Any scope you select will be limited by the AI Assistants (MCP) scope. For example, to allow an assistant to write to pages, you must allow Read & Write on BOTH the Pages and AI Assistants (MCP) scopes.

  4. Give it a name (e.g. "Claude Code Read-Only"), select an expiry and create the token.
  5. Copy the token or use the provided commands/settings for your AI / IDE client.

    Important

    The token will NOT be shown again. Make sure to copy it before closing the dialog.

Configure your client

The server URL is the wiki's own address followed by /_mcp, for example https://wiki.example.com/_mcp. Each site answers on its own hostname and an assistant connected to one site sees only that site.

Claude Code

claude mcp add --transport http wiki https://wiki.example.com/_mcp --header "Authorization: Bearer YOUR-TOKEN"

VS Code, in .vscode/mcp.json:

{
  "servers": {
    "wiki": {
      "type": "http",
      "url": "https://wiki.example.com/_mcp",
      "headers": { "Authorization": "Bearer YOUR-TOKEN" }
    }
  }
}

Cursor, in ~/.cursor/mcp.json:

{
  "mcpServers": {
    "wiki": {
      "url": "https://wiki.example.com/_mcp",
      "headers": { "Authorization": "Bearer YOUR-TOKEN" }
    }
  }
}

Some remote connectors, such as claude.ai and ChatGPT can't be given a token. Add the server URL as a custom connector and sign in when the connector asks. See Signing in with OAuth below.

Signing in with OAuth

The remote connectors in claude.ai and ChatGPT use OAuth 2.1 to sign in. There's nothing to set up on the wiki for this:

  1. Add https://wiki.example.com/_mcp (replacing wiki.example.com with your wiki's hostname) as a custom connector in the client.
  2. The client registers itself with the wiki and sends your browser to the wiki's consent screen. If you aren't signed in, you'll be prompted to sign in first.
  3. The consent screen names the client, the address it will send you back to, and the account it will act as. It shows the scope grid, starting from what the client asked for, or from the read-only defaults if it asked for nothing. You can change any row before approving and you choose how long the grant lasts.
  4. Approve and the connector is connected.

An OAuth grant behaves like a personal access token but with two differences: it works only on the MCP server and is refused on the REST API, and the tokens it issues last an hour and are refreshed automatically. Grants are listed under the Profile Personal Access Tokens page with the client's name, marked connected through OAuth. Deleting one disconnects that client.

OAuth is available only while MCP, the API and Personal Access Tokens are all enabled.

Disconnecting

Delete the token (or the OAuth connection) under the Profile Personal Access Tokens page. It stops working immediately. An administrator can also delete a user's tokens from the user editor.

Administration

MCP is configured under the Administration Area MCP page.

Tip

The sidebar light next to it shows whether the server is on. It turns amber when MCP is on but the API is off.

MCP is one setting for the whole instance. There is no per-site switch. Which sites and pages an assistant sees is decided by page rules, like everything else. The only per-site setting is the guidelines page.

Most settings on this screen need manage:system. The guidelines page needs manage:sites. Changes apply on the next call, on every instance, with no restart required.

Enable / Disable

The button in the header turns the MCP server on or off for everybody. It is off by default. While it is off, /_mcp refuses every request and OAuth isn't offered.

Prerequisites

The following prerequisites must be met before MCP can be enabled:

Tools

There is one switch per tool group, each labelled with the scopes its tools need. A group that is off is offered to no one, regardless of a token scopes.

Guidance

The Guidelines Page is a page on your wiki site, in its primary locale, whose text is given to every assistant that connects. Use it for the site's own conventions: where new pages go, how they are named, which sections are reference and which are history, and the house style. Example: meta/assistant-guidelines.

Tip

  • It is an ordinary page, so people and assistants can improve it like any other.
  • Up to 6,000 characters are included. An assistant receives the page only if its token's owner can read it.
  • Leave it empty for none. Assistants then get only the generic guidance.

Troubleshooting

Symptom Likely cause
The client can't connect; /_mcp answers 404 or HTML The URL is wrong. It must be the wiki's own address plus /_mcp, on the hostname of the site you want.
Every call is refused MCP is disabled, the API is off, or personal access tokens are off. See Prerequisites.
401 Unauthorized The token is missing, mistyped, expired or deleted.
403, mentioning use:mcp The token's owner isn't in a group that holds use:mcp.
403, mentioning the mcp scope The token was created without the AI Assistants (MCP) scope. Scopes can't be changed, so create a new token.
403 with a system API key System keys aren't accepted. Use a personal access token.
The assistant can't see any write tools The token has MCP Read, it lacks the category's Write scope, or the tool group is switched off.
create_page / update_page say they are unavailable The Puppeteer extension isn't installed. Use suggest_edit, or install the extension.
An edit is refused because the page is open Someone has the page open in the editor. Try again later, or suggest the edit.
A new page is blank for a few seconds It is waiting for the background renderer, and appears in search once it has been rendered.
429 Too Many Requests The rate limit was reached. The client retries after the Retry-After delay. An administrator can raise Burst and Refill Rate.
The glossary or comment tools are missing The site has the glossary turned off, or comments are off or use a third-party provider.
A page the user can see in the browser isn't found Check the token's scopes, and whether the page is a draft, password-protected or in another locale. Search covers every locale unless the assistant asks for specific ones.