ME

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.

Quick Install
npx -y @ProfessionalWiki/MediaWiki-MCP-Server

Overview

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:

npm install -g @professional-wiki/mediawiki-mcp-server

Start (stdio transport, default):

MCP_TRANSPORT=stdio CONFIG=./config.json mediawiki-mcp-server

Start HTTP transport on port 3000:

MCP_TRANSPORT=http PORT=3000 CONFIG=./config.json mediawiki-mcp-server

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):

{
  "defaultWiki": "en.wikipedia.org",
  "wikis": {
    "en.wikipedia.org": {
      "sitename": "Wikipedia",
      "server": "https://en.wikipedia.org",
      "articlepath": "/wiki",
      "scriptpath": "/w",
      "token": null,
      "username": null,
      "password": null,
      "private": false
    }
  }
}

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.

ToolPurposeNotes
add-wikiRegister a new wiki resource from a URLDynamically adds resources
set-wikiSelect which wiki to use for the session
remove-wikiRemove a wiki resourceTriggers resources/list_changed notification
get-pageFetch page object and content
get-revisionFetch a specific revision
get-page-historyList recent revisions
search-pageFull text/title search
search-page-by-prefixPrefix title search
get-fileFetch file metadata/object
get-category-membersList members of a category
create-page 🔐Create a new pageRequires edit permissions
update-page 🔐Edit an existing page
delete-page 🔐Delete a pageRequires 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:

{
  "resources": [
    {
      "uri": "mcp://wikis/en.wikipedia.org",
      "name": "wikis/en.wikipedia.org",
      "title": "Wikipedia",
      "description": "Wiki \"Wikipedia\" hosted at https://en.wikipedia.org"
    }
  ]
}

Example read (resource contents):

{
  "contents": [
    {
      "uri": "mcp://wikis/en.wikipedia.org",
      "mimeType": "application/json",
      "text": "{ \"sitename\":\"Wikipedia\",\"server\":\"https://en.wikipedia.org\",\"articlepath\":\"/wiki\",\"scriptpath\":\"/w\",\"private\":false }"
    }
  ]
}

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