by lucamauri
A custom Model Context Protocol (MCP) adapter for interacting with MediaWiki and WikiBase APIs, enabling programmatic fetching and editing of MediaWiki pages.
MediaWiki-MCP-adapter is a custom Model Context Protocol (MCP) adapter designed to facilitate programmatic interaction with MediaWiki and WikiBase APIs. It allows users to fetch and edit MediaWiki pages using the MCP framework.
To use MediaWiki-MCP-adapter, you first need to install it by cloning the repository, installing dependencies via npm install
, and building the project with npm run build
. You can then configure the adapter with custom MediaWiki and WikiBase API endpoints using server.configure()
and start the MCP server using node build/index.js
.
const response = await server.callResource("getPageContent", {
title: "Main Page",
});
console.log(response.content);
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");
Q: What are the requirements to run MediaWiki-MCP-adapter? A: You need Node.js (v16 or later), TypeScript (for development), and a MediaWiki instance with API access enabled.
Q: Can I customize the MediaWiki and WikiBase API endpoints? A: Yes, you can configure the adapter to use custom API base URLs for both MediaWiki and WikiBase.
Q: Are there any tests included with the project?
A: Currently, no tests are implemented, but you can add them to the test
directory and run them using npm test
.
Q: What license is MediaWiki-MCP-adapter released under? A: The project is licensed under the LGPL-3.0-or-later license.
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.
Reviews feature coming soon
Stay tuned for community discussions and feedback