logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

wiki-data-retriever-mcp

A Model Context Protocol (MCP) service offering instantaneous retrieval of curated data from the entirety of Wikipedia, supporting multilingual content, structured sections, and relational linking for grounding AI responses.

Author

wiki-data-retriever-mcp logo

Rudra-ravi

MIT License

Quick Info

GitHub GitHub Stars 113
NPM Weekly Downloads 0
Tools 1
Last Updated 2026-02-19

Tags

wikipediaapisretrievalwikipedia dataretrieval articleswikipedia content

Encyclopedia Data Access Utility (MCP)

smithery badge

This Model Context Protocol (MCP) server interfaces with the public Wikipedia repository to furnish Large Language Models (LLMs) with verifiable, real-time external context. It is engineered to anchor AI outputs in factual information derived from high-authority encyclopedia entries.

Wikipedia Server MCP server

image

Core Functionality

The Encyclopedia Data Access Utility provides an interface conforming to the MCP standard, allowing LLMs to fetch contemporary and accurate knowledge directly from Wikipedia sources, thereby enriching generative outputs.

Vetted By

MseeP.ai Security Assessment Badge

Key Capabilities

  • Encyclopedic Lookup: Execute targeted searches across Wikipedia, complete with advanced diagnostic feedback.
  • Full Document Acquisition: Fetch the entirety of an article's textual content.
  • Abstract Generation: Produce brief, high-level abstracts of articles.
  • Segment Retrieval: Isolate and extract specific structural components within documents.
  • Citation Discovery: Identify internal hyperlinks pointing to associated subjects.
  • Topical Correlation: Determine conceptually related knowledge domains.
  • Multilingual Access: Support for accessing Wikipedia editions in various global languages. Specify dialects via --language or -l (e.g., wikipedia-mcp --language ta for Tamil).
  • Geographic Localization: Utilize straightforward geographical identifiers like --country US or --country China which map automatically to the corresponding language editions.
  • Dialect/Script Specificity: Native handling for language variants such as Chinese scripts (zh-hans, zh-tw) and Serbian forms (sr-latn, sr-cyrl).
  • Response Caching: Performance optimization via response caching through the --enable-cache flag.
  • ADK Compliance: Full adherence to function-calling schemas used by Google ADK agents and similar AI platforms.

Deployment Instructions

Using pipx (Optimal for Desktop Environments)

pipx globally installs the executable, making it readily available:

# Install pipx if needed
pip install pipx
pipx ensurepath

# Install the utility
pipx install wikipedia-mcp

This ensures the wikipedia-mcp command is registered for your client environment.

Installation via Smithery

Automated deployment for Claude Desktop environments using Smithery:

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

Standard PyPI Installation (Alternative)

You may install directly from the Python Package Index:

pip install wikipedia-mcp

Note: If utilizing this method results in connectivity failures with your desktop client, consult the configuration section below for using the absolute path.

Virtual Environment Setup

# Environment creation
python3 -m venv venv

# Activation
source venv/bin/activate

# Package installation
pip install git+https://github.com/rudra-ravi/wikipedia-mcp.git

From Source Repository

# Clone source code
git clone https://github.com/rudra-ravi/wikipedia-mcp.git
cd wikipedia-mcp

# Setup isolated environment
python3 -m venv wikipedia-mcp-env
source wikipedia-mcp-env/bin/activate

# Install for development
pip install -e .

Execution Guide

Starting the Service

# If installed via pipx
wikipedia-mcp

# If installed within an active virtual environment
wikipedia-mcp

# Protocol specification (default: stdio)
wikipedia-mcp --transport stdio  # Standard input/output for desktop clients
wikipedia-mcp --transport sse    # For HTTP-based data streaming

# Language configuration (default: en)
wikipedia-mcp --language ja  # Japanese example
wikipedia-mcp --language zh-hans  # Simplified Chinese example

# Locale configuration (alternative to language codes)
wikipedia-mcp --country US        # United States (English)
wikipedia-mcp --country China     # Chinese Simplified
wikipedia-mcp --country Taiwan    # Chinese Traditional

# List available locales
wikipedia-mcp --list-countries

# SSE Configuration (for containerized use)
wikipedia-mcp --transport sse --host 0.0.0.0 --port 8080

# Enable local data caching
wikipedia-mcp --enable-cache

# Bypass rate limits using a Personal Access Token
wikipedia-mcp --access-token your_wikipedia_token_here

# Or via environment variable
export WIKIPEDIA_ACCESS_TOKEN=your_wikipedia_token_here
wikipedia-mcp

# Security Note for SSE: Endpoint security must be managed externally via a reverse proxy (e.g., Nginx) or internal network rules.

# Combined setup example
wikipedia-mcp --country Taiwan --enable-cache --access-token your_token --transport sse --port 8080

