A Model Context Protocol server that retrieves information from Wikipedia to provide context to LLMs, allowing users to search articles, get summaries, full content, sections, and links from Wikipedia.
A Model Context Protocol (MCP) server that retrieves information from Wikipedia to provide context to Large Language Models (LLMs). This tool helps AI assistants access factual information from Wikipedia to ground their responses in reliable sources.
The Wikipedia MCP server provides real-time access to Wikipedia information through a standardized Model Context Protocol interface. This allows LLMs to retrieve accurate and up-to-date information directly from Wikipedia to enhance their responses.
To install wikipedia-mcp for Claude Desktop automatically via Smithery:
npx -y @smithery/cli install @Rudra-ravi/wikipedia-mcp --client claude
# 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
Add the following to your Claude Desktop configuration file:
{ "mcpServers": { "wikipedia": { "command": "wikipedia-mcp" } } }
Location of the configuration file:
~/Library/Application Support/Claude/claude_desktop_config.json
%APPDATA%/Claude/claude_desktop_config.json
~/.config/Claude/claude_desktop_config.json
The Wikipedia MCP server provides the following tools for LLMs to interact with Wikipedia:
search_wikipedia
Search Wikipedia for articles matching a query.
Parameters:
query
(string): The search termlimit
(integer, optional): Maximum number of results to return (default: 10)Returns:
get_article
Get the full content of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia articleReturns:
get_summary
Get a concise summary of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia articleReturns:
get_sections
Get the sections of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia articleReturns:
get_links
Get the links contained within a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia articleReturns:
get_related_topics
Get topics related to a Wikipedia article based on links and categories.
Parameters:
title
(string): The title of the Wikipedia articlelimit
(integer, optional): Maximum number of related topics (default: 10)Returns:
Once the server is running and configured with Claude Desktop, you can use prompts like:
The server also provides MCP resources (similar to HTTP endpoints but for MCP):
search/{query}
: Search Wikipedia for articles matching the queryarticle/{title}
: Get the full content of a Wikipedia articlesummary/{title}
: Get a summary of a Wikipedia articlesections/{title}
: Get the sections of a Wikipedia articlelinks/{title}
: Get the links in a Wikipedia article# 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 and test dependencies pip install -r requirements-dev.txt # Run the server wikipedia-mcp
wikipedia_mcp/
: Main package
__main__.py
: Entry point for the packageserver.py
: MCP server implementationwikipedia_client.py
: Wikipedia API clientapi/
: API implementationcore/
: Core functionalityutils/
: Utility functionstests/
: Test suite
test_basic.py
: Basic package teststest_cli.py
: Command-line interface teststest_server_tools.py
: Comprehensive server and tool testsThe project includes a comprehensive test suite to ensure reliability and functionality.
The test suite is organized in the tests/
directory with the following test files:
test_basic.py
: Basic package functionality teststest_cli.py
: Command-line interface and transport teststest_server_tools.py
: Comprehensive tests for all MCP tools and Wikipedia client functionality# Install test dependencies pip install -r requirements-dev.txt # Run all tests python -m pytest tests/ -v # Run tests with coverage python -m pytest tests/ --cov=wikipedia_mcp --cov-report=html
# Run only unit tests (excludes integration tests) python -m pytest tests/ -v -m "not integration" # Run only integration tests (requires internet connection) python -m pytest tests/ -v -m "integration" # Run specific test file python -m pytest tests/test_server_tools.py -v
The project uses pytest.ini
for test configuration:
[pytest] markers = integration: marks tests as integration tests (may require network access) slow: marks tests as slow running testpaths = tests addopts = -v --tb=short
All tests are designed to:
When contributing new features:
The Model Context Protocol (MCP) is not a traditional HTTP API but a specialized protocol for communication between LLMs and external tools. Key characteristics:
Claude Desktop acts as the MCP client, while this server provides the tools and resources that Claude can use to access Wikipedia information.
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE file for details.
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!