Fetch and edit MediaWiki pages programmatically via MCP
Minimal MCP adapter for reading and editing MediaWiki or WikiBase pages, defaulting to Wikipedia and Wikidata's APIs.
1.0.0Add to Favorites
Why it matters
Enable programmatic access to MediaWiki and WikiBase instances so AI agents can read wiki page content and make edits through a standardized MCP interface.
Outcomes
What it gets done
Fetch the full content of any MediaWiki page by title
Edit MediaWiki pages with new content and optional edit summaries
Configure custom API endpoints for different MediaWiki instances
Connect to Wikipedia, Wikidata, or private wiki installations
Source
Get it from source
Spark does not host a copy of it.
Open sourceReports
Agent outcome reports
No reports yet
Overview
MediaWiki MCP adapter
A minimal MCP adapter exposing two operations against a MediaWiki or WikiBase API: getPageContent, which fetches a page's text by title, and editPage, which writes new content and an optional summary to a page. It defaults to Wikipedia and Wikidata's APIs but both endpoints are configurable. Use it when an assistant needs a direct, minimal way to read or edit a specific MediaWiki or WikiBase page. It has no search, history, or file-upload support - only fetch and edit.
What it does
MediaWikiAdapter is an MCP adapter for reading and editing MediaWiki (and WikiBase) pages programmatically. It exposes a resource for fetching a page's content and a tool for editing a page with new content and an optional edit summary, against a MediaWiki API endpoint you configure.
When to use - and when NOT to
Use it when an assistant needs to read the current text of a MediaWiki page or push an edit to one, against Wikipedia, Wikidata, or a self-hosted MediaWiki/WikiBase instance with API access enabled. It covers exactly two operations - fetch and edit - with no support for search, revision history, category listings, file uploads, or any of the richer wiki operations found in more full-featured MediaWiki MCP servers; if those are needed, this adapter is not sufficient on its own. Because it targets both a MediaWiki API and a separate WikiBase API base, it is also a fit when a workflow needs to touch both a wiki's prose pages and its linked WikiBase item data through the same adapter, as long as both endpoints are reachable and API access is enabled on each. It is not the right choice for anything beyond simple fetch-and-edit, since the project itself frames it as a lighter-weight alternative to fuller MediaWiki MCP servers rather than a replacement for them.
Capabilities
The getPageContent resource takes a title string and returns the page's content as a string. The editPage tool takes a title, the new content, and an optional summary, returning a success boolean. Both operate against a configurable MediaWiki API base and a separate WikiBase API base, set via server.configure({ mediaWikiAPIBase, wikiBaseAPIBase }); without configuration, they default to https://en.wikipedia.org/w/api.php and https://www.wikidata.org/w/api.php.
How to install
It is built from source rather than published as a package:
git clone https://github.com/yourusername/mediawikiadapter.git
cd mediawikiadapter
npm install
npm run build
The server is then started directly:
node build/index.js
Node.js v16 or later is required, and TypeScript for development. For active development, npm run dev runs the project directly in TypeScript, and npm run lint checks code quality. A test directory exists for adding tests, but the project ships with none implemented yet - anyone relying on it in production should plan to add coverage for getPageContent and editPage themselves.
Who it's for
Developers building a minimal, direct integration to read or edit a specific MediaWiki or WikiBase page - Wikipedia, Wikidata, or a self-hosted wiki - without the overhead of a full-featured MediaWiki MCP server. Released under the LGPL-3.0-or-later license.
Source README
MediaWikiAdapter
A custom Model Context Protocol (MCP) adapter for interacting with MediaWiki and WikiBase APIs. This adapter allows you to fetch and edit MediaWiki pages programmatically using the MCP framework.
Features
- Fetch the content of a MediaWiki page.
- Edit a MediaWiki page with new content and an optional summary.
- Configurable API base URLs for different MediaWiki and WikiBase instances.
Requirements
- Node.js (v16 or later)
- TypeScript (for development)
- MediaWiki instance with API access enabled
Installation
- Clone the repository:
git clone https://github.com/yourusername/mediawikiadapter.git
cd mediawikiadapter
Install dependencies:
npm installBuild the project:
npm run build
Usage
Configure the Adapter
You can configure the adapter to use custom MediaWiki and WikiBase API endpoints:
server.configure({
mediaWikiAPIBase: "https://my.mediawiki.instance/api.php",
wikiBaseAPIBase: "https://my.wikibase.instance/api.php",
});
Start the MCP Server
Run the MCP server using the following command:
node build/index.js
Resources
getPageContent
Fetches the content of a MediaWiki page.
- Input Schema:
{
"title": "string"
}
- Output Schema:
{ "content": "string" }
Example Usage:
const response = await server.callResource("getPageContent", {
title: "Main Page",
});
console.log(response.content);
Tools
editPage
Edits a MediaWiki page with new content.
- Input Schema:
{
"title": "string",
"content": "string",
"summary": "string (optional)"
}
- Output Schema:
{
"success": "boolean"
}
Example Usage:
const response = await server.callTool("editPage", {
title: "Main Page",
content: "Updated content for the page.",
summary: "Updated via MediaWikiAdapter",
});
console.log(response.success ? "Edit successful" : "Edit failed");
Development
Run in Development Mode
To run the project in development mode with TypeScript:
npm run dev
Linting
Run the linter to check for code quality:
npm run lint
Testing
Currently, no tests are implemented. You can add tests to the test directory and run them using:
npm test
Configuration
The adapter uses the following default API base URLs:
- MediaWiki API Base: https://en.wikipedia.org/w/api.php
- WikiBase API Base: https://www.wikidata.org/w/api.php
You can override these defaults using the server.configure() method.
Author
Created by Luca Mauri.
FAQ
Common questions
Discussion
Questions & comments · 0
Sign In Sign in to leave a comment.