Skip to main content
Glama

维基百科 MCP 服务器

铁匠徽章

模型上下文协议 (MCP) 服务器,用于从维基百科检索信息,为大型语言模型 (LLM) 提供上下文。该工具可帮助 AI 助手从维基百科获取事实信息,从而将其响应建立在可靠来源的基础上。

图像

概述

维基百科 MCP 服务器通过标准化的模型上下文协议 (MCP) 接口提供对维基百科信息的实时访问。这使得 LLM 能够直接从维基百科检索准确且最新的信息,从而增强其响应能力。

已验证

MseeP.ai 安全评估徽章

特征

  • 搜索维基百科:查找符合特定查询的文章

  • 检索文章内容:获取包含所有信息的全文

  • 文章摘要:获取文章的简明摘要

  • 章节提取:从文章中检索特定章节

  • 链接发现:在文章中查找相关主题的链接

  • 相关主题:发现与特定文章相关的主题

  • 多语言支持:以不同语言访问维基百科

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 wikipedia-mcp:

npx -y @smithery/cli install @Rudra-ravi/wikipedia-mcp --client claude

使用 pipx(推荐)

# Install pipx if you don't have it sudo apt install pipx pipx ensurepath # Install the Wikipedia MCP server pipx install git+https://github.com/rudra-ravi/wikipedia-mcp.git

使用虚拟环境

# Create a virtual environment python3 -m venv venv # Activate the virtual environment source venv/bin/activate # Install the package pip install git+https://github.com/rudra-ravi/wikipedia-mcp.git

从源头

# Clone the repository git clone https://github.com/rudra-ravi/wikipedia-mcp.git cd wikipedia-mcp # Create a virtual environment python3 -m venv wikipedia-mcp-env source wikipedia-mcp-env/bin/activate # Install in development mode pip install -e .

用法

运行服务器

# If installed with pipx wikipedia-mcp # If installed in a virtual environment source venv/bin/activate wikipedia-mcp # Specify transport protocol (default: stdio) wikipedia-mcp --transport stdio # For Claude Desktop wikipedia-mcp --transport sse # For HTTP streaming

Claude Desktop 的配置

将以下内容添加到您的 Claude Desktop 配置文件中:

{ "mcpServers": { "wikipedia": { "command": "wikipedia-mcp" } } }

配置文件的位置:

  • macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

  • Windows: %APPDATA%/Claude/claude_desktop_config.json

  • Linux: ~/.config/Claude/claude_desktop_config.json

可用的 MCP 工具

Wikipedia MCP 服务器为 LLM 与 Wikipedia 交互提供了以下工具:

search_wikipedia

在维基百科中搜索与查询匹配的文章。

参数:

  • query (字符串):搜索词

  • limit (整数,可选):返回的最大结果数(默认值:10)

返回:

  • 包含标题、摘要和元数据的搜索结果列表

get_article

获取维基百科文章的完整内容。

参数:

  • title (字符串):维基百科文章的标题

返回:

  • 文章内容包括正文、摘要、章节、链接和类别

get_summary

获取维基百科文章的简明摘要。

参数:

  • title (字符串):维基百科文章的标题

返回:

  • 文章的文字摘要

get_sections

获取维基百科文章的各个部分。

参数:

  • title (字符串):维基百科文章的标题

返回:

  • 文章章节及其内容的结构化列表

get_links

获取维基百科文章中包含的链接。

参数:

  • title (字符串):维基百科文章的标题

返回:

  • 其他维基百科文章的链接列表

get_related_topics

根据链接和类别获取与维基百科文章相关的主题。

参数:

  • title (字符串):维基百科文章的标题

  • limit (整数,可选):相关主题的最大数量(默认值:10)

返回:

  • 相关主题及相关信息列表

示例提示

一旦服务器运行并使用 Claude Desktop 配置,您可以使用如下提示:

  • “使用维基百科信息告诉我有关量子计算的信息。”

  • “根据维基百科总结人工智能的历史。”

  • “维基百科对气候变化是怎么说的?”

  • “查找与机器学习相关的维基百科文章。”

  • “从维基百科中获取有关神经网络的文章的介绍部分。”

MCP 资源

该服务器还提供 MCP 资源(类似于 HTTP 端点,但用于 MCP):

  • search/{query} :在维基百科中搜索与查询匹配的文章

  • article/{title} :获取维基百科文章的完整内容

  • summary/{title} :获取维基百科文章的摘要

  • sections/{title} :获取维基百科文章的章节

  • links/{title} :获取维基百科文章中的链接

发展

本地开发设置

# Clone the repository git clone https://github.com/rudra-ravi/wikipedia-mcp.git cd wikipedia-mcp # Create a virtual environment python3 -m venv venv source venv/bin/activate # Install the package in development mode pip install -e . # Install development dependencies pip install -r requirements.txt # Run the server wikipedia-mcp

项目结构

  • wikipedia_mcp/ :主包

    • __main__.py :包的入口点

    • server.py :MCP 服务器实现

    • wikipedia_client.py :维基百科 API 客户端

    • api/ :API 实现

    • core/ :核心功能

    • utils/ :实用函数

故障排除

常见问题

  • 连接错误:确保 claude_desktop_config.json 中的命令正确

  • 未找到文章:检查文章标题的准确拼写

  • 速率限制:维基百科 API 有速率限制;考虑在请求之间增加延迟

  • 大型文章:一些维基百科文章非常大,可能会超出令牌限制

理解模型上下文协议(MCP)

模型上下文协议 (MCP) 并非传统的 HTTP API,而是一种用于 LLM 与外部工具之间通信的专用协议。主要特点:

  • 使用 stdio(标准输入/输出)或 SSE(服务器发送事件)进行通信

  • 专为AI模型交互而设计

  • 提供工具、资源和提示的标准化格式

  • 直接与 Claude 和其他 MCP 兼容的 AI 系统集成

Claude Desktop 充当 MCP 客户端,而该服务器提供 Claude 可以用来访问维基百科信息的工具和资源。

贡献

欢迎贡献!请参阅CONTRIBUTING.md获取相关指南。

执照

该项目根据 MIT 许可证获得许可 - 有关详细信息,请参阅LICENSE文件。

与作者联系

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    A server implementation for interacting with Wikidata API using the Model Context Protocol, providing tools for searching identifiers, extracting metadata, and executing SPARQL queries.
    Last updated -
    5
    31
    MIT License
  • A
    security
    F
    license
    A
    quality
    A Model Context Protocol server that enhances LLM capabilities by connecting to Wikipedia, internet search (Tavily), and financial data (Yahoo Finance) tools, enabling contextual responses to user queries.
    Last updated -
    3
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol server that enables natural language interaction with arXiv.org, allowing users to search, retrieve metadata, download PDFs, and load scholarly articles into LLM context.
    Last updated -
    5
    33
    MIT License
    • Apple
  • -
    security
    F
    license
    -
    quality
    An MCP server that retrieves and provides Wikipedia content for requested topics, enabling easy access to Wikipedia information directly through the Model Control Protocol.
    Last updated -
    1
    • Linux
    • Apple

View all related MCP servers

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/Rudra-ravi/wikipedia-mcp'

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