# Wikipedia MCP Server
[](https://smithery.ai/server/@Rudra-ravi/wikipedia-mcp)
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.
<a href="https://glama.ai/mcp/servers/@Rudra-ravi/wikipedia-mcp">
<img width="380" height="200" src="https://glama.ai/mcp/servers/@Rudra-ravi/wikipedia-mcp/badge" alt="Wikipedia Server MCP server" />
</a>

## 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
[](https://mseep.ai/app/rudra-ravi-wikipedia-mcp)
## 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:
```bash
# Install pipx if you don't have it
pip install pipx
pipx ensurepath
# Install the Wikipedia MCP server
pipx install wikipedia-mcp
```
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](https://smithery.ai/server/@Rudra-ravi/wikipedia-mcp):
```bash
npx -y @smithery/cli install @Rudra-ravi/wikipedia-mcp --client claude
```
### From PyPI (Alternative)
You can also install directly from PyPI:
```bash
pip install wikipedia-mcp
```
**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](#configuration-for-claude-desktop) section for details.
### Using a virtual environment
```bash
# 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
```
### From source
```bash
# 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 .
```
## Usage
### Running the server
```bash
# 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
wikipedia-mcp --language zh-hans # Example for Simplified Chinese
wikipedia-mcp --language zh-tw # Example for Traditional Chinese (Taiwan)
wikipedia-mcp --language sr-latn # Example for Serbian Latin script
# Specify country/locale (alternative to language codes)
wikipedia-mcp --country US # English (United States)
wikipedia-mcp --country China # Chinese Simplified
wikipedia-mcp --country Taiwan # Chinese Traditional (Taiwan)
wikipedia-mcp --country Japan # Japanese
wikipedia-mcp --country Germany # German
wikipedia-mcp --country france # French (case insensitive)
# List all supported countries
wikipedia-mcp --list-countries
# Optional: Specify port for SSE (default 8000)
wikipedia-mcp --transport sse --port 8080
# Optional: Enable caching
wikipedia-mcp --enable-cache
# Combine options
wikipedia-mcp --country Taiwan --enable-cache --transport sse --port 8080
```
### 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)**
```json
{
"mcpServers": {
"wikipedia": {
"command": "wikipedia-mcp"
}
}
}
```
**Option 2: Using full path (recommended if you get connection errors)**
```json
{
"mcpServers": {
"wikipedia": {
"command": "/full/path/to/wikipedia-mcp"
}
}
}
```
**Option 3: With country/language specification**
```json
{
"mcpServers": {
"wikipedia-us": {
"command": "wikipedia-mcp",
"args": ["--country", "US"]
},
"wikipedia-taiwan": {
"command": "wikipedia-mcp",
"args": ["--country", "TW"]
},
"wikipedia-japan": {
"command": "wikipedia-mcp",
"args": ["--country", "Japan"]
}
}
}
```
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](#common-issues) 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 term
- `limit` (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_related_topics`
Get topics related to a Wikipedia article based on links and categories.
**Parameters:**
- `title` (string): The title of the Wikipedia article
- `limit` (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 article
- `query` (string): The query to focus the summary on
- `max_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 article
- `section_title` (string): The title of the section to summarize
- `max_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 article
- `topic_within_article` (string, optional): A specific topic within the article to focus fact extraction
- `count` (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:
```bash
wikipedia-mcp --list-countries
```
This will display countries organized by language, for example:
```
Supported Country/Locale Codes:
========================================
en: US, USA, United States, UK, GB, Canada, Australia, ...
zh-hans: CN, China
zh-tw: TW, Taiwan
ja: JP, Japan
de: DE, Germany
fr: FR, France
es: ES, Spain, MX, Mexico, AR, Argentina, ...
pt: PT, Portugal, BR, Brazil
ru: RU, Russia
ar: SA, Saudi Arabia, AE, UAE, EG, Egypt, ...
```
### Usage Examples
```bash
# Major countries by code
wikipedia-mcp --country US # United States (English)
wikipedia-mcp --country CN # China (Simplified Chinese)
wikipedia-mcp --country TW # Taiwan (Traditional Chinese)
wikipedia-mcp --country JP # Japan (Japanese)
wikipedia-mcp --country DE # Germany (German)
wikipedia-mcp --country FR # France (French)
wikipedia-mcp --country BR # Brazil (Portuguese)
wikipedia-mcp --country RU # Russia (Russian)
# Countries by full name (case insensitive)
wikipedia-mcp --country "United States"
wikipedia-mcp --country China
wikipedia-mcp --country Taiwan
wikipedia-mcp --country Japan
wikipedia-mcp --country Germany
wikipedia-mcp --country france # Case insensitive
# Regional variants
wikipedia-mcp --country HK # Hong Kong (Traditional Chinese)
wikipedia-mcp --country SG # Singapore (Simplified Chinese)
wikipedia-mcp --country "Saudi Arabia" # Arabic
wikipedia-mcp --country Mexico # Spanish
```
### 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)
- **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:
```bash
$ wikipedia-mcp --country INVALID
Error: Unsupported country/locale: 'INVALID'.
Supported country codes include: US, USA, UK, GB, CA, AU, NZ, IE, ZA, CN.
Use --language parameter for direct language codes instead.
Use --list-countries to see supported country codes.
```
## 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 Chinese
- `zh-hant` - Traditional Chinese
- `zh-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 script
- `sr-cyrl` - Serbian Cyrillic script
#### Kurdish Language Variants
- `ku-latn` - Kurdish Latin script
- `ku-arab` - Kurdish Arabic script
#### Norwegian Language Variants
- `no` - Norwegian (automatically mapped to Bokmål)
### Usage Examples
```bash
# Access Simplified Chinese Wikipedia
wikipedia-mcp --language zh-hans
# Access Traditional Chinese Wikipedia (Taiwan)
wikipedia-mcp --language zh-tw
# Access Serbian Wikipedia in Latin script
wikipedia-mcp --language sr-latn
# Access Serbian Wikipedia in Cyrillic script
wikipedia-mcp --language sr-cyrl
```
### How Language Variants Work
When you specify a language variant like `zh-hans`, the server:
1. Maps the variant to the base Wikipedia language (e.g., `zh` for Chinese variants)
2. Uses the base language for API connections to the Wikipedia servers
3. Includes the variant parameter in API requests to get content in the specific variant
4. 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."
### 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 query
- `article/{title}`: Get the full content of a Wikipedia article
- `summary/{title}`: Get a summary of a Wikipedia article
- `sections/{title}`: Get the sections of a Wikipedia article
- `links/{title}`: Get the links in a Wikipedia article
- `summary/{title}/query/{query}/length/{max_length}`: Get a query-focused summary of an article
- `summary/{title}/section/{section_title}/length/{max_length}`: Get a summary of a specific article section
- `facts/{title}/topic/{topic_within_article}/count/{count}`: Extract key facts from an article
## Development
### Local Development Setup
```bash
# 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
```
### Project Structure
- `wikipedia_mcp/`: Main package
- `__main__.py`: Entry point for the package
- `server.py`: MCP server implementation
- `wikipedia_client.py`: Wikipedia API client
- `api/`: API implementation
- `core/`: Core functionality
- `utils/`: Utility functions
- `tests/`: Test suite
- `test_basic.py`: Basic package tests
- `test_cli.py`: Command-line interface tests
- `test_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 tests
- **`test_cli.py`**: Command-line interface and transport tests
- **`test_server_tools.py`**: Comprehensive tests for all MCP tools and Wikipedia client functionality
### Running Tests
#### Run All Tests
```bash
# 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 Specific Test Categories
```bash
# 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
```
### 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:
```ini
[pytest]
markers =
integration: marks tests as integration tests (may require network access)
slow: marks tests as slow running
testpaths = tests
addopts = -v --tb=short
```
### 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:
1. Add unit tests for new functionality
2. Include both success and failure scenarios
3. Mock external dependencies (Wikipedia API)
4. Add integration tests for end-to-end validation
5. 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**:
1. **Use full path to the command** (Recommended):
```json
{
"mcpServers": {
"wikipedia": {
"command": "/home/username/.local/bin/wikipedia-mcp"
}
}
}
```
To find your exact path, run: `which wikipedia-mcp`
2. **Install with pipx for global access**:
```bash
pipx install wikipedia-mcp
```
Then use the standard configuration:
```json
{
"mcpServers": {
"wikipedia": {
"command": "wikipedia-mcp"
}
}
}
```
3. **Create a symlink to a global location**:
```bash
sudo ln -s ~/.local/bin/wikipedia-mcp /usr/local/bin/wikipedia-mcp
```
#### 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](CONTRIBUTING.md) for guidelines.
## License
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
## Connect with the Author
- 🌐 Portfolio: [ravikumar-dev.me](https://ravikumar-dev.me)
- 📝 Blog: [Medium](https://medium.com/@Ravikumar-e)
- 💼 LinkedIn: [in/ravi-kumar-e](https://linkedin.com/in/ravi-kumar-e)
- 🐦 Twitter: [@Ravikumar_d3v](https://twitter.com/Ravikumar_d3v)
Raw data
{
"_id": null,
"home_page": null,
"name": "wikipedia-mcp",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "mcp, wikipedia, model-context-protocol, ai, llm",
"author": null,
"author_email": "Ravi Kumar E <ravikumar@ravikumar-dev.me>",
"download_url": "https://files.pythonhosted.org/packages/a2/03/04683c3ce3c3afb3f2b462dd3b4509cf8a5f68d8cff14b00e513c5c9a477/wikipedia_mcp-1.5.5.tar.gz",
"platform": null,
"description": "# Wikipedia MCP Server\n\n[](https://smithery.ai/server/@Rudra-ravi/wikipedia-mcp)\n\nA 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.\n\n<a href=\"https://glama.ai/mcp/servers/@Rudra-ravi/wikipedia-mcp\">\n <img width=\"380\" height=\"200\" src=\"https://glama.ai/mcp/servers/@Rudra-ravi/wikipedia-mcp/badge\" alt=\"Wikipedia Server MCP server\" />\n</a>\n\n\n\n## Overview\n\nThe 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.\n\n## Verified By\n\n[](https://mseep.ai/app/rudra-ravi-wikipedia-mcp)\n\n## Features\n\n- **Search Wikipedia**: Find articles matching specific queries\n- **Retrieve Article Content**: Get full article text with all information\n- **Article Summaries**: Get concise summaries of articles\n- **Section Extraction**: Retrieve specific sections from articles\n- **Link Discovery**: Find links within articles to related topics\n- **Related Topics**: Discover topics related to a specific article\n- **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).\n- **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.\n- **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.\n- **Optional caching**: Cache API responses for improved performance using --enable-cache\n- **Google ADK Compatibility**: Fully compatible with Google ADK agents and other AI frameworks that use strict function calling schemas\n\n## Installation\n\n### Using pipx (Recommended for Claude Desktop)\n\nThe best way to install for Claude Desktop usage is with pipx, which installs the command globally:\n\n```bash\n# Install pipx if you don't have it\npip install pipx\npipx ensurepath\n\n# Install the Wikipedia MCP server\npipx install wikipedia-mcp\n```\n\nThis ensures the `wikipedia-mcp` command is available in Claude Desktop's PATH.\n\n### Installing via Smithery\n\nTo install wikipedia-mcp for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@Rudra-ravi/wikipedia-mcp):\n\n```bash\nnpx -y @smithery/cli install @Rudra-ravi/wikipedia-mcp --client claude\n```\n\n### From PyPI (Alternative)\n\nYou can also install directly from PyPI:\n\n```bash\npip install wikipedia-mcp\n```\n\n**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](#configuration-for-claude-desktop) section for details.\n\n### Using a virtual environment\n\n```bash\n# Create a virtual environment\npython3 -m venv venv\n\n# Activate the virtual environment\nsource venv/bin/activate\n\n# Install the package\npip install git+https://github.com/rudra-ravi/wikipedia-mcp.git\n```\n\n### From source\n\n```bash\n# Clone the repository\ngit clone https://github.com/rudra-ravi/wikipedia-mcp.git\ncd wikipedia-mcp\n\n# Create a virtual environment\npython3 -m venv wikipedia-mcp-env\nsource wikipedia-mcp-env/bin/activate\n\n# Install in development mode\npip install -e .\n```\n\n## Usage\n\n### Running the server\n\n```bash\n# If installed with pipx\nwikipedia-mcp\n\n# If installed in a virtual environment\nsource venv/bin/activate\nwikipedia-mcp\n\n# Specify transport protocol (default: stdio)\nwikipedia-mcp --transport stdio # For Claude Desktop\nwikipedia-mcp --transport sse # For HTTP streaming\n\n# Specify language (default: en for English)\nwikipedia-mcp --language ja # Example for Japanese\nwikipedia-mcp --language zh-hans # Example for Simplified Chinese\nwikipedia-mcp --language zh-tw # Example for Traditional Chinese (Taiwan)\nwikipedia-mcp --language sr-latn # Example for Serbian Latin script\n\n# Specify country/locale (alternative to language codes)\nwikipedia-mcp --country US # English (United States)\nwikipedia-mcp --country China # Chinese Simplified\nwikipedia-mcp --country Taiwan # Chinese Traditional (Taiwan) \nwikipedia-mcp --country Japan # Japanese\nwikipedia-mcp --country Germany # German\nwikipedia-mcp --country france # French (case insensitive)\n\n# List all supported countries\nwikipedia-mcp --list-countries\n\n# Optional: Specify port for SSE (default 8000)\nwikipedia-mcp --transport sse --port 8080\n\n# Optional: Enable caching\nwikipedia-mcp --enable-cache\n\n# Combine options\nwikipedia-mcp --country Taiwan --enable-cache --transport sse --port 8080\n```\n\n### Configuration for Claude Desktop\n\nAdd the following to your Claude Desktop configuration file:\n\n**Option 1: Using command name (requires `wikipedia-mcp` to be in PATH)**\n```json\n{\n \"mcpServers\": {\n \"wikipedia\": {\n \"command\": \"wikipedia-mcp\"\n }\n }\n}\n```\n\n**Option 2: Using full path (recommended if you get connection errors)**\n```json\n{\n \"mcpServers\": {\n \"wikipedia\": {\n \"command\": \"/full/path/to/wikipedia-mcp\"\n }\n }\n}\n```\n\n**Option 3: With country/language specification**\n```json\n{\n \"mcpServers\": {\n \"wikipedia-us\": {\n \"command\": \"wikipedia-mcp\",\n \"args\": [\"--country\", \"US\"]\n },\n \"wikipedia-taiwan\": {\n \"command\": \"wikipedia-mcp\", \n \"args\": [\"--country\", \"TW\"]\n },\n \"wikipedia-japan\": {\n \"command\": \"wikipedia-mcp\",\n \"args\": [\"--country\", \"Japan\"]\n }\n }\n}\n```\n\nTo find the full path, run: `which wikipedia-mcp`\n\n**Configuration file locations:**\n- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`\n- Windows: `%APPDATA%/Claude/claude_desktop_config.json`\n- Linux: `~/.config/Claude/claude_desktop_config.json`\n\n> **Note**: If you encounter connection errors, see the [Troubleshooting](#common-issues) section for solutions.\n\n## Available MCP Tools\n\nThe Wikipedia MCP server provides the following tools for LLMs to interact with Wikipedia:\n\n### `search_wikipedia`\n\nSearch Wikipedia for articles matching a query.\n\n**Parameters:**\n- `query` (string): The search term\n- `limit` (integer, optional): Maximum number of results to return (default: 10)\n\n**Returns:**\n- A list of search results with titles, snippets, and metadata\n\n### `get_article`\n\nGet the full content of a Wikipedia article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n\n**Returns:**\n- Article content including text, summary, sections, links, and categories\n\n### `get_summary`\n\nGet a concise summary of a Wikipedia article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n\n**Returns:**\n- A text summary of the article\n\n### `get_sections`\n\nGet the sections of a Wikipedia article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n\n**Returns:**\n- A structured list of article sections with their content\n\n### `get_links`\n\nGet the links contained within a Wikipedia article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n\n**Returns:**\n- A list of links to other Wikipedia articles\n\n### `get_related_topics`\n\nGet topics related to a Wikipedia article based on links and categories.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n- `limit` (integer, optional): Maximum number of related topics (default: 10)\n\n**Returns:**\n- A list of related topics with relevance information\n\n### `summarize_article_for_query`\n\nGet a summary of a Wikipedia article tailored to a specific query.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n- `query` (string): The query to focus the summary on\n- `max_length` (integer, optional): Maximum length of the summary (default: 250)\n\n**Returns:**\n- A dictionary containing the title, query, and the focused summary\n\n### `summarize_article_section`\n\nGet a summary of a specific section of a Wikipedia article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n- `section_title` (string): The title of the section to summarize\n- `max_length` (integer, optional): Maximum length of the summary (default: 150)\n\n**Returns:**\n- A dictionary containing the title, section title, and the section summary\n\n### `extract_key_facts`\n\nExtract key facts from a Wikipedia article, optionally focused on a specific topic within the article.\n\n**Parameters:**\n- `title` (string): The title of the Wikipedia article\n- `topic_within_article` (string, optional): A specific topic within the article to focus fact extraction\n- `count` (integer, optional): Number of key facts to extract (default: 5)\n\n**Returns:**\n- A dictionary containing the title, topic, and a list of extracted facts\n\n## Country/Locale Support\n\nThe 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.\n\n### Supported Countries and Regions\n\nUse `--list-countries` to see all supported countries:\n\n```bash\nwikipedia-mcp --list-countries\n```\n\nThis will display countries organized by language, for example:\n\n```\nSupported Country/Locale Codes:\n========================================\n en: US, USA, United States, UK, GB, Canada, Australia, ...\n zh-hans: CN, China\n zh-tw: TW, Taiwan \n ja: JP, Japan\n de: DE, Germany\n fr: FR, France\n es: ES, Spain, MX, Mexico, AR, Argentina, ...\n pt: PT, Portugal, BR, Brazil\n ru: RU, Russia\n ar: SA, Saudi Arabia, AE, UAE, EG, Egypt, ...\n```\n\n### Usage Examples\n\n```bash\n# Major countries by code\nwikipedia-mcp --country US # United States (English)\nwikipedia-mcp --country CN # China (Simplified Chinese)\nwikipedia-mcp --country TW # Taiwan (Traditional Chinese)\nwikipedia-mcp --country JP # Japan (Japanese)\nwikipedia-mcp --country DE # Germany (German)\nwikipedia-mcp --country FR # France (French)\nwikipedia-mcp --country BR # Brazil (Portuguese)\nwikipedia-mcp --country RU # Russia (Russian)\n\n# Countries by full name (case insensitive)\nwikipedia-mcp --country \"United States\"\nwikipedia-mcp --country China\nwikipedia-mcp --country Taiwan \nwikipedia-mcp --country Japan\nwikipedia-mcp --country Germany\nwikipedia-mcp --country france # Case insensitive\n\n# Regional variants\nwikipedia-mcp --country HK # Hong Kong (Traditional Chinese)\nwikipedia-mcp --country SG # Singapore (Simplified Chinese)\nwikipedia-mcp --country \"Saudi Arabia\" # Arabic\nwikipedia-mcp --country Mexico # Spanish\n```\n\n### Country-to-Language Mapping\n\nThe server automatically maps country codes to appropriate Wikipedia language editions:\n\n- **English-speaking**: US, UK, Canada, Australia, New Zealand, Ireland, South Africa \u2192 `en`\n- **Chinese regions**: \n - CN, China \u2192 `zh-hans` (Simplified Chinese)\n - TW, Taiwan \u2192 `zh-tw` (Traditional Chinese - Taiwan)\n - HK, Hong Kong \u2192 `zh-hk` (Traditional Chinese - Hong Kong)\n - SG, Singapore \u2192 `zh-sg` (Simplified Chinese - Singapore)\n- **Major languages**: JP\u2192`ja`, DE\u2192`de`, FR\u2192`fr`, ES\u2192`es`, IT\u2192`it`, RU\u2192`ru`, etc.\n- **Regional variants**: Supports 140+ countries and regions\n\n### Error Handling\n\nIf you specify an unsupported country, you'll get a helpful error message:\n\n```bash\n$ wikipedia-mcp --country INVALID\nError: Unsupported country/locale: 'INVALID'. \nSupported country codes include: US, USA, UK, GB, CA, AU, NZ, IE, ZA, CN. \nUse --language parameter for direct language codes instead.\n\nUse --list-countries to see supported country codes.\n```\n\n## Language Variants\n\nThe 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.\n\n### Supported Language Variants\n\n#### Chinese Language Variants\n- `zh-hans` - Simplified Chinese\n- `zh-hant` - Traditional Chinese \n- `zh-tw` - Traditional Chinese (Taiwan)\n- `zh-hk` - Traditional Chinese (Hong Kong)\n- `zh-mo` - Traditional Chinese (Macau)\n- `zh-cn` - Simplified Chinese (China)\n- `zh-sg` - Simplified Chinese (Singapore)\n- `zh-my` - Simplified Chinese (Malaysia)\n\n#### Serbian Language Variants\n- `sr-latn` - Serbian Latin script\n- `sr-cyrl` - Serbian Cyrillic script\n\n#### Kurdish Language Variants\n- `ku-latn` - Kurdish Latin script\n- `ku-arab` - Kurdish Arabic script\n\n#### Norwegian Language Variants\n- `no` - Norwegian (automatically mapped to Bokm\u00e5l)\n\n### Usage Examples\n\n```bash\n# Access Simplified Chinese Wikipedia\nwikipedia-mcp --language zh-hans\n\n# Access Traditional Chinese Wikipedia (Taiwan)\nwikipedia-mcp --language zh-tw\n\n# Access Serbian Wikipedia in Latin script\nwikipedia-mcp --language sr-latn\n\n# Access Serbian Wikipedia in Cyrillic script\nwikipedia-mcp --language sr-cyrl\n```\n\n### How Language Variants Work\n\nWhen you specify a language variant like `zh-hans`, the server:\n1. Maps the variant to the base Wikipedia language (e.g., `zh` for Chinese variants)\n2. Uses the base language for API connections to the Wikipedia servers\n3. Includes the variant parameter in API requests to get content in the specific variant\n4. Returns content formatted according to the specified variant's conventions\n\nThis approach ensures optimal compatibility with Wikipedia's API while providing access to variant-specific content and formatting.\n\n## Example Prompts\n\nOnce the server is running and configured with Claude Desktop, you can use prompts like:\n\n### General Wikipedia queries:\n- \"Tell me about quantum computing using the Wikipedia information.\"\n- \"Summarize the history of artificial intelligence based on Wikipedia.\"\n- \"What does Wikipedia say about climate change?\"\n- \"Find Wikipedia articles related to machine learning.\"\n- \"Get me the introduction section of the article on neural networks from Wikipedia.\"\n\n### Using country-specific Wikipedia:\n- \"Search Wikipedia China for information about the Great Wall.\" (uses Chinese Wikipedia)\n- \"Tell me about Tokyo from Japanese Wikipedia sources.\"\n- \"What does German Wikipedia say about the Berlin Wall?\"\n- \"Find information about the Eiffel Tower from French Wikipedia.\"\n- \"Get Taiwan Wikipedia's article about Taiwanese cuisine.\"\n\n### Language variant examples:\n- \"Search Traditional Chinese Wikipedia for information about Taiwan.\"\n- \"Find Simplified Chinese articles about modern China.\"\n- \"Get information from Serbian Latin Wikipedia about Belgrade.\"\n\n## MCP Resources\n\nThe server also provides MCP resources (similar to HTTP endpoints but for MCP):\n\n- `search/{query}`: Search Wikipedia for articles matching the query\n- `article/{title}`: Get the full content of a Wikipedia article\n- `summary/{title}`: Get a summary of a Wikipedia article\n- `sections/{title}`: Get the sections of a Wikipedia article\n- `links/{title}`: Get the links in a Wikipedia article\n- `summary/{title}/query/{query}/length/{max_length}`: Get a query-focused summary of an article\n- `summary/{title}/section/{section_title}/length/{max_length}`: Get a summary of a specific article section\n- `facts/{title}/topic/{topic_within_article}/count/{count}`: Extract key facts from an article\n\n## Development\n\n### Local Development Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/rudra-ravi/wikipedia-mcp.git\ncd wikipedia-mcp\n\n# Create a virtual environment\npython3 -m venv venv\nsource venv/bin/activate\n\n# Install the package in development mode\npip install -e .\n\n# Install development and test dependencies\npip install -r requirements-dev.txt\n\n# Run the server\nwikipedia-mcp\n```\n\n### Project Structure\n\n- `wikipedia_mcp/`: Main package\n - `__main__.py`: Entry point for the package\n - `server.py`: MCP server implementation\n - `wikipedia_client.py`: Wikipedia API client\n - `api/`: API implementation\n - `core/`: Core functionality\n - `utils/`: Utility functions\n- `tests/`: Test suite\n - `test_basic.py`: Basic package tests\n - `test_cli.py`: Command-line interface tests\n - `test_server_tools.py`: Comprehensive server and tool tests\n\n## Testing\n\nThe project includes a comprehensive test suite to ensure reliability and functionality.\n\n### Test Structure\n\nThe test suite is organized in the `tests/` directory with the following test files:\n\n- **`test_basic.py`**: Basic package functionality tests\n- **`test_cli.py`**: Command-line interface and transport tests\n- **`test_server_tools.py`**: Comprehensive tests for all MCP tools and Wikipedia client functionality\n\n### Running Tests\n\n#### Run All Tests\n```bash\n# Install test dependencies\npip install -r requirements-dev.txt\n\n# Run all tests\npython -m pytest tests/ -v\n\n# Run tests with coverage\npython -m pytest tests/ --cov=wikipedia_mcp --cov-report=html\n```\n\n#### Run Specific Test Categories\n```bash\n# Run only unit tests (excludes integration tests)\npython -m pytest tests/ -v -m \"not integration\"\n\n# Run only integration tests (requires internet connection)\npython -m pytest tests/ -v -m \"integration\"\n\n# Run specific test file\npython -m pytest tests/test_server_tools.py -v\n```\n\n### Test Categories\n\n#### Unit Tests\n- **WikipediaClient Tests**: Mock-based tests for all client methods\n - Search functionality\n - Article retrieval\n - Summary extraction\n - Section parsing\n - Link extraction\n - Related topics discovery\n- **Server Tests**: MCP server creation and tool registration\n- **CLI Tests**: Command-line interface functionality\n\n#### Integration Tests\n- **Real API Tests**: Tests that make actual calls to Wikipedia API\n- **End-to-End Tests**: Complete workflow testing\n\n### Test Configuration\n\nThe project uses `pytest.ini` for test configuration:\n\n```ini\n[pytest]\nmarkers =\n integration: marks tests as integration tests (may require network access)\n slow: marks tests as slow running\n\ntestpaths = tests\naddopts = -v --tb=short\n```\n\n### Continuous Integration\n\nAll tests are designed to:\n- Run reliably in CI/CD environments\n- Handle network failures gracefully\n- Provide clear error messages\n- Cover edge cases and error conditions\n\n### Adding New Tests\n\nWhen contributing new features:\n\n1. Add unit tests for new functionality\n2. Include both success and failure scenarios\n3. Mock external dependencies (Wikipedia API)\n4. Add integration tests for end-to-end validation\n5. Follow existing test patterns and naming conventions\n\n## Troubleshooting\n\n### Common Issues\n\n#### Claude Desktop Connection Issues\n\n**Problem**: Claude Desktop shows errors like `spawn wikipedia-mcp ENOENT` or cannot find the command.\n\n**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.\n\n**Solutions**:\n\n1. **Use full path to the command** (Recommended):\n ```json\n {\n \"mcpServers\": {\n \"wikipedia\": {\n \"command\": \"/home/username/.local/bin/wikipedia-mcp\"\n }\n }\n }\n ```\n \n To find your exact path, run: `which wikipedia-mcp`\n\n2. **Install with pipx for global access**:\n ```bash\n pipx install wikipedia-mcp\n ```\n Then use the standard configuration:\n ```json\n {\n \"mcpServers\": {\n \"wikipedia\": {\n \"command\": \"wikipedia-mcp\"\n }\n }\n }\n ```\n\n3. **Create a symlink to a global location**:\n ```bash\n sudo ln -s ~/.local/bin/wikipedia-mcp /usr/local/bin/wikipedia-mcp\n ```\n\n#### Other Issues\n\n- **Article Not Found**: Check the exact spelling of article titles\n- **Rate Limiting**: Wikipedia API has rate limits; consider adding delays between requests\n- **Large Articles**: Some Wikipedia articles are very large and may exceed token limits\n\n## Understanding the Model Context Protocol (MCP)\n\nThe Model Context Protocol (MCP) is not a traditional HTTP API but a specialized protocol for communication between LLMs and external tools. Key characteristics:\n\n- Uses stdio (standard input/output) or SSE (Server-Sent Events) for communication\n- Designed specifically for AI model interaction\n- Provides standardized formats for tools, resources, and prompts\n- Integrates directly with Claude and other MCP-compatible AI systems\n\nClaude Desktop acts as the MCP client, while this server provides the tools and resources that Claude can use to access Wikipedia information.\n\n## Contributing\n\nContributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n\n## Connect with the Author\n\n- \ud83c\udf10 Portfolio: [ravikumar-dev.me](https://ravikumar-dev.me)\n- \ud83d\udcdd Blog: [Medium](https://medium.com/@Ravikumar-e)\n- \ud83d\udcbc LinkedIn: [in/ravi-kumar-e](https://linkedin.com/in/ravi-kumar-e)\n- \ud83d\udc26 Twitter: [@Ravikumar_d3v](https://twitter.com/Ravikumar_d3v) \n",
"bugtrack_url": null,
"license": null,
"summary": "MCP server for Wikipedia API",
"version": "1.5.5",
"project_urls": {
"Documentation": "https://github.com/rudra-ravi/wikipedia-mcp#readme",
"Homepage": "https://github.com/rudra-ravi/wikipedia-mcp",
"Issues": "https://github.com/rudra-ravi/wikipedia-mcp/issues",
"Repository": "https://github.com/rudra-ravi/wikipedia-mcp"
},
"split_keywords": [
"mcp",
" wikipedia",
" model-context-protocol",
" ai",
" llm"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bbd86b77393548d1134201ed0819a717eebf73e697b6dcdc82aa57a8f8862df1",
"md5": "4b568b6ae52e504067ae567d9d8b2c95",
"sha256": "6ce194b1c5b85302703fe90abaa977a43e8d26c4867eed6350740de1c60594d4"
},
"downloads": -1,
"filename": "wikipedia_mcp-1.5.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "4b568b6ae52e504067ae567d9d8b2c95",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 19183,
"upload_time": "2025-07-25T05:59:20",
"upload_time_iso_8601": "2025-07-25T05:59:20.215173Z",
"url": "https://files.pythonhosted.org/packages/bb/d8/6b77393548d1134201ed0819a717eebf73e697b6dcdc82aa57a8f8862df1/wikipedia_mcp-1.5.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a20304683c3ce3c3afb3f2b462dd3b4509cf8a5f68d8cff14b00e513c5c9a477",
"md5": "0fd1ae57b2e16675bae7e4fe2001fa76",
"sha256": "865ed588e392b508eca44748505db0077cd2ab0d530208af2ead9cda83cb2331"
},
"downloads": -1,
"filename": "wikipedia_mcp-1.5.5.tar.gz",
"has_sig": false,
"md5_digest": "0fd1ae57b2e16675bae7e4fe2001fa76",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 37880,
"upload_time": "2025-07-25T05:59:22",
"upload_time_iso_8601": "2025-07-25T05:59:22.410919Z",
"url": "https://files.pythonhosted.org/packages/a2/03/04683c3ce3c3afb3f2b462dd3b4509cf8a5f68d8cff14b00e513c5c9a477/wikipedia_mcp-1.5.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-25 05:59:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rudra-ravi",
"github_project": "wikipedia-mcp#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"requirements": [
{
"name": "fastmcp",
"specs": [
[
">=",
"2.3.0"
]
]
},
{
"name": "wikipedia-api",
"specs": [
[
">=",
"0.8.0"
]
]
},
{
"name": "requests",
"specs": [
[
">=",
"2.31.0"
]
]
},
{
"name": "python-dotenv",
"specs": [
[
">=",
"1.0.0"
]
]
}
],
"lcname": "wikipedia-mcp"
}