### Container Deployment (Docker/Kubernetes)

When deploying within container orchestration systems, bind the SSE listener to all interfaces:

```bash
# Docker execution
docker build -t wikipedia-mcp .
docker run --rm -p 8080:8080 wikipedia-mcp --transport sse --host 0.0.0.0 --port 8080

Kubernetes manifest snippet:

apiVersion: apps/v1
kind: Deployment
# ... metadata omitted ...
    spec:
      containers:
        - name: server
          image: your-repo/wikipedia-mcp:latest
          args: ["--transport", "sse", "--host", "0.0.0.0", "--port", "8080"]
          ports:
            - containerPort: 8080
# ... Service definition follows ...

Client Configuration (Claude Desktop)

In your Claude Desktop configuration file, specify the server details:

Method 1: Relying on System PATH

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

Method 2: Specifying Absolute Path (For Connection Stability)

{
  "mcpServers": {
    "wikipedia": {
      "command": "/absolute/path/to/wikipedia-mcp"
    }
  }
}

Method 3: Pre-configuring Locales/Arguments

{
  "mcpServers": {
    "wiki_usa": {
      "command": "wikipedia-mcp",
      "args": ["--country", "US"]
    },
    "wiki_jp": {
      "command": "wikipedia-mcp",
      "args": ["--country", "Japan"]
    }
  }
}

To ascertain the correct path, execute: which wikipedia-mcp

Configuration File Locations: - macOS: ~/Library/Application Support/Claude/claude_desktop_config.json - Windows: %APPDATA%/Claude/claude_desktop_config.json - Linux: ~/.config/Claude/claude_desktop_config.json

Troubleshooting Tip: Connection faults often resolve by using the absolute path configuration (Method 2).

Available MCP Interface Methods

The service exposes the following discrete tools for LLM invocation:

search_wikipedia

Finds Wikipedia articles corresponding to a provided string.

Arguments: - query (string): The term to search for. - limit (integer, optional): Max results to return (Default: 10).

Output: - Array of search hits, including titles, brief excerpts, and metadata.

get_article

Retrieves the complete content of a specified encyclopedia entry.

Arguments: - title (string): Exact title of the target article.

Output: - Comprehensive document structure: text body, summary block, section indexing, internal references, and classifications.

get_summary

Fetches a condensed overview of a given article.

Arguments: - title (string): The article's identifier.

Output: - A single text string summarizing the content.

get_sections

Lists the hierarchical organization and content of an article's parts.

Arguments: - title (string): The article's title.

Output: - Structured array detailing section headings and their respective content.

Extracts all outgoing references present within an article body.

Arguments: - title (string): The article's title.

Output: - A list of hyperlinks pointing to other Wikipedia entries.

get_coordinates

Retrieves geospatial data associated with an article subject.

Arguments: - title (string): The article's title.

Output: - Dictionary containing pageid, article title, boolean exists flag, and a list of coordinate objects (latitude, longitude, metadata), or an error field.

get_related_topics

Discovers subjects closely associated with the primary article via category and link analysis.

Arguments: - title (string): The subject title. - limit (integer, optional): Maximum number of related entries (Default: 10).

Output: - List of associated topics and a relevance metric.

summarize_article_for_query

Generates a summary of an article, contextually focused on a secondary query.

Arguments: - title (string): The primary article title. - query (string): The specific aspect to emphasize in the summary. - max_length (integer, optional): Constraint on output length (Default: 250 characters).

Output: - JSON object containing the focused summary text.

summarize_article_section

Provides a brief overview of a designated segment within an article.

Arguments: - title (string): The main article title. - section_title (string): The specific heading to summarize. - max_length (integer, optional): Summary length limit (Default: 150 characters).

Output: - JSON object with the section's abstracted content.

extract_key_facts

Parses an article to pull out salient data points, optionally targeting a sub-topic.

Arguments: - title (string): The article title. - topic_within_article (string, optional): Focus area for extraction. - count (integer, optional): Desired number of facts (Default: 5).

Output: - List of factual statements extracted from the source text.

Geographic/Locale Designation System

The utility permits the use of user-friendly country/region codes instead of raw language codes for locale targeting, simplifying multilingual access.

Listing Supported Locales

Use the command-line flag to view the current mapping:

wikipedia-mcp --list-countries

This command outputs groupings, such as:

Supported Country/Locale Codes:
========================================
    en: US, USA, United Kingdom, CA, Australia, ...
    zh-hans: CN, Mainland China
    zh-tw: TW, Taiwan  
    ja: JP, Japan
    de: DE, Germany
    es: ES, Spain, MX, Mexico, ...

Usage Examples (Locale Flags)

# Major language editions via code
wikipedia-mcp --country US       # English (US)
wikipedia-mcp --country CN       # Simplified Chinese
wikipedia-mcp --country JP       # Japanese
wikipedia-mcp --country FR       # French

# Using full names (case-insensitive matching)
wikipedia-mcp --country "United Kingdom"
wikipedia-mcp --country Germany

# Regional/Script Variants
wikipedia-mcp --country HK       # Traditional Chinese (HK variant)
wikipedia-mcp --country SA       # Arabic (Saudi Arabia)

Automatic Locale Resolution

The server dynamically resolves country codes to the appropriate Wikipedia language domain:

  • Anglophone: US, UK, CA, AU resolve to en.
  • Sinitic Regions: CN maps to zh-hans; TW maps to zh-tw.
  • Other Major Tongues: JP→ja, DE→de, etc.
  • Supports extensive mapping for over 140 global territories.

Handling Unknown Locales

If an invalid locale is specified, the system returns an informative error:

$ wikipedia-mcp --country MARS
Error: Locale 'MARS' is unrecognized. Review accepted country identifiers using --list-countries.

Language Dialect Support

The system natively manages language variants where different scripts or regional conventions exist (e.g., Chinese, Serbian).

Supported Variant Identifiers

Chinese (Han Characters)

  • zh-hans: Standardized Simplified Script
  • zh-hant: Standardized Traditional Script
  • zh-tw: Taiwan-specific Traditional Script

Serbian (South Slavic)

  • sr-latn: Latin Script
  • sr-cyrl: Cyrillic Script

Operational Mechanics

When a variant like sr-latn is specified: 1. The base language (sr) is used for API connection routing. 2. The variant tag is passed in the request payload. 3. The resulting text adheres to the requested script/dialect conventions.

Illustrative Prompts for LLM Interaction

Once operational, LLMs can execute queries such as:

  • "Leverage the Wikipedia data source to explain the fundamentals of blockchain technology."
  • "Find the Wikipedia abstract for 'General Relativity' and summarize its foundational concepts."
  • "Retrieve the 'Etymology' segment from the Wikipedia entry titled 'Internet'."
  • "What are the geographic coordinates listed for the Louvre Museum on Wikipedia?"
  • "Using German Wikipedia, what does it state regarding Bavarian history?"

MCP Endpoint Mapping (Resource Paths)

The server exposes virtual resources accessible via the MCP framework:

  • search/{query_term}: Execute a search.
  • article/{title}: Retrieve full document.
  • summary/{title}: Get high-level abstract.
  • coordinates/{title}: Fetch geographic points.
  • facts/{title}/topic/{focus}/count/{N}: Extract N facts about a focus area.

Development & Code Structure

Local Setup

# Clone and enter directory
git clone https://github.com/rudra-ravi/wikipedia-mcp.git
cd wikipedia-mcp

# Environment setup
python3 -m venv venv
source venv/bin/activate
pip install -e .  # Install in editable mode

Directory Organization

  • wikipedia_mcp/: Primary module folder
  • server.py: MCP communication layer and tool registration.
  • wikipedia_client.py: Handles all interactions with the MediaWiki API.
  • utils/: Helper utilities.
  • tests/: Comprehensive testing suite.

Quality Assurance (Testing Procedures)

The project maintains robust testing across unit and integration levels.

Test Execution

Prerequisites: pip install -r requirements-dev.txt

# Run all tests verbosely
python -m pytest tests/ -v

# Run tests with code coverage report generation
python -m pytest tests/ --cov=wikipedia_mcp --cov-report=html

Test Segmentation

  • Unit Tests (test_basic.py, etc.): Focus on internal logic, utilizing Mocks for external dependencies (Wikipedia API).
  • Integration Tests (test_server_tools.py marked with @pytest.mark.integration): Validate end-to-end functionality requiring live network access to the Wikipedia service.

Error Resolution Strategies

Connection Failure in Desktop Client (ENOENT)

Symptom: Client reports inability to locate or launch the executable.

Remedy: Install via pipx for system-wide path inclusion, or explicitly define the full path in the configuration JSON as shown previously.

Information Retrieval Failures

  1. Verify Title Accuracy: Ensure article titles match precisely.
  2. Rate Limiting: If excessive requests are made, Wikipedia may return HTTP 429 or 403 errors. Utilize caching or the --access-token parameter.

Advanced Diagnostics

Use verbose logging to trace API calls:

wikipedia-mcp --log-level DEBUG

Understanding the Model Context Protocol (MCP)

MCP defines a machine-to-machine communication standard for LLM tool invocation, distinct from conventional web protocols like REST. It relies on structured JSON payloads exchanged over stdio or sse, enabling seamless, real-time data exchange with AI reasoning engines like Claude.

Licensing and Authorship

Licensed under the MIT License. For inquiries or collaboration, contact the author via the provided links.

See Also

`