MediaWiki MCP Server for LLM Integration
Enable LLM clients to interact with any MediaWiki wiki using an MCP server for seamless model-to-wiki integration.
npx -y @ProfessionalWiki/MediaWiki-MCP-ServerOverview
This MCP (Model Context Protocol) server exposes MediaWiki sites as MCP resources so LLM clients and agent frameworks can read, search, and modify wiki content programmatically. It acts as a bridge between model-driven agents and one or more MediaWiki wikis, providing a consistent set of tools (MCP “tools”) for browsing pages, retrieving revisions and files, searching, and performing authenticated edits or uploads when credentials are supplied.
Use this server to let an LLM agent safely explore wiki content, propose edits, create or undelete pages, and upload files — all using the MCP standard for model tooling. The server supports both stateless (public wiki reads) and authenticated operations (edits/uploads) via OAuth2 tokens or bot credentials.
Features
- Exposes any MediaWiki instance as an MCP resource (mcp://wikis/{wikiKey}).
- Read and search wiki pages, fetch revisions and files, list category members.
- Authenticated tools for create/edit/delete/undelete and file uploads.
- Adds and removes wiki resources at runtime; clients receive resource-list notifications.
- Config-driven: local config.json with environment variable substitution for secrets.
- Two transport modes: stdio (for direct agent integration) and HTTP (StreamableHTTP).
- Minimal setup required for public wikis; authentication only needed for privileged operations.
Installation / Configuration
Install the MCP server from NPM and run it with a configuration file.
Install:
Start (stdio transport, default):
MCP_TRANSPORT=stdio CONFIG=./config.json
Start HTTP transport on port 3000:
MCP_TRANSPORT=http PORT=3000 CONFIG=./config.json
Environment variables:
- CONFIG — path to config file (default: config.json)
- MCP_TRANSPORT — “stdio” or “http” (default: stdio)
- PORT — port for HTTP transport (default: 3000)
Basic config example (config.json):
Environment variable substitution:
"token": "${WIKI_OAUTH_TOKEN}",
"username": "${WIKI_USERNAME}",
"password": "${WIKI_PASSWORD}"
If an environment variable is unset, the substitution remains as-is.
Authentication:
- Preferred: OAuth2 access token (requires OAuth extension on the wiki).
- Fallback: Bot username/password (Special:BotPasswords). Tools that mutate state (create/update/delete/upload) require authentication.
Available Tools
Key tools exposed to MCP clients. Tools marked with 🔐 require authentication.
| Tool | Purpose | Notes |
|---|---|---|
| add-wiki | Register a new wiki resource from a URL | Dynamically adds resources |
| set-wiki | Select which wiki to use for the session | |
| remove-wiki | Remove a wiki resource | Triggers resources/list_changed notification |
| get-page | Fetch page object and content | |
| get-revision | Fetch a specific revision | |
| get-page-history | List recent revisions | |
| search-page | Full text/title search | |
| search-page-by-prefix | Prefix title search | |
| get-file | Fetch file metadata/object | |
| get-category-members | List members of a category | |
| create-page 🔐 | Create a new page | Requires edit permissions |
| update-page 🔐 | Edit an existing page | |
| delete-page 🔐 | Delete a page | Requires delete permissions |
| undelete-page 🔐 | Undelete a page | |
| upload-file 🔐 | Upload from local disk | |
| upload-file-from-url 🔐 | Upload from a web URL |
Tools follow MCP conventions for inputs/outputs and permission enforcement.
Available Resources
Wikis are published as MCP resources at URIs like: mcp://wikis/en.wikipedia.org
Resource reads return non-sensitive metadata only. Credentials such as tokens, usernames, or passwords are not exposed in resource contents.
Example list response:
Example read (resource contents):
After add-wiki or remove-wiki, the server emits notifications/resources/list_changed to prompt clients to refresh available resources.
Use Cases
- LLM-driven documentation assistant: let an agent search wiki pages, draft edits, and submit changes using authenticated update tools.
- Research agent: enable a model to search multiple wikis, fetch page histories and revisions to trace content provenance.
- Content ingestion pipeline: upload files or media programmatically from a crawler or agent and create corresponding pages.
- Private wiki automation: use config.json with secure environment variable substitution to allow an LLM assistant to manage an internal documentation wiki without exposing credentials.
Tips for Developers
- Start with public wiki reads (no auth) to validate agent workflows, then add authenticated credentials for editing.
- Use the HTTP transport for remote or containerized deployments; use stdio for direct integration with agents that speak MCP over pipes.
- Keep secrets out of source control — prefer environment variables in config values.
- Review MediaWiki permissions and OAuth scopes when enabling edit/upload tools.
Repository and source: https://github.com/ProfessionalWiki/MediaWiki-MCP-Server