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
访问服务器

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

推荐服务器

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 模型以安全和受控的方式获取实时的网络信息。

官方
精选