Skip to main content
Glama

MediaWiki适配器

铁匠徽章

一个自定义的**模型上下文协议 (MCP)**适配器,用于与 MediaWiki 和 WikiBase API 交互。此适配器允许您使用 MCP 框架以编程方式获取和编辑 MediaWiki 页面。

特征

  • 获取 MediaWiki 页面的内容。

  • 使用新内容和可选摘要编辑 MediaWiki 页面。

  • 可为不同的 MediaWiki 和 WikiBase 实例配置 API 基本 URL。

Related MCP server: Wikidata MCP Server

要求

  • Node.js(v16 或更高版本)

  • TypeScript(用于开发)

  • 启用 API 访问的 MediaWiki 实例

安装

  1. 克隆存储库:

git clone https://github.com/yourusername/mediawikiadapter.git cd mediawikiadapter
  1. 安装依赖项:

    npm install
  2. 构建项目:

    npm run build

用法

配置适配器

您可以配置适配器以使用自定义 MediaWiki 和 WikiBase API 端点:

server.configure({ mediaWikiAPIBase: "https://my.mediawiki.instance/api.php", wikiBaseAPIBase: "https://my.wikibase.instance/api.php", });

启动 MCP 服务器

使用以下命令运行 MCP 服务器:

node build/index.js

资源

获取页面内容

获取 MediaWiki 页面的内容。

  • 输入模式

{ "title": "string" }
  • 输出模式

    { "content": "string" }

示例用法:

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

工具

编辑页面

使用新内容编辑 MediaWiki 页面。

  • 输入模式

{ "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");

发展

以开发模式运行

要使用 TypeScript 以开发模式运行项目:

npm run dev

代码检查

运行 linter 来检查代码质量:

npm run lint

测试

目前尚未实现任何测试。您可以将测试添加到test目录并使用以下命令运行它们:

npm test

配置

适配器使用以下默认 API 基本 URL:

您可以使用server.configure()方法覆盖这些默认值。


贡献

欢迎贡献!请按以下步骤操作:

  1. 分叉存储库。

  2. 为您的功能或错误修复创建一个新的分支。

  3. 提交拉取请求并附上更改的详细描述。


执照

本项目采用LGPL-3.0 或更高版本许可证。详情请参阅许可证文件。


作者

Luca Mauri创作。

-
security - not tested
A
license - permissive license
-
quality - not tested

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/lucamauri/MediaWiki-MCP-adapter'

If you have feedback or need assistance with the MCP directory API, please join our Discord server