WikiCleanHTML
Fetches Wikipedia articles and returns cleaned, sanitized HTML by stripping citations, infoboxes, navboxes, and other clutter. Supports fetching specific articles by title or random articles, with options to keep images, tables, and links.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@WikiCleanHTMLFetch the Wikipedia article on Artificial intelligence"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
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, metadataSanitizes 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
Related MCP server: mcp-wikipedia
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.txt2. Register with Claude Code
claude mcp add --scope user wikicleanhtml -- /path/to/wikicleanhtml/.venv/bin/python /path/to/wikicleanhtml/mcp_server.pyOr 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 |
| Fetch a specific article by title |
| Fetch a random Wikipedia article |
Options (all tools):
Parameter | Type | Default | Description |
| string | required | Wikipedia article title (fetch_article only) |
| bool |
| Preserve |
| bool |
| Preserve |
| bool |
| Preserve |
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 |
|
Edit sections |
|
Hatnotes |
|
Infoboxes |
|
Navigation boxes |
|
Table of contents |
|
Reference lists |
|
Message boxes |
|
Category links |
|
Scripts, styles, metadata |
|
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/ -v23 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-AgentheaderRate: 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.mdLicense
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Search Wikipedia, read summaries and full text, target sections, find nearby pages, list languages.
Wikipedia MCP — wraps Wikipedia REST API (free, no auth)
Wikipedia, Wikidata and Wiktionary as clean JSON, not HTML. 1.9M searchable. Free, no auth.
Read any web page as clean Markdown for AI agents: fetch, search, metadata, links. SSRF-safe.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceFetches web pages and converts them to clean, readable markdown format by extracting main content while removing navigation, ads, and other non-essential elements to minimize token usage.4-
- AlicenseNot gradedqualityCmaintenanceWraps the Wikipedia REST API to allow AI agents to query Wikipedia content without authentication.6 npmMIT
- FlicenseNot gradedqualityDmaintenanceEnables searching and retrieving Wikipedia content across multiple languages, including article summaries, sections, coordinates, and related topics.-
- FlicenseNot gradedqualityDmaintenanceFetches webpages and returns clean, structured Markdown with metadata (title, author, publish date, description, domain, word count).-