Wikipedia MCP Server

Wikipedia MCP Server

Provides Claude with real-time access to Wikipedia through four essential tools: search articles, get full content, retrieve summaries, and find related articles. Enables comprehensive Wikipedia research workflows with structured data access and no API keys required.

Category
访问服务器

README

Wikipedia MCP Server

A Model Context Protocol (MCP) server that provides Claude with real-time access to Wikipedia. This server implements 4 essential tools for effective Wikipedia research while demonstrating core MCP concepts.

Features

Core Tools

  • search_wikipedia - Find articles when you don't know exact titles
  • get_article - Retrieve full article content for detailed analysis
  • get_summary - Get concise summaries for quick understanding
  • find_related - Discover related articles to expand research

Key Benefits

  • 🔄 Real-time data - Access current Wikipedia content, not training data
  • 🏗️ Structured output - Well-defined schemas for reliable data access
  • 🏠 Local control - Self-hosted, no API keys required
  • Fast & efficient - Async operations with proper error handling

Installation

Prerequisites

  • Python 3.9 or higher
  • uv (recommended) or pip

Install Dependencies

Using pip:

# Navigate to the project directory
cd wikipedia-mcp-server

# Install dependencies
pip install mcp httpx pydantic beautifulsoup4

Using uv (if available):

# Clone or create the project directory
cd wikipedia-mcp-server

# Install dependencies
uv sync

Usage

Running the Server

With python directly:

python -m src.wikipedia_mcp_server

With uv (if available):

uv run python -m src.wikipedia_mcp_server

Testing the Tools

You can test individual tools by running the server and connecting with an MCP client:

# Example: Search for articles
search_wikipedia("quantum computing", limit=3)

# Example: Get article summary
get_summary("Albert Einstein")

# Example: Get full article
get_article("Machine Learning")

# Example: Find related articles
find_related("Artificial Intelligence", limit=5)

Claude Desktop Integration

To use this MCP server with Claude Desktop, add it to your MCP configuration:

macOS/Linux Configuration

Edit ~/.config/claude-desktop/mcp.json:

{
  "mcpServers": {
    "wikipedia": {
      "command": "python",
      "args": [
        "-m", 
        "src.wikipedia_mcp_server"
      ],
      "cwd": "/ABSOLUTE/PATH/TO/wikipedia-mcp-server"
    }
  }
}

Windows Configuration

Edit %APPDATA%\Claude\mcp.json:

{
  "mcpServers": {
    "wikipedia": {
      "command": "python",
      "args": [
        "-m", 
        "src.wikipedia_mcp_server"
      ],
      "cwd": "C:\\ABSOLUTE\\PATH\\TO\\wikipedia-mcp-server"
    }
  }
}

Alternative: Using uv

If you have uv installed:

{
  "mcpServers": {
    "wikipedia": {
      "command": "uv",
      "args": [
        "run", 
        "python", 
        "-m", 
        "src.wikipedia_mcp_server"
      ],
      "cwd": "/ABSOLUTE/PATH/TO/wikipedia-mcp-server"
    }
  }
}

Research Workflows

Typical Research Flow

  1. Discover: search_wikipedia("quantum computing") → Find relevant articles
  2. Overview: get_summary("Quantum computing") → Quick understanding
  3. Deep dive: get_article("Quantum computing") → Full content when needed
  4. Expand: find_related("Quantum computing") → Related topics

Example Claude Conversation

User: I want to learn about Marie Curie's discoveries

Claude: I'll help you research Marie Curie's discoveries. Let me start by getting a summary of her Wikipedia article.

[Uses get_summary("Marie Curie")]

Based on the summary, Marie Curie was a pioneering scientist who discovered radium and polonium. Let me find related articles about her specific discoveries.

[Uses find_related("Marie Curie")]

Now let me get detailed information about her discovery of radium.

[Uses get_article("Radium")]

Tool Specifications

search_wikipedia

  • Purpose: Find articles when you don't know exact titles
  • Input: query (required), limit (1-10), language (default: "en")
  • Output: List of search results with titles, snippets, and URLs

get_article

  • Purpose: Retrieve full article content
  • Input: title (required), language (default: "en")
  • Output: Complete article with content, metadata, and sections

get_summary

  • Purpose: Get concise article summaries
  • Input: title (required), language (default: "en")
  • Output: Summary text with key facts

find_related

  • Purpose: Discover related articles
  • Input: title (required), limit (1-10), language (default: "en")
  • Output: Related articles with relationship types

Error Handling

The server includes comprehensive error handling for:

  • Invalid article titles
  • Network timeouts
  • Wikipedia API errors
  • Malformed requests
  • Rate limiting

Development

Project Structure

wikipedia-mcp-server/
├── src/wikipedia_mcp_server/
│   ├── __init__.py
│   ├── __main__.py
│   ├── server.py          # Main MCP server
│   ├── models.py          # Pydantic data models
│   └── wikipedia_client.py # Wikipedia API client
├── pyproject.toml
├── README.md
└── mvp.md

Key MCP Concepts Demonstrated

  • ✅ Tool registration with @mcp.tool()
  • ✅ Structured input/output with Pydantic models
  • ✅ Async operations for performance
  • ✅ Proper error handling and validation
  • ✅ Clear tool documentation

Adding New Tools

To add a new tool:

  1. Define the output model in models.py
  2. Add the Wikipedia API method in wikipedia_client.py
  3. Register the tool in server.py with @mcp.tool()

Performance Considerations

  • Async operations: All Wikipedia API calls are non-blocking
  • Response times: Typically < 3 seconds per operation
  • Rate limiting: Respects Wikipedia's guidelines
  • Error resilience: Graceful handling of API failures

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Submit a pull request

License

This project is open source and available under the MIT License.

Acknowledgments


Happy researching with Claude and Wikipedia! 🔍📚

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选