A Model Context Protocol (MCP) server that retrieves information from Wikipedia to provide context to LLMs.
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.
The easiest way to install the Wikipedia MCP server is directly from PyPI:
pip install wikipedia-mcp
This will install the latest stable version.
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
# Specify language (default: en for English)
# wikipedia-mcp --language ja # Example for Japanese
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:
summarize_article_for_query
Get a summary of a Wikipedia article tailored to a specific query.
Parameters:
title
(string): The title of the Wikipedia articlequery
(string): The query to focus the summary onmax_length
(integer, optional): Maximum length of the summary (default: 250)Returns:
summarize_article_section
Get a summary of a specific section of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia articlesection_title
(string): The title of the section to summarizemax_length
(integer, optional): Maximum length of the summary (default: 150)Returns:
extract_key_facts
Extract key facts from a Wikipedia article, optionally focused on a specific topic within the article.
Parameters:
title
(string): The title of the Wikipedia articletopic_within_article
(string, optional): A specific topic within the article to focus fact extractioncount
(integer, optional): Number of key facts to extract (default: 5)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 articlesummary/{title}/query/{query}/length/{max_length}
: Get a query-focused summary of an articlesummary/{title}/section/{section_title}/length/{max_length}
: Get a summary of a specific article sectionfacts/{title}/topic/{topic_within_article}/count/{count}
: Extract key facts from an 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.
No configuration available
This service may require manual configuration, please check the details on the left
Related projects feature coming soon
Will recommend related projects based on sub-categories