mcpField
W
Wikipedia MCP Server

Wikipedia MCP Server

本地服务
github.com/scotthelm搜索与检索182 周前更新

关于 Wikipedia MCP Server

Wikipedia MCP Server 通过 Wikipedia API 为 AI 助手提供搜索和读取文章、获取图片及查询历史事件的能力。

主要功能

  1. 01搜索 Wikipedia 页面
  2. 02读取页面内容
  3. 03获取页面图片
  4. 04按日期查询事件

适用场景

  1. 01查找匹配查询的文章
  2. 02按标题读取页面
  3. 03获取文章中的图片
  4. 04查询特定日期的事件

MCP 相关

它将 Wikipedia API 操作作为工具提供给 MCP 客户端,包括搜索、页面读取、图片查询和历史事件查询。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"wikipedia": {
"command": "npx",
"args": [
"-y",
"@shelm/wikipedia-mcp-server"
]
}
}
}
启动命令npx -y @shelm/wikipedia-mcp-server

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@shelm/wikipedia-mcp-server

工具

4

收录的工具列表 · 更新于 3 周前

参数类型必填说明
datestring是ISO8601 日期部分(YYYY-MM-DD)

详细介绍

Wikipedia MCP 服务

用于与 Wikipedia API 交互的 MCP(Model Context Protocol)服务。

概述

此服务通过 Model Context Protocol 提供与 Wikipedia API 交互的工具。它允许 AI 助手访问 Wikipedia 内容、搜索文章、获取历史事件和检索图片。

功能

此服务提供以下工具:

  • onThisDay:获取特定日期发生的历史事件
  • findPage:搜索与查询匹配的 Wikipedia 页面
  • getPage:按标题获取 Wikipedia 页面的内容
  • getImagesForPage:按标题获取 Wikipedia 页面中的图片

安装

npm install @shelm/wikipedia-mcp-server

用于开发:

git clone https://github.com/scotthelm/wikipedia-mcp-server.git
cd wikipedia-mcp-server
npm install
npm run build

用法

运行服务
npx @shelm/wikipedia-mcp-server

这将启动 MCP 服务,该服务通过 stdio 通信。

以编程方式使用

你也可以在自己的项目中以编程方式使用此软件包:

import {
  WikipediaServer,
  isValidOnThisDayArgs,
  isValidFindPageArgs,
  isValidGetPageArgs,
  isValidGetImagesForPageArgs,
} from "@shelm/wikipedia-mcp-server";

// Create a new server instance
const server = new WikipediaServer();

// Run the server
server.run().catch(console.error);

// Or use the validation functions and handlers directly
if (isValidOnThisDayArgs({ date: "2023-01-01" })) {
  const result = await server.handleOnThisDay({ date: "2023-01-01" });
  console.log(result);
}
示例客户端

此处提供了一个示例客户端,用于演示如何与服务交互:

node example-client.js

此操作将:

  1. 启动服务
  2. 查询可用工具
  3. 使用示例查询演示每个工具
  4. 在 http://localhost:3000 的简易 Web 界面中显示结果

开发

构建
npm run build
在开发模式下运行
npm run dev
测试

可以使用示例客户端手动测试此项目:

node example-client.js

这将使用示例查询演示所有可用工具。

MCP 服务配置

要将此服务与 Claude 或其他兼容 MCP 的助手搭配使用,请将其添加到 MCP 配置中:

{
  "mcpServers": {
    "wikipedia": {
      "command": "npx",
      "args": ["@shelm/wikipedia-mcp-server"],
      "env": {}
    }
  }
}

致谢

如果没有创建 wikipedia package 的各位所做的出色工作,这一切都不可能实现。

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。