MC

MCP Server Adapter for MediaWiki and WikiBase

Integrate MediaWiki and WikiBase with an MCP server adapter to programmatically fetch and edit pages via the Model Context Protocol.

Quick Install
npx -y @lucamauri/MediaWiki-MCP-adapter

Overview

This MCP (Model Context Protocol) server adapter exposes MediaWiki and WikiBase APIs as MCP resources and tools so external agents and models can programmatically fetch and read page content or perform edits. The adapter acts as a thin bridge between an MCP-compatible server and any MediaWiki/WikiBase instance by wrapping common API operations (fetch page content, submit edits) into well-defined resource/tool calls.

For developers building automation, integrations, or agent workflows, the adapter simplifies interactions with MediaWiki sites: you can call a resource to retrieve page text or call a tool to push changes, without manually handling HTTP details each time. The adapter is configurable to target different MediaWiki or Wikibase API endpoints and integrates into MCP servers used by language models or other automation frameworks.

Features

  • Fetch the wikitext or HTML content of a MediaWiki page.
  • Submit edits to a page with an optional edit summary.
  • Configurable MediaWiki and WikiBase API base URLs to support custom instances.
  • Designed to be used inside an MCP server: resources and tools are callable from MCP-capable clients.
  • Development-friendly: TypeScript-based codebase, build and dev scripts included.

Requirements

  • Node.js v16 or later
  • TypeScript (for development)
  • Access to a MediaWiki/WikiBase instance with API access (and credentials if you plan to edit)

Installation / Configuration

Clone, install, and build the adapter:

git clone https://github.com/lucamauri/MediaWiki-MCP-adapter.git
cd MediaWiki-MCP-adapter
npm install
npm run build

Start the built MCP server:

node build/index.js

Run in development mode (TypeScript watch):

npm run dev

Configure API endpoints at runtime via the adapter server instance. Example configuration:

// Example: configure the MCP adapter to point to custom endpoints
server.configure({
  mediaWikiAPIBase: "https://my.mediawiki.instance/w/api.php",
  wikiBaseAPIBase:  "https://my.wikibase.instance/w/api.php",
});

Notes on authentication:

  • Reads typically work with public wiki APIs.
  • Edits require authenticated requests (login session, bot account, OAuth, or API tokens).
  • The adapter does not invent authentication; you should supply credentials/session handling as required by your MediaWiki instance (cookies, token retrieval, or OAuth workflows). The adapter expects the runtime to manage or provide tokens when invoking edit tools.

Available Resources and Tools

The adapter exposes a small set of MCP endpoints. Use your MCP server’s call pattern to interact with them (examples use server.callResource and server.callTool).

Resources

NamePurposeInputOutput
getPageContentFetch page content (wikitext){ “title”: “string” }{ “content”: “string” }

Tools

NamePurposeInputOutput
editPageSubmit an edit to a page{ “title”: “string”, “content”: “string”, “summary”?: “string” }{ “success”: boolean, “message”?: string }

Example: fetching a page

const response = await server.callResource("getPageContent", {
  title: "Main Page",
});
console.log(response.content);

Example: editing a page

const result = await server.callTool("editPage", {
  title: "Main Page",
  content: "Updated content for the page.",
  summary: "Updated via MediaWiki MCP adapter",
});
console.log(result.success ? "Edit successful" : `Edit failed: ${result.message}`);

Use Cases

  • Automating content updates: programmatically apply routine corrections, template updates, or boilerplate changes across pages by calling editPage from agent workflows.
  • Content ingestion for LLMs: retrieve page wikitext via getPageContent to feed into a summarization or analysis pipeline.
  • Monitoring and remediation bots: fetch page content, run checks (linting, policy validation), and post fixes as edits when needed.
  • Wikibase automation: configure the adapter to point at a Wikibase API endpoint to support scripted data edits or property updates (requires additional handling for entity editing tokens).

Concrete example: fetch, modify, and push an edit

// 1) Get current content
const cur = await server.callResource("getPageContent", { title: "Sandbox" });

// 2) Modify content locally (example: append a notice)
const newContent = cur.content + "\n\n== Note ==\nAutomated update";

// 3) Push edit with summary
const editResp = await server.callTool("editPage", {
  title: "Sandbox",
  content: newContent,
  summary: "Appended automated note",
});
if (!editResp.success) {
  console.error("Edit failed:", editResp.message);
}

Development & Contributing

  • Lint: npm run lint
  • Tests: add tests under the test directory and run npm test (no tests included by default)
  • Contribute via fork + pull request; follow project coding standards and include details in PR descriptions.

Default API endpoints used by the adapter (override with server.configure):

APIDefault base URL
MediaWikihttps://en.wikipedia.org/w/api.php
WikiBasehttps://www.wikidata.org/w/api.php

Repository and license:

  • Source: https://github.com/lucamauri/MediaWiki-MCP-adapter
  • License: LGPL-3.0-or-later

This adapter is intended to be a small, configurable bridge between MCP-based automation and MediaWiki/WikiBase instances; it focuses on fetching and editing pages while leaving authentication and advanced API interactions to your application layer.

Tags:media