A custom Model Context Protocol adapter for MediaWiki and WikiBase APIs
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.
git clone https://github.com/yourusername/mediawikiadapter.git
cd mediawikiadapter
Install dependencies:
npm install
Build the project:
npm run build
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",
});
Run the MCP server using the following command:
node build/index.js
Fetches the content of a MediaWiki page.
{
"title": "string"
}
{
"content": "string"
}
const response = await server.callResource("getPageContent", {
title: "Main Page",
});
console.log(response.content);
Edits a MediaWiki page with new content.
{
"title": "string",
"content": "string",
"summary": "string (optional)"
}
{
"success": "boolean"
}
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");
To run the project in development mode with TypeScript:
npm run dev
Run the linter to check for code quality:
npm run lint
Currently, no tests are implemented. You can add tests to the test
directory and run them using:
npm test
The adapter uses the following default API base URLs:
You can override these defaults using the server.configure()
method.
Contributions are welcome! Please follow these steps:
This project is licensed under the LGPL-3.0-or-later license. See the LICENSE file for details.
Created by Luca Mauri.