Skip to main content
Glama
Wiki.js MCP Server
by cmet7
README.md
# Wiki.js MCP Server

MCP server for [Wiki.js](https://js.wiki/) 2.x using its GraphQL API.

## Tools

| Tool | Description |
|---|---|
| `wikijs_healthcheck` | Check API connectivity and token validity |
| `wikijs_graphql` | Execute arbitrary GraphQL (use with trusted inputs only) |
| `wikijs_get_page_by_path` | Read a page by path and locale |
| `wikijs_get_page_by_id` | Read a page by numeric ID |
| `wikijs_create_page` | Create a new page |
| `wikijs_update_page` | Update an existing page by ID |
| `wikijs_delete_page` | Delete a page by ID |
| `wikijs_get_navigation_tree` | Full navigation tree for a locale |
| `wikijs_get_navigation_subtree` | Subtree at a path with depth limit |
| `wikijs_get_navigation_menu` | Top-level menu entries |

## Requirements

- Python 3.10+
- A Wiki.js 2.x instance
- A Wiki.js API token (created in Admin > API Access)

## Install

```bash
git clone https://github.com/cmet7/mcp-wikijs.git
cd mcp-wikijs
python3 -m venv .venv
source .venv/bin/activate
pip install -e .
```

## Configuration

Copy `.env.example` to `.env` and fill in your values:

```bash
cp .env.example .env
```

| Variable | Required | Default | Description |
|---|---|---|---|
| `WIKIJS_URL` | Yes | — | Wiki.js base URL (e.g. `https://wiki.example.com`) |
| `WIKIJS_API_TOKEN` | Yes | — | API token from Wiki.js Admin > API Access |
| `WIKIJS_TIMEOUT_SECONDS` | No | `20` | HTTP request timeout |
| `WIKIJS_VERIFY_TLS` | No | `true` | Set to `false` for self-signed certs |

## Usage

### Run directly

```bash
export WIKIJS_URL="https://wiki.example.com"
export WIKIJS_API_TOKEN="your_token"
wikijs-mcp-server
```

### Claude Code

```bash
claude mcp add wikijs -s user \
  -e WIKIJS_URL=https://wiki.example.com \
  -e WIKIJS_API_TOKEN=your_token \
  -- wikijs-mcp-server
```

Or add to your MCP client config:

```json
{
  "mcpServers": {
    "wikijs": {
      "command": "/path/to/venv/bin/wikijs-mcp-server",
      "env": {
        "WIKIJS_URL": "https://wiki.example.com",
        "WIKIJS_API_TOKEN": "your_token"
      }
    }
  }
}
```

## Tests

```bash
python3 -m unittest discover -s tests -p 'test_*.py' -q
```

Tests are fully offline and require no running Wiki.js instance.

## Security notes

- Use least-privilege Wiki.js API tokens.
- Do not expose `WIKIJS_API_TOKEN` in logs or version control.
- Prefer `wikijs_get_*` tools for normal reads; reserve `wikijs_graphql` for advanced/admin operations.
- Navigation tools derive structure from page paths. For custom UI menus not reflected by page paths, use `wikijs_graphql`.

## License

MIT