MediaWiki MCP Server
A Model Context Protocol (MCP) server for MediaWiki instances with multi-wiki support. Uses the modern REST API (MediaWiki 1.42+) and Action API for full read/write access across multiple named wikis.
Features
- Multi-Wiki Support: Register named wikis, fan-out searches across all of them
- REST API: Uses the modern
/rest.php/v1/ endpoints for page CRUD, search, and revisions
- Bot Password Auth: Logs in via
Special:BotPasswords with per-wiki credentials
- Page Operations: Read, create, update, delete, and undelete pages
- Search: Full-text and prefix search across all registered wikis
- File Operations: Get file metadata, upload files from data or URL
- Category Browsing: List categories and their members with pagination
- History & Revisions: Access revision history, view individual revisions
- Recent Changes: Track wiki activity across all wikis
- Link Analysis: Explore outgoing links and backlinks
- Pagination: All list endpoints support continuation tokens
- Retry Logic: Exponential backoff on 429/5xx errors
Installation
Prerequisites
- Node.js 18 or higher
- MediaWiki 1.42 or higher
Local Installation
git clone https://github.com/ttpears/mediawiki-mcp.git
cd mediawiki-mcp
npm install
npm run build
Docker Installation
cp .env.example .env
# Edit .env with your wiki URLs and credentials
docker compose up -d
Authentication
This server uses MediaWiki bot passwords for API authentication. Bot passwords are scoped credentials that limit what the bot can do, separate from your real account password.
Creating a Bot Password
- Log in to your MediaWiki wiki as a user with the permissions you want the bot to have
- Navigate to Special:BotPasswords (e.g.,
https://wiki.example.com/wiki/Special:BotPasswords)
- Enter a bot name (e.g.,
mcp) and click Create
- Select the grants (permissions) the bot needs:
- High-volume (bot) access — required for API usage
- Edit existing pages — for
update-page
- Edit protected pages — if the bot needs to edit protected pages
- Create, edit, and move pages — for
create-page, update-page
- Delete pages and revisions — for
delete-page / undelete-page
- Upload, replace, and move files — for
upload-file / upload-file-from-url
- Patrol changes to pages — if using activity monitoring
- Rollback changes to pages — if using rollback features
- Click Create to generate the password
MediaWiki will display credentials in this format:
Username: Admin@mcp
Password: your-bot-password-here
You need both values. The username (Admin@mcp) goes in MEDIAWIKI_USERNAME_* and the password goes in MEDIAWIKI_PASSWORD_*. The server uses these to log in via the Action API (action=login) and maintains a cookie-based session for all subsequent requests.
Repeat for Each Wiki
If you have multiple wikis, create a bot password on each one. You'll have a username/password pair per wiki.
Configuration
Multi-Wiki Setup
Create a .env file (see .env.example):
# Register multiple wikis (Name:URL pairs, comma-separated)
MEDIAWIKI_WIKIS=Main:https://wiki.example.com,Dev:https://dev.wiki.example.com
# Default wiki when none is specified
MEDIAWIKI_DEFAULT_WIKI=Main
# Per-wiki bot password credentials (uppercase wiki name)
MEDIAWIKI_USERNAME_MAIN=Admin@mcp
MEDIAWIKI_PASSWORD_MAIN=your-bot-password-here
MEDIAWIKI_USERNAME_DEV=Admin@mcp
MEDIAWIKI_PASSWORD_DEV=your-bot-password-here
Single-Wiki Setup
MEDIAWIKI_BASE_URL=https://wiki.example.com
MEDIAWIKI_USERNAME=Admin@mcp
MEDIAWIKI_PASSWORD=your-bot-password-here
HTTP Transport
MEDIAWIKI_MCP_PORT=8009
MEDIAWIKI_MCP_HOST=0.0.0.0
Usage
Stdio Mode (Local)
npm start
HTTP Mode (Remote / Docker)
npm run start:http
Endpoint: http://localhost:8009/mcp
LibreChat Integration
1. Add wiki credentials to the LibreChat .env
Add the MEDIAWIKI_* variables to your LibreChat .env file (e.g. /srv/docker/LibreChat/.env):
# MediaWiki MCP
MEDIAWIKI_WIKIS=Main:https://wiki.example.com,Dev:https://dev.wiki.example.com
MEDIAWIKI_DEFAULT_WIKI=Main
MEDIAWIKI_USERNAME_MAIN=Admin@mcp
MEDIAWIKI_PASSWORD_MAIN=your-bot-password-here
MEDIAWIKI_USERNAME_DEV=Admin@mcp
MEDIAWIKI_PASSWORD_DEV=your-bot-password-here
2. Add to docker-compose.override.yml
services:
mediawiki-mcp:
build: /srv/docker/mediawiki-mcp
container_name: mediawiki-mcp
env_file:
- .env
environment:
- MEDIAWIKI_MCP_HOST=0.0.0.0
restart: unless-stopped
networks:
- default
This builds the container from source and starts it alongside LibreChat. No need to install Node.js on the host — Docker handles the build.
3. Configure in librechat.yaml