Skip to main content

mcp-server-wikipedia 📚

PyPI version License: MIT CI

This project exposes Wikipedia as an MCP server using a Progressive Retrieval Strategy. It is designed to minimize token usage by allowing LLMs to "scout" information before fetching large bodies of text.

PyPI Downloads Breakdown and Trend
Analytics powered by pypi.builditwithai.xyz

The Problem: Token Waste

Wikipedia integrations often fetch multiple full pages up front, then decide what mattered. This fills the context window with irrelevant data and increases latency and cost.

The Solution: The Librarian Philosophy

This server implements a "Progressive Retrieval Ladder." Like a librarian helping you find a specific book, it encourages the model to:

  1. Search for several candidate titles.
  2. Summarize the candidates to find the right one.
  3. Inspect the TOC to find the relevant section.
  4. Fetch only the specific section OR the full page only if necessary.
graph TD
    A[Search Articles] --> B[Get Summaries]
    B --> C{Correct Page?}
    C -- No --> A
    C -- Yes --> D[Get TOC]
    D --> E[Get Section / Page]

Tools

  • search_articles(query, limit=5): Top matching pages with snippets.
  • get_summaries(titles): Compact summaries for multiple candidate pages.
  • get_toc(title): Table of contents / section map for a page.
  • get_section(title, section): Retrieve a single section by index or title.
  • get_page(title): Retrieve the full plain-text page.

Token Efficiency Benchmark

In deterministic testing, this progressive strategy achieves up to 80% token reduction compared to naive full-page retrieval. Detailed results can be found in BENCHMARK.md.

Strategy Token Usage (Avg)
Naive (Full Page) ~100%
MCP (Progressive) ~20%

Quick Start

Installation

From PyPI:

pip install mcp-server-wikipedia

Or run it directly via npx (if using the JS wrapper) or the python entry point:

python -m mcp_server_wikipedia

For development:

git clone https://github.com/surendranb/wikipedia-mcp-server.git
cd wikipedia-mcp-server
python3 -m venv .venv
source .venv/bin/activate
pip install -e .

Run

wikipedia-mcp-server

MCP Client Configuration

Claude Desktop

Add this to your claude_desktop_config.json:

{
  "mcpServers": {
    "wikipedia": {
      "command": "wikipedia-mcp-server"
    }
  }
}

Cursor / VS Code

Specify the wikipedia-mcp-server command in your MCP settings.

Example Prompts

  • "Search for 'photosynthesis light dependent reactions' and summarize the top 3 candidates."
  • "What molecules are produced during the light-dependent reactions of photosynthesis? Search first, then fetch only the relevant section."

Telemetry & Privacy

This server collects anonymous usage telemetry (like GA4 MCP and other sibling servers) so we can find and fix where the tools fall short: a random, resettable installation UUID, server version, OS, Python version, agent/client name, tool name, latency, result size, and error category. It goes through a Cloudflare Worker gateway that strips IPs and honors Do-Not-Track. No search queries, no page titles, no page content, no PII, no IPs — ever.

Opt out any time — any one of these works:

export WIKIPEDIA_MCP_TELEMETRY=false
# or
export DISABLE_TELEMETRY=1
# or
export DO_NOT_TRACK=1
# or
export NO_TELEMETRY=1

When opted out, nothing is sent and no local state is written (no ~/.wikipedia_mcp/ files, no process inspection). Delete ~/.wikipedia_mcp/ at any time to reset the anonymous installation id.

Development

Run tests:

python -m unittest discover -s tests -p "test_*.py" -v

Run benchmarks:

pip install -e ".[benchmark]"
python scripts/benchmark_token_efficiency.py

Contributing

We value simplicity and surgical efficiency. If you have an improvement that maintains the single-file architecture and enhances retrieval precision, we welcome your input. See CONTRIBUTING.md.

License

MIT License. See LICENSE for details.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcp_server_wikipedia-0.3.0.tar.gz (22.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcp_server_wikipedia-0.3.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file mcp_server_wikipedia-0.3.0.tar.gz.

File metadata

  • Download URL: mcp_server_wikipedia-0.3.0.tar.gz
  • Upload date:
  • Size: 22.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mcp_server_wikipedia-0.3.0.tar.gz
Algorithm Hash digest
SHA256 21a510fe27fd8ed90a972763237702e1e0cc4b3fd61e317c90248ca9a5ebe545
MD5 84953e6357af9a6bf1033189c2a2a856
BLAKE2b-256 cb313b0a26789c19a5d06916a9fca526a988034b95bc316dabaec17ed8b696fc

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_wikipedia-0.3.0.tar.gz:

Publisher: publish.yml on surendranb/wikipedia-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mcp_server_wikipedia-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for mcp_server_wikipedia-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7d70579a3e6dadc5c57bafa066c92dc4ad33fad759bf2df39b3bca23178859b7
MD5 48af61163873351ac7a4a51909254a7d
BLAKE2b-256 05c8dca98f94fcfef6b66836c3472a3108fc3636ec2541c50d3ed99dbd5b0a7f

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcp_server_wikipedia-0.3.0-py3-none-any.whl:

Publisher: publish.yml on surendranb/wikipedia-mcp-server

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.0

2 files

This release

0.3.0 This release

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page