
Wikipedia MCP
โ 2from Ravishka17
A remote MCP server for Wikipedia.
Wikipedia MCP Server
A Model Context Protocol (MCP) server that provides comprehensive Wikipedia access for AI assistants. Built in TypeScript, deployed on Vercel, and fully compatible with the MCP Streamable HTTP transport (protocol version 2025-03-26).
Features
- ๐ Advanced Search โ find articles with relevance ranking
- ๐ Full Article Access โ plain text extracts or complete wikitext
- ๐ Smart Summaries โ concise summaries tailored to a specific query
- ๐๏ธ Section Analysis โ extract and summarize individual sections
- ๐ Link Discovery โ internal links and related articles
- ๐ Multi-language โ 50+ language codes, 140+ country codes, resolved automatically
- ๐ Parallel Search โ
multi_search_wikipediaruns multiple queries simultaneously - ๐ฏ Fact Extraction โ structured key-fact lists from any article
- ๐ Coordinates โ lat/lon for geographic articles
- โก Streamable HTTP โ full MCP transport support (POST + GET SSE + DELETE)
- ๐ Security hardened โ input sanitization, tiered rate limiting, no
Serverheader - ๐ Vercel ready โ stateless serverless deployment, zero cold-start friction
MCP Tools
All 13 tools accept optional language (e.g. "ja") and country (e.g. "JP") parameters. When set, the query is sent as-is to that language's Wikipedia endpoint (e.g. ja.wikipedia.org). Wikipedia's own search can often match a short English title phrase to the correct local article, but there is no translation layer in this server.
Tool reference
| Tool | Description |
|---|---|
search_wikipedia | Search by keyword in one language |
multi_search_wikipedia | Run multiple searches across multiple languages in parallel |
get_article | Full article โ plain text extract, or wikitext with full: true |
get_summary | Introductory summary only |
get_sections | Table of contents (section titles + levels) |
get_links | All internal wikilinks in an article |
get_coordinates | Latitude/longitude for geographic articles |
get_related_topics | Related articles via link graph |
summarize_article_for_query | Summary focused on a specific question |
summarize_article_section | Summary of one named section |
extract_key_facts | Bullet-list of key facts |
test_wikipedia_connectivity | API diagnostics + auth status |
list_supported_countries | All supported language and country codes |
MCP Prompts
Three prompt templates are registered and available via prompts/list / prompts/get:
| Prompt | Description |
|---|---|
search_in_native_language | Query format guidance for non-English Wikipedia |
wikipedia_usage_guide | Full guide covering all tools and best practices |
multilingual_research | Step-by-step guide for cross-language research |
REST API
Standard HTTP endpoints for non-MCP usage:
GET /health
GET /search/:query?limit=10
GET /article/:title
GET /summary/:title
GET /sections/:title
GET /links/:title
GET /coordinates/:title
GET /related/:title?limit=10
GET /summary/:title/query/:query/length/:maxLength
GET /summary/:title/section/:section/length/:maxLength
GET /facts/:title?topic=...&count=5
GET /test-connectivity
GET /supported-countries
POST /tools/:toolNameArchitecture
src/
โโโ server.ts # Express app wiring
โโโ routes/
โ โโโ mcp.ts # Streamable HTTP transport (POST + GET SSE + DELETE)
โ โโโ rest.ts # REST endpoints
โโโ mcp-server.ts # MCPServer helper โ tool dispatch, language routing
โโโ handlers.ts # Tool handler functions
โโโ toolRegistrations.ts # SDK tool + prompt registration
โโโ toolDefinitions.ts # JSON Schema definitions (for REST /mcp info)
โโโ prompts.ts # Prompt template logic
โโโ wikipedia-client.ts # Wikipedia Action API client
โโโ sanitize.ts # Input sanitization
โโโ middleware.ts # Rate limiting, Server header removal
โโโ utils.ts # Shared helpers
โโโ types.ts # TypeScript interfacesTransport design
The server uses stateless Streamable HTTP โ the correct mode for serverless platforms:
POST /mcpโ receives JSON-RPC messages, returns JSON or SSE streamGET /mcpโ opens an SSE channel for server-initiated messages (clients reconnect on timeout)DELETE /mcpโ session termination (acknowledged; no server-side sessions to clean up)
A fresh McpServer + StreamableHTTPServerTransport instance is created for each request. All Wikipedia logic is handled by the shared, stateless MCPServer helper.
Development
npm install
npm run dev # tsx watch mode on port 8000
npm run build # tsc โ dist/
npm start # node dist/server.js
vercel dev # local Vercel simulationBot authentication
For higher Wikipedia API rate limits, create a bot password:
- Log in to your Wikipedia account
- Go to Special:BotPasswords
- Create a new bot password
- Set
WIKIPEDIA_BOT_USERNAME=YourAccount@BotNameandWIKIPEDIA_BOT_PASSWORD=...
npm install
npm run dev # tsx watch mode on port 8000
npm run build # tsc โ dist/
npm start # node dist/server.js
vercel dev # local Vercel simulationQuick Start
1. Deploy
git clone https://github.com/YOUR_USERNAME/wikipedia-mcp-vercel.git
cd wikipedia-mcp-vercel
vercelOr use the Deploy with Vercel button above.
2. Connect your AI client
The server implements MCP Streamable HTTP transport (2025-03-26).
Both the POST channel (client โ server) and the GET SSE channel (server โ client) are supported.
MCP endpoint: https://your-app.vercel.app/mcp
Claude Desktop
{
"mcpServers": {
"wikipedia": {
"type": "http",
"url": "https://your-app.vercel.app/mcp"
}
}
}Claude Code / CLI
claude mcp add wikipedia --transport http https://your-app.vercel.app/mcpAny MCP client (generic)
Configure the client with transport type streamable-http and the endpoint URL above.
The server uses stateless mode (no Mcp-Session-Id header), which is correct and expected for serverless deployments.
3. Environment variables (optional)
| Variable | Default | Description |
|---|---|---|
WIKIPEDIA_LANGUAGE | en | Wikipedia language code (e.g. ja, es, de) |
WIKIPEDIA_COUNTRY | US | Country code โ language mapping (e.g. JP, CN, LK) |
ENABLE_CACHE | false | In-memory cache (useful for local dev) |
WIKIPEDIA_BOT_USERNAME | โ | Bot account username (Account@BotName) |
WIKIPEDIA_BOT_PASSWORD | โ | Bot account password |
PORT | 8000 | Local dev port (ignored by Vercel) |
Copy .env.example โ .env for local development.
4. Verify
# Health check
curl https://your-app.vercel.app/health
# Test MCP initialize
curl -X POST https://your-app.vercel.app/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}}}'No common issues documented yet. If you hit a problem, the repository's GitHub Issues page is the best place to look.
License
MIT