Websearch MCP Server
Enables web searching via DuckDuckGo and page fetching with automatic HTML-to-Markdown conversion to reduce LLM token usage by approximately 60%. It provides tools for search, content extraction, and combined operations without requiring any external API keys.
README
Websearch MCP Server
An MCP server for web search and page fetching. Converts HTML to clean markdown using html-to-markdown (Rust-based, ~200 MB/s), cutting token usage by ~60% when LLMs consume web content.
No API keys required — search is powered by DuckDuckGo.
Token Savings
Run uv run python benchmark.py to reproduce. Results from fetching real pages:
| Page | HTML tokens | MD tokens | Saved |
|---|---|---|---|
| GitHub Blog | 90,829 | 50,733 | 44% |
| Hacker News | 11,884 | 4,381 | 63% |
| MDN — JavaScript | 51,862 | 23,326 | 55% |
| BBC News | 123,997 | 28,918 | 77% |
| Go pkg — net/http | 119,994 | 60,344 | 50% |
| Python docs — asyncio | 6,686 | 2,405 | 64% |
| Rust Lang | 5,107 | 1,515 | 70% |
| Total | 410,359 | 171,622 | 58% |
At Sonnet pricing ($3/M input tokens), that's $0.72 saved per batch of 7 pages.
Tools
| Tool | Description |
|---|---|
websearch_search |
Search the web via DuckDuckGo |
websearch_fetch_page |
Fetch a URL and return content as markdown |
websearch_search_and_fetch |
Search + fetch top results in one call |
websearch_search
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
str | required | Search query |
max_results |
int | 10 |
Number of results (1–20) |
region |
str | "wt-wt" |
Region code ("us-en", "wt-wt" for global) |
websearch_fetch_page
| Parameter | Type | Default | Description |
|---|---|---|---|
url |
str | required | URL to fetch |
max_chars |
int | 20000 |
Truncate output (1,000–100,000) |
extract_metadata |
bool | False |
Include YAML frontmatter (title, meta tags) |
heading_style |
str | "atx" |
"atx" (#) or "underlined" |
websearch_search_and_fetch
| Parameter | Type | Default | Description |
|---|---|---|---|
query |
str | required | Search query |
max_results |
int | 3 |
Pages to fetch (1–5) |
max_chars_per_page |
int | 5000 |
Max characters per page (1,000–50,000) |
Setup
Requires uv.
uv sync
Usage
MCP Inspector (dev)
uv run mcp dev server.py
Claude Code
claude mcp add websearch -- uv run --directory /path/to/mcp-websearch-server python server.py
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"websearch": {
"command": "uv",
"args": ["run", "--directory", "/path/to/mcp-websearch-server", "python", "server.py"]
}
}
}
Benchmark
uv run python benchmark.py
Fetches a set of real pages, counts tokens with tiktoken (cl100k_base), and reports HTML vs markdown savings with cost estimates for Sonnet and Opus pricing.
Dependencies
- mcp — FastMCP framework
- httpx — async HTTP client
- html-to-markdown — Rust-based HTML-to-Markdown converter
- ddgs — DuckDuckGo search (no API key)
- truststore — system certificate store for SSL
- tiktoken — token counting (dev dependency, for benchmark)
Recommended Servers
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.
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.
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.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
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.
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.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
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.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.