WikiCleanHTML

WikiCleanHTML

Fetches Wikipedia articles and returns cleaned, readable HTML stripped of citations, infoboxes, navboxes, and other clutter. Enables fetching specific articles or random ones with options to keep images, tables, or links.

Category
Visit Server

README

WikiCleanHTML

An MCP server that fetches Wikipedia articles and returns cleaned, readable HTML — stripped of citations, infoboxes, navboxes, edit sections, and other clutter.

Also includes a standalone browser UI (index.html) that works without any server.

Features

  • Fetches any Wikipedia article by title, or a random one
  • Strips Wikipedia-specific clutter: citations [1], edit sections, infoboxes, navboxes, TOC, metadata
  • Sanitizes output HTML with a strict tag/attribute allowlist
  • Normalizes relative links to absolute Wikipedia URLs
  • Saves cleaned HTML + plain text to local files
  • Options to keep/remove images, tables, and links

Quick Start — MCP Server

1. Clone and install

git clone https://github.com/alavna/wikicleanhtml.git
cd wikicleanhtml
python -m venv .venv && source .venv/bin/activate
pip install -r requirements.txt

2. Register with Claude Code

claude mcp add --scope user wikicleanhtml -- /path/to/wikicleanhtml/.venv/bin/python /path/to/wikicleanhtml/mcp_server.py

Or manually add to your MCP config:

{
  "mcpServers": {
    "wikicleanhtml": {
      "command": "/path/to/wikicleanhtml/.venv/bin/python",
      "args": ["/path/to/wikicleanhtml/mcp_server.py"]
    }
  }
}

3. Use it

In Claude Code, just say:

"Fetch the Wikipedia article on Insulin"

Claude calls wiki_fetch_article(title="Insulin") and gets back:

{
  "title": "Insulin",
  "source_url": "https://en.wikipedia.org/wiki/Insulin",
  "html_file": "~/.wikicleanhtml/articles/Insulin.html",
  "text_file": "~/.wikicleanhtml/articles/Insulin.txt",
  "html_length": 45230,
  "text_length": 28100,
  "removed": { "references": 142, "infoboxes": 1, "navboxes": 4, "tables": 3 }
}

The cleaned article is saved locally — Claude can read the file if needed, without loading raw Wikipedia HTML into context.

MCP Tools

Tool Description
wiki_fetch_article Fetch a specific article by title
wiki_fetch_random Fetch a random Wikipedia article

Options (all tools):

Parameter Type Default Description
title string required Wikipedia article title (fetch_article only)
keep_images bool false Preserve <img> tags
keep_tables bool false Preserve <table> elements
keep_links bool true Preserve <a> hyperlinks (text always kept)

Output files are saved to ~/.wikicleanhtml/articles/.

Browser UI

Open index.html directly in any browser. No server needed — it fetches from Wikipedia's CORS-enabled API and cleans client-side with DOMPurify.

What gets removed

Clutter Selector examples
Citation markers sup.reference ([1], [2], ...)
Edit sections .mw-editsection
Hatnotes .hatnote
Infoboxes .infobox
Navigation boxes .navbox
Table of contents #toc, .toc
Reference lists .reflist, .references
Message boxes .ambox, .tmbox, etc.
Category links #catlinks
Scripts, styles, metadata script, style, meta, link

What gets preserved

Headings (h1-h4), paragraphs, lists (ul/ol/li), links, emphasis (strong/em), code/pre, blockquote, br/hr.

All output is sanitized through a strict allowlist — no inline styles, event handlers, scripts, iframes, or unknown tags survive.

Tests

cd wikicleanhtml
source .venv/bin/activate
pytest tests/ -v

23 unit tests covering: reference removal, edit section removal, hatnote removal, infobox/navbox removal, TOC removal, image/table toggling, XSS sanitization, link normalization, structure preservation, and plain text extraction.

Wikimedia API Etiquette

This tool follows Wikimedia API guidelines:

  • User-Agent: All requests include a descriptive User-Agent header
  • Rate: One Wikipedia request per tool call — no bulk fetching
  • Caching: Articles are saved to disk; re-read the file instead of re-fetching
  • Not intended for high-traffic or production use without Wikimedia approval

Project Structure

wikicleanhtml/
├── mcp_server.py      # MCP server entry point (2 tools)
├── cleaner.py         # HTML cleaning/sanitization logic
├── index.html         # Standalone browser UI
├── requirements.txt   # Python dependencies
├── tests/
│   └── test_cleaner.py
└── README.md

License

MIT

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured