Skip to main content
Glama
OriShmila

Wikipedia MCP Server

by OriShmila

Wikipedia MCP Server

A Model Context Protocol (MCP) server providing access to Wikipedia through 10 tools: search, retrieve articles, summarize content, extract facts, get coordinates, and more.

Features

  • 100% Test Coverage - 31 test cases, full schema validation

  • Multi-language Support - Access different Wikipedia editions

  • Robust Error Handling - Graceful API error handling

Related MCP server: Wikipedia MCP Server

Available Tools

Tool

Description

search_wikipedia

Search for articles matching a query

get_article

Get complete article content

get_summary

Get article summary

summarize_article_for_query

Get query-focused summary

summarize_article_section

Summarize specific sections

extract_key_facts

Extract key facts from articles

get_related_topics

Find related articles and categories

get_sections

Get article structure and sections

get_links

Get all links within an article

get_coordinates

Get geographic coordinates

Installation

# Install with uvx
uvx --from git+https://github.com/yourusername/wikipedia-mcp-server wikipedia-mcp-server

# Or local development
git clone https://github.com/yourusername/wikipedia-mcp-server.git
cd wikipedia-mcp-server && uv sync

Usage

Claude Desktop Configuration

{
  "mcpServers": {
    "wikipedia": {
      "command": "uvx", 
      "args": ["--from", "git+https://github.com/yourusername/wikipedia-mcp-server", "wikipedia-mcp-server"]
    }
  }
}

Testing

uv run python test_server.py  # 31 tests, 100% pass rate

Example Usage

Search:

{"tool": "search_wikipedia", "arguments": {"query": "AI"}}

Get Article:

{"tool": "get_article", "arguments": {"title": "Python (programming language)"}}

Extract Facts:

{"tool": "extract_key_facts", "arguments": {"title": "Marie Curie", "topic_within_article": "Nobel Prize"}}

🎯 Parameter and Type Handling Rules

This server follows specific design patterns for handling parameters and data types to ensure consistency and predictability.

Input Parameter Design

Schema Pattern: All input parameters are marked as required in JSON schemas

{
  "required": ["title", "query", "max_length"]
}

Handler Pattern: Functions can have optional parameters with defaults

async def summarize_article_for_query(
    title: str, 
    query: str, 
    max_length: int = 250  # Default provided in handler
) -> Dict[str, Any]:

Benefits:

  • Clear Client Expectations: MCP clients must provide all documented parameters

  • Implementation Flexibility: Handlers can use sensible defaults when appropriate

  • Future Extensibility: Schema can be expanded without breaking existing implementations

Output Type Design

Nullable Fields: Use ["type", "null"] only when data genuinely might not exist

{
  "coordinates": { "type": ["array", "null"] },  // May not exist for non-geographic articles
  "pageid": { "type": ["number", "null"] },      // May be null if article doesn't exist
  "error": { "type": ["string", "null"] }        // Null on success, string on error
}

Non-Nullable Collections: Always return empty arrays instead of null

{
  "links": { "type": "array" },     // Returns [] if no links found
  "facts": { "type": "array" },     // Returns [] if no facts extracted
  "sections": { "type": "array" }   // Returns [] if no sections found
}

Non-Nullable Strings: Always return empty strings instead of null

{
  "summary": { "type": "string" },  // Returns "" if no summary available
  "text": { "type": "string" },      // Returns "" if no content available
  "title": { "type": "string" }     // Always present, never null
}

Design Principles

  1. Semantic Nullability: Only use null when it represents "this data doesn't exist" rather than "this data is empty"

  2. Predictable Types: Arrays are always arrays, strings are always strings (unless explicitly nullable)

  3. Client Safety: Clients can safely iterate arrays and concatenate strings without null checks

  4. Clear Intent: Nullable fields have explicit semantic meaning (coordinates for non-places, errors on success, etc.)

Examples

Geographic Data (nullable when appropriate):

{
  "title": "Programming",           // Always string
  "coordinates": null,              // Null - programming isn't a place
  "pageid": 12345,                 // Number when article exists
  "error": null                    // Null on success
}

Content Collections (empty when no data):

{
  "title": "Stub Article",         // Always string  
  "links": [],                     // Empty array - no links found
  "facts": [],                     // Empty array - no facts extracted
  "summary": ""                    // Empty string - no summary available
}

This design ensures type safety, predictable behavior, and clear semantic meaning across all tools.

Development

Dependencies: mcp>=1.6.0, wikipedia-api>=0.6.0, requests>=2.31.0, jsonschema>=4.0.0

# Local development
git clone repo && cd wikipedia-mcp-server
uv sync && uv run python test_server.py

Production-ready Wikipedia MCP server with 100% test coverage.

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    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.
    -
  • A
    license
    Not graded
    quality
    F
    maintenance
    Provides comprehensive access to Wikipedia content including article search, full text retrieval, summaries, categories, links, images, language versions, and external references through 9 specialized tools.
    9 npm
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    Enables LLMs to search for keywords and fetch full page content from Wikipedia across various languages. It provides direct access to Wikipedia information through search and fetch tools.
    2
    4
    MIT
  • A
    license
    Not graded
    quality
    F
    maintenance
    Enables AI agents to search, read, and explore Wikipedia articles via tools like summaries, categories, and random articles, with no API keys required.
    1
    MIT