The Wikipedia MCP Server enables AI models to interact with Wikipedia through a standardized interface with these capabilities:
Search Wikipedia: Find articles using specific queries with optional result limits
Retrieve Articles: Get complete content of Wikipedia articles by title
Generate Summaries: Create concise summaries of full articles, specific sections, or query-focused summaries
Extract Key Facts: Pull important facts from articles, optionally focusing on specific topics
Explore Structure: Retrieve structured sections and their content
Discover Connections: Get internal links within articles and find related topics based on links and categories
Multi-language Support: Access Wikipedia content in different languages
Provides tools for searching Wikipedia articles, retrieving article summaries, getting full article content, extracting article sections, and finding links within articles.
Wikipedia MCP Server
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.
Overview
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.
Verified By
Features
- Search Wikipedia: Find articles matching specific queries
- Retrieve Article Content: Get full article text with all information
- Article Summaries: Get concise summaries of articles
- Section Extraction: Retrieve specific sections from articles
- Link Discovery: Find links within articles to related topics
- Related Topics: Discover topics related to a specific article
- Multi-language Support: Access Wikipedia in different languages by specifying the
--language
or-l
argument when running the server (e.g.,wikipedia-mcp --language ta
for Tamil). - Country/Locale Support: Use intuitive country codes like
--country US
,--country China
, or--country TW
instead of language codes. Automatically maps to appropriate Wikipedia language variants. - Language Variant Support: Support for language variants such as Chinese traditional/simplified (e.g.,
zh-hans
for Simplified Chinese,zh-tw
for Traditional Chinese), Serbian scripts (sr-latn
,sr-cyrl
), and other regional variants. - Optional caching: Cache API responses for improved performance using --enable-cache
- Google ADK Compatibility: Fully compatible with Google ADK agents and other AI frameworks that use strict function calling schemas
Installation
Using pipx (Recommended for Claude Desktop)
The best way to install for Claude Desktop usage is with pipx, which installs the command globally:
This ensures the wikipedia-mcp
command is available in Claude Desktop's PATH.
Installing via Smithery
To install wikipedia-mcp for Claude Desktop automatically via Smithery:
From PyPI (Alternative)
You can also install directly from PyPI:
Note: If you use this method and encounter connection issues with Claude Desktop, you may need to use the full path to the command in your configuration. See the Configuration section for details.
Using a virtual environment
From source
Usage
Running the server
Kubernetes example (minimal):
Configuration for Claude Desktop
Add the following to your Claude Desktop configuration file:
Option 1: Using command name (requires wikipedia-mcp
to be in PATH)
Option 2: Using full path (recommended if you get connection errors)
Option 3: With country/language specification
To find the full path, run: 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
Note: If you encounter connection errors, see the Troubleshooting section for solutions.
Available MCP Tools
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:
- A list of search results with titles, snippets, and metadata
get_article
Get the full content of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia article
Returns:
- Article content including text, summary, sections, links, and categories
get_summary
Get a concise summary of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia article
Returns:
- A text summary of the article
get_sections
Get the sections of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia article
Returns:
- A structured list of article sections with their content
get_links
Get the links contained within a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia article
Returns:
- A list of links to other Wikipedia articles
get_coordinates
Get the coordinates of a Wikipedia article.
Parameters:
title
(string): The title of the Wikipedia article
Returns:
- A dictionary containing coordinate information including:
title
: The article titlepageid
: The page IDcoordinates
: List of coordinate objects with latitude, longitude, and metadataexists
: Whether the article existserror
: Any error message if retrieval failed
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:
- A list of related topics with relevance information
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:
- A dictionary containing the title, query, and the focused summary
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:
- A dictionary containing the title, section title, and the section summary
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:
- A dictionary containing the title, topic, and a list of extracted facts
Country/Locale Support
The Wikipedia MCP server supports intuitive country and region codes as an alternative to language codes. This makes it easier to access region-specific Wikipedia content without needing to know language codes.
Supported Countries and Regions
Use --list-countries
to see all supported countries:
This will display countries organized by language, for example:
Usage Examples
Country-to-Language Mapping
The server automatically maps country codes to appropriate Wikipedia language editions:
- English-speaking: US, UK, Canada, Australia, New Zealand, Ireland, South Africa →
en
- Chinese regions:
- CN, China →
zh-hans
(Simplified Chinese) - TW, Taiwan →
zh-tw
(Traditional Chinese - Taiwan) - HK, Hong Kong →
zh-hk
(Traditional Chinese - Hong Kong) - SG, Singapore →
zh-sg
(Simplified Chinese - Singapore)
- CN, China →
- Major languages: JP→
ja
, DE→de
, FR→fr
, ES→es
, IT→it
, RU→ru
, etc. - Regional variants: Supports 140+ countries and regions
Error Handling
If you specify an unsupported country, you'll get a helpful error message:
Language Variants
The Wikipedia MCP server supports language variants for languages that have multiple writing systems or regional variations. This feature is particularly useful for Chinese, Serbian, Kurdish, and other languages with multiple scripts or regional differences.
Supported Language Variants
Chinese Language Variants
zh-hans
- Simplified Chinesezh-hant
- Traditional Chinesezh-tw
- Traditional Chinese (Taiwan)zh-hk
- Traditional Chinese (Hong Kong)zh-mo
- Traditional Chinese (Macau)zh-cn
- Simplified Chinese (China)zh-sg
- Simplified Chinese (Singapore)zh-my
- Simplified Chinese (Malaysia)
Serbian Language Variants
sr-latn
- Serbian Latin scriptsr-cyrl
- Serbian Cyrillic script
Kurdish Language Variants
ku-latn
- Kurdish Latin scriptku-arab
- Kurdish Arabic script
Norwegian Language Variants
no
- Norwegian (automatically mapped to Bokmål)
Usage Examples
How Language Variants Work
When you specify a language variant like zh-hans
, the server:
- Maps the variant to the base Wikipedia language (e.g.,
zh
for Chinese variants) - Uses the base language for API connections to the Wikipedia servers
- Includes the variant parameter in API requests to get content in the specific variant
- Returns content formatted according to the specified variant's conventions
This approach ensures optimal compatibility with Wikipedia's API while providing access to variant-specific content and formatting.
Example Prompts
Once the server is running and configured with Claude Desktop, you can use prompts like:
General Wikipedia queries:
- "Tell me about quantum computing using the Wikipedia information."
- "Summarize the history of artificial intelligence based on Wikipedia."
- "What does Wikipedia say about climate change?"
- "Find Wikipedia articles related to machine learning."
- "Get me the introduction section of the article on neural networks from Wikipedia."
- "What are the coordinates of the Eiffel Tower?"
- "Find the latitude and longitude of Mount Everest from Wikipedia."
- "Get coordinate information for famous landmarks in Paris."
Using country-specific Wikipedia:
- "Search Wikipedia China for information about the Great Wall." (uses Chinese Wikipedia)
- "Tell me about Tokyo from Japanese Wikipedia sources."
- "What does German Wikipedia say about the Berlin Wall?"
- "Find information about the Eiffel Tower from French Wikipedia."
- "Get Taiwan Wikipedia's article about Taiwanese cuisine."
Language variant examples:
- "Search Traditional Chinese Wikipedia for information about Taiwan."
- "Find Simplified Chinese articles about modern China."
- "Get information from Serbian Latin Wikipedia about Belgrade."
MCP Resources
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 articlecoordinates/{title}
: Get the coordinates of 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
Development
Local Development Setup
Project Structure
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 functions
tests/
: Test suitetest_basic.py
: Basic package teststest_cli.py
: Command-line interface teststest_server_tools.py
: Comprehensive server and tool tests
Testing
The project includes a comprehensive test suite to ensure reliability and functionality.
Test Structure
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
Running Tests
Run All Tests
Run Specific Test Categories
Test Categories
Unit Tests
- WikipediaClient Tests: Mock-based tests for all client methods
- Search functionality
- Article retrieval
- Summary extraction
- Section parsing
- Link extraction
- Related topics discovery
- Server Tests: MCP server creation and tool registration
- CLI Tests: Command-line interface functionality
Integration Tests
- Real API Tests: Tests that make actual calls to Wikipedia API
- End-to-End Tests: Complete workflow testing
Test Configuration
The project uses pytest.ini
for test configuration:
Continuous Integration
All tests are designed to:
- Run reliably in CI/CD environments
- Handle network failures gracefully
- Provide clear error messages
- Cover edge cases and error conditions
Adding New Tests
When contributing new features:
- Add unit tests for new functionality
- Include both success and failure scenarios
- Mock external dependencies (Wikipedia API)
- Add integration tests for end-to-end validation
- Follow existing test patterns and naming conventions
Troubleshooting
Common Issues
Claude Desktop Connection Issues
Problem: Claude Desktop shows errors like spawn wikipedia-mcp ENOENT
or cannot find the command.
Cause: This occurs when the wikipedia-mcp
command is installed in a user-specific location (like ~/.local/bin/
) that's not in Claude Desktop's PATH.
Solutions:
- Use full path to the command (Recommended):To find your exact path, run:
which wikipedia-mcp
- Install with pipx for global access:Then use the standard configuration:
- Create a symlink to a global location:
Other Issues
- Article Not Found: Check the exact spelling of article titles
- Rate Limiting: Wikipedia API has rate limits; consider adding delays between requests
- Large Articles: Some Wikipedia articles are very large and may exceed token limits
Understanding the Model Context Protocol (MCP)
The Model Context Protocol (MCP) is not a traditional HTTP API but a specialized protocol for communication between LLMs and external tools. Key characteristics:
- Uses stdio (standard input/output) or SSE (Server-Sent Events) for communication
- Designed specifically for AI model interaction
- Provides standardized formats for tools, resources, and prompts
- Integrates directly with Claude and other MCP-compatible AI systems
Claude Desktop acts as the MCP client, while this server provides the tools and resources that Claude can use to access Wikipedia information.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Connect with the Author
- 🌐 Portfolio: ravikumar-dev.me
- 📝 Blog: Medium
- 💼 LinkedIn: in/ravi-kumar-e
- 🐦 Twitter: @Ravikumar_d3v
remote-capable server
The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.
Tools
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.
Related MCP Servers
- AsecurityAlicenseAqualityA server implementation for interacting with Wikidata API using the Model Context Protocol, providing tools for searching identifiers, extracting metadata, and executing SPARQL queries.Last updated -524MIT License
- AsecurityFlicenseAqualityA Model Context Protocol server that enhances LLM capabilities by connecting to Wikipedia, internet search (Tavily), and financial data (Yahoo Finance) tools, enabling contextual responses to user queries.Last updated -3
- AsecurityAlicenseAqualityA Model Context Protocol server that enables natural language interaction with arXiv.org, allowing users to search, retrieve metadata, download PDFs, and load scholarly articles into LLM context.Last updated -523MIT License
- -securityFlicense-qualityAn MCP server that retrieves and provides Wikipedia content for requested topics, enabling easy access to Wikipedia information directly through the Model Control Protocol.Last updated -1