Minimal TypeScript-based HTTP server exposing Wikipedia search and page retrieval via MediaWiki API
Documentation
Wikipedia MCP Server
A comprehensive Model Context Protocol (MCP) server providing access to Wikipedia content with intelligent caching, batch operations, and advanced search capabilities for local development.
Certification
**This MCP server is certified by MCP Review** - your trusted platform for discovering and evaluating Model Context Protocol servers.
Features
Core MCP Tools
- **
search** - Enhanced search with snippet control and pagination - **
getPage** - Full page content with configurable sections, images, links, and categories - **
getPageById** - Page retrieval by ID with the same enhancement options - **
getPageSummary** - Fast page summaries via the Wikipedia REST API - **
random** - Random article discovery - **
pageLanguages** - Lists available languages for a given page
Advanced MCP Tools
- **
batchSearch** - Search multiple queries simultaneously for efficiency - **
batchGetPages** - Retrieve multiple pages at once with concurrency control - **
searchNearby** - Find Wikipedia articles near specific coordinates - **
getPagesInCategory** - Browse pages within Wikipedia categories
Performance & Reliability
- Intelligent Caching - Memory-based caching for improved performance
- Request Optimization - Endpoint rotation and intelligent routing
- Error Handling - Robust error handling with retry logic
- TypeScript - Fully typed with strict error handling
- Comprehensive Testing - Jest test suite with health validations
Installation
1. Clone or download this repository
2. Install dependencies:
npm install3. Build the project:
npm run buildConfiguration
Add the Wikipedia MCP server to your MCP client configuration:
{
"mcpServers": {
"wikipedia": {
"command": "node",
"args": ["/path/to/wikipedia-mcp-server/index.js"],
"env": {
"CACHE_MAX": "500",
"CACHE_TTL": "300000",
"DEFAULT_LANGUAGE": "en",
"ENABLE_DEDUPLICATION": "true"
}
}
}
}Note: Replace /path/to/wikipedia-mcp-server with your actual path to the wikipedia-mcp-server directory.
Environment Variables
CACHE_MAX: Maximum number of items in memory cache (default: 100)CACHE_TTL: Cache TTL in milliseconds (default: 300000 = 5 minutes)DEFAULT_LANGUAGE: Default Wikipedia language (default: en)ENABLE_DEDUPLICATION: Enable request deduplication (default: true)USER_AGENT: Custom user agent for Wikipedia API requests
Running Locally
Start the server using npm:
npm startThis starts the MCP server that communicates via stdio, perfect for integration with MCP clients like Cursor.
Available Tools
Core MCP Tools
- **
search** - Enhanced search with snippet control and pagination - **
getPage** - Full page content with configurable sections, images, links, and categories - **
getPageById** - Page retrieval by ID with the same enhancement options - **
getPageSummary** - Fast page summaries via the Wikipedia REST API - **
random** - Random article discovery - **
pageLanguages** - Lists available languages for a given page
Advanced MCP Tools
- **
batchSearch** - Search multiple queries simultaneously for efficiency - **
batchGetPages** - Retrieve multiple pages at once with concurrency control - **
searchNearby** - Find Wikipedia articles near specific coordinates - **
getPagesInCategory** - Browse pages within Wikipedia categories
Available Resources
Wikipedia MCP Server provides 7 specialized dynamic resources that offer cached Wikipedia data and intelligent content access. These are URI-based resources that can be accessed directly by constructing the appropriate URI pattern.
Note: These resources are dynamic and do not appear in standard resources/list calls. Access them directly using resources/read with the URI patterns below:
wikipedia://article/{title}/{lang}
Returns cached full content of a Wikipedia article with metadata and revision information.
Resource Details:
- Purpose: Access complete article content with local caching
- Benefits: Faster article loading and reduced API calls
- Use Cases: Article reading, content analysis, research workflows
Response Format:
{
"title": "Artificial Intelligence",
"lang": "en",
"content": {
"pageid": 1164,
"ns": 0,
"title": "Artificial Intelligence",
"revisions": [...],
"links": [...],
"categories": [...]
},
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://search/cache/{query}
Provides cached search results for Wikipedia queries with snippets and metadata.
Resource Details:
- Purpose: Cache search operations for improved performance
- Benefits: Fast repeated searches and reduced API usage
- Use Cases: Research queries, content discovery, topic exploration
Response Format:
{
"query": "machine learning",
"results": [
{
"pageid": 233488,
"title": "Machine learning",
"snippet": "Machine learning is a method of data analysis that automates analytical model building..."
}
],
"totalResults": 1500,
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://metadata/{title}
Offers comprehensive metadata for Wikipedia articles including categories, links, and references.
Resource Details:
- Purpose: Access rich metadata without full article content
- Benefits: Lightweight metadata queries and relationship discovery
- Use Cases: Citation analysis, category exploration, link analysis
Response Format:
{
"title": "Machine Learning",
"pageid": 233488,
"ns": 0,
"revid": 123456789,
"lastModified": "2025-11-02T15:30:00Z",
"categories": [
{ "ns": 14, "title": "Category:Machine learning" }
],
"links": [
{ "ns": 0, "title": "Artificial intelligence" }
],
"references": ["https://doi.org/10.1038/nature14539"],
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://categories/{title}
Provides category hierarchy and related articles for Wikipedia categories.
Resource Details:
- Purpose: Explore category structures and related content
- Benefits: Topic discovery and content organization
- Use Cases: Topic research, content curation, knowledge organization
Response Format:
{
"category": "Machine learning",
"memberCount": 150,
"members": [
{ "pageid": 123, "ns": 0, "title": "Neural network" }
],
"subcategories": [
{ "pageid": 456, "ns": 14, "title": "Category:Deep learning" }
],
"articles": [
{ "pageid": 789, "ns": 0, "title": "Supervised learning" }
],
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://languages/{title}
Shows available language variants for a Wikipedia article.
Resource Details:
- Purpose: Discover multilingual content availability
- Benefits: Language coverage analysis and translation discovery
- Use Cases: Multilingual research, translation workflows, content localization
Response Format:
{
"title": "Machine Learning",
"languageCount": 47,
"languages": [
{
"lang": "es",
"title": "Aprendizaje automático",
"url": "https://es.wikipedia.org/wiki/Aprendizaje_automático"
},
{
"lang": "fr",
"title": "Apprentissage automatique",
"url": "https://fr.wikipedia.org/wiki/Apprentissage_automatique"
}
],
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://related/{title}
Lists related articles and see-also links for a Wikipedia article.
Resource Details:
- Purpose: Discover related content and connections
- Benefits: Content discovery and research expansion
- Use Cases: Research expansion, content recommendations, topic exploration
Response Format:
{
"title": "Machine Learning",
"seeAlsoLinks": [
{ "ns": 0, "title": "Data mining" },
{ "ns": 0, "title": "Pattern recognition" }
],
"relatedArticles": [
"Artificial intelligence",
"Statistics",
"Computer science"
],
"categories": [
{ "ns": 14, "title": "Category:Machine learning" }
],
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}wikipedia://summary/{title}
Delivers cached summary and key facts for a Wikipedia article.
Resource Details:
- Purpose: Get article essence without full content
- Benefits: Quick information retrieval and content preview
- Use Cases: Content preview, fact-checking, quick reference, research planning
Response Format:
{
"title": "Machine Learning",
"summary": "Machine learning is a method of data analysis that automates analytical model building...",
"keyFacts": {
"Developed": "1950s",
"Key figures": ["Arthur Samuel", "Tom Mitchell"],
"Applications": ["Computer vision", "Natural language processing"]
},
"pageid": 233488,
"lastModified": "2025-11-02T15:30:00Z",
"wordCount": 1250,
"cached": false,
"timestamp": "2025-11-02T17:09:14.866Z"
}Usage Examples
Once configured in your MCP client (like Cursor), you can use natural language to interact with Wikipedia:
- "Search for articles about artificial intelligence"
- "Get the Wikipedia page for Machine Learning"
- "Find Wikipedia articles near New York City"
- "Show me the summary of Albert Einstein"
- "What languages is the Python programming language article available in?"
Accessing Resources
Resources can be accessed directly using the MCP resources/read method:
{
"jsonrpc": "2.0",
"method": "resources/read",
"params": {
"uri": "wikipedia://summary/Albert Einstein"
},
"id": 1
}Common Resource URIs:
wikipedia://summary/{title}- Get article summarywikipedia://article/{title}/{lang}- Get full article contentwikipedia://metadata/{title}- Get article metadatawikipedia://languages/{title}- Get available languageswikipedia://categories/{title}- Get category informationwikipedia://related/{title}- Get related articleswikipedia://search/cache/{query}- Get cached search results
Testing
The server includes a comprehensive Jest test suite:
npm testTest Coverage:
- Service instantiation and method availability
- Wikipedia service integration
- Type safety and error handling
License
MIT License - see LICENSE file for details.
Similar MCP
Based on tags & features
Trending MCP
Most active this week