Wikipedia MCP Server

Wikipedia MCP Server

Provides comprehensive Wikipedia access for AI assistants via MCP Streamable HTTP transport, enabling search, article retrieval, summaries, section analysis, link discovery, and multi-language support.

Category
访问服务器

README

Wikipedia MCP Server

Deploy with Vercel

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 Searchmulti_search_wikipedia runs 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 Server header
  • 🚀 Vercel ready — stateless serverless deployment, zero cold-start friction

Quick Start

1. Deploy

git clone https://github.com/YOUR_USERNAME/wikipedia-mcp-vercel.git
cd wikipedia-mcp-vercel
vercel

Or 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/mcp

Any 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"}}}'

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/:toolName

Architecture

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 interfaces

Transport design

The server uses stateless Streamable HTTP — the correct mode for serverless platforms:

  • POST /mcp — receives JSON-RPC messages, returns JSON or SSE stream
  • GET /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 simulation

Bot authentication

For higher Wikipedia API rate limits, create a bot password:

  1. Log in to your Wikipedia account
  2. Go to Special:BotPasswords
  3. Create a new bot password
  4. Set WIKIPEDIA_BOT_USERNAME=YourAccount@BotName and WIKIPEDIA_BOT_PASSWORD=...

License

MIT

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